English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. General (https://eab.abime.net/forumdisplay.php?f=37)
-   -   Clash of the Tight-Uns: Blitz Basic Vs C (https://eab.abime.net/showthread.php?t=11046)

Steve 29 August 2003 00:23

Clash of the Tight-Uns: Blitz Basic Vs C
 
I was thinking about this while on me short holiday. I've recently (re) purchased Blitz Basic 2.1 just to bring back some memories of my Blitz coding days. Mainly just to flick through the manual. I'm not really interested in coding in Blitz any more.

Anyway onto the point. I also purchased the Amiga Shopper book called Complete Amiga C. This came with a registered C compiler called DICE. So I'm going to try out some Amiga C and see how quick it is for games compared to Blitz.

Now every Amiga programmer knows that assembler is the daddy when it comes to speed but who comes second? Amos is a bag 'o' shite as everyone knows but Blitz is superb and runs very fast thanks to the compiler. What I want to know is does anyone know the difference in speed between programs written in Blitz Basic and programs written in C. I'm talking about hardware hitting games programs.

I know C is the daddy when it comes to Amiga Workbench applications but how fast is it when it comes to writing Amiga games in C?

Has anyone here written an Amiga game in C?

Were any commercial Amiga games written using the C language?

How big is the speed gap between C & assembler?

Is C fast enough for an arcade style AGA Amiga game or should it just be used for Amiga Workbench applications?

I look forward to your comments...

Codetapper 29 August 2003 02:09

C is a poor choice for arcade games!
 
The answer depends! :)

If you are doing a game of tic-tac-toe on a workbench window, then C is fine and writing the AI routines would be much easier in C than say assembler and perhaps Blitz.

I would guess that Blitz would probably be a little slower at doing the computational stuff than C.

However if you are talking about arcade style games, Blitz would leave C for dead. There are quite a large number of games written in C - a lot of early 1988 ones use Manx C which is a pain as WHDLoad has to handle a bug in the compiler. But I've never seen anything in C like Defender which can be knocked up nicely in Blitz...

You might get away with something like Bubble Ghost in C (static backgrounds, few moving objects) but other than that I'd stay well clear unless you really want portability to other machines.

One final note - a lot of C programs are really slow because of the bloatware library that is included in many games. To open a file for example:

Asm: Using a macro, 3 lines included into the code or a subroutine called

C: Push all parameters onto the stack, call the routine. Which jumps to the real routine, which pulls the values off the stack, moves them into the registers, calls the same 3 lines of assembler than any decent coder would have done, then pushes the return code onto the stack and returns twice. Program reads the return code from the stack.

As you can see, the C implementation does a tonne of extra work moving stuff to/from the stack which slows programs down a lot. This is especially true for graphics.library functions.

Steve 29 August 2003 14:08

Interesting...
 
Are there any Amiga games written in C from 1994 onwards?

I'm pretty sure that FIFA International Soccer was written in C as it's a straight port of the (very slow) Megadrive version which was definitely written in C because I've seen the source code. So if FIFA was written in C then that explains the painstakingly slow speed of the game.

Another game which could have been written in C is Sabre Team as that's not exactly nippy either.

ant512 29 August 2003 16:02

It's worth noting that the Amiga's OS was mainly written in C - it's the language to go for if you want speed but don't want to learn assember.

It's also worth remembering that Blitz Basic features an in-line 68K assembler, and *all* of the commercial games written in Blitz (Gloom, Super Skidmarks, Guardian, etc) were mostly written using Blitz's assembler. The BASIC language was only ever used to do simple things like disk I/O or setting up displays.

If you want to write pure BASIC programs, Blitz is much faster than AMOS but still not really fast enough for commercial-quality games.

Severin 29 August 2003 16:20

Don't forget to go to http://www.blitz-2000.co.uk/ for the latest version of AmiBlitz, there have been alot of improvements since 2.1...

7-Zark-7 29 August 2003 17:39

Not that I'm programming inclined, but I recall a preview in The One of Sim City 2000, which used a derivative called C++, I think. (I remember because Akira said the Miggy version absolutely crawls,apparently!). That being the case, would it be probable that most of Maxis other Amiga game conversions at that time probably using C too?

Certain bits of Amiga Wing Commander used C according to a The One WIP,(but did also mix assembler).
What about the U.S. based PC ports of the early Sierra & Lucasarts adventure titles,what programming language would they have used? They were usually OS friendly & not noted for speed.

fiath 30 August 2003 00:19

Quote:

Originally posted by ant512
It's worth noting that the Amiga's OS was mainly written in C - it's the language to go for if you want speed but don't want to learn assember.

Just out of interest, anyone know when they started going over from BCPL? Perhaps KS 2 or 3?

Severin 30 August 2003 00:34

Quote:

Originally posted by fiath
Just out of interest, anyone know when they started going over from BCPL? Perhaps KS 2 or 3?
IIRC, parts of WB1.4 were done in C...

ant512 30 August 2003 20:05

If I remember correctly, I think that the filesystem was written in BCPL by a third-party as a last-minute replacement for whatever system Amiga hadn't finished in time. Most of the rest of the system was written in C.

Here's a bit of code from the NTSC A1000 Kickstart disk, which due to Commodore's incompetence includes the sourcecode:

PHP Code:

struct ViewPort
{
    
struct ViewPort *Next;
    
struct ColorMap    *ColorMap;  /* table of colors for this viewport */
                        /* if this is nil, MakeVPort assumes default values */
    
struct CopList  *DspIns;    /* user by MakeView() */
    
struct CopList  0èRÿ£u*SprIns;    /* used by sprite stuff */
    
struct CopList  *ClrIns;    /* used by sprite stuff */
    
struct UCopList *UCopIns;   /* User copper list */
    
SHORT   DWidth,DHeight;
    
SHORT   DxOffset,DyOffset;
    
UWORD   Modes;
    
UWORD    reserved;
    
struct    RasInfo *RasInfo;
}; 

Looks like C to me. If you want to see the rest of the code, get the A1000 Kickstart ADF and load it into a text editor.


All times are GMT +2. The time now is 05:03.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04283 seconds with 11 queries