Learning C games dev for the ZXN

The Speccy's spritely young offspring. Discuss everything from FPGA to ZX
User avatar
ParadigmShifter
Dynamite Dan
Posts: 1094
Joined: Sat Sep 09, 2023 4:55 am

Re: Learning C games dev for the ZXN

Post by ParadigmShifter »

All the people I ever worked with who programmed on the Amiga (which was before my time, I started with C on PS1) used to do it in assembly (same CPU as Megadrive as well) so I don't think C was that popular at the time.

I think C only became very popular for games when the PS1, Saturn and N64 days, and late DOS days when Watcom compiler came out which had a good optimiser, and a flat memory model. People used to be suspicious of C (slower than assembly language) in a way that C++ was seen as slow compared to C in the PS2 days. (There's no real reason C++ should be slower than C it's just people using it wrong really. It's very very very easy to use C++ wrong though of course!). Even most C++ code I saw for PS2 and later they tended to reroll their own implementations of standard library containers even though they could have just used their own allocator instead (all containers in C++ std library let you choose a non-default allocator). C++ does come with more code bloat than C though I will admit.

Doom was obviously written in mainly C and Quake was C++. They had lots of ASM as well though in the renderer/rasteriser (pre hardware 3D acceleration days). Quake really was an amazing advance on software rendering techniques when it first came out, was much more impressive than Doom.

Obviously nearly all Windows programs (non-games ones anyway) were written in C though even in the days of 16-bit Windows.

Nowadays it probably makes sense to develop for the Amiga in C though (mainly with a bit of ASM for rendering), gcc is pretty good now, I assume there is a 68000 targeted version of that.

68000 is also a pretty nice CPU to write ASM for compared to say the R3000 of the PS1 which was a bit of a nightmare (had delay slots after branches etc., so it always executed the next instruction following a branch even if the branch is taken). 68000 ASM is pretty similar to ARM these days I think.
danboid
Dizzy
Posts: 62
Joined: Sun May 12, 2024 11:16 am

Re: Learning C games dev for the ZXN

Post by danboid »

ParadigmShifter wrote: Tue May 21, 2024 3:43 pm Nowadays it probably makes sense to develop for the Amiga in C though (mainly with a bit of ASM for rendering), gcc is pretty good now, I assume there is a 68000 targeted version of that.
https://github.com/bebbo/amiga-gcc
User avatar
ParadigmShifter
Dynamite Dan
Posts: 1094
Joined: Sat Sep 09, 2023 4:55 am

Re: Learning C games dev for the ZXN

Post by ParadigmShifter »

Sadly I missed out on the Amiga days (Speccy broke when I was 17, then I was a poor student).

I didn't even own a PC or laptop until after about 12 years of working as a games programmer lol :) (I did have a PS1 and an N64, then an XBox and Gamecube, but nothing to program on except at work).

I also only learnt ASM for the Z80, did not program in ASM for anything else (could read ASM a bit though, just not write it). Once had to extend an OS/2 device driver from IBM written in x86 though without knowing much ASM at all. (So I did that by rewriting bits of the code in C, looking at the assembly output, and comparing it to IBMs code). It's easy enough to call C from ASM and vice versa though.
danboid
Dizzy
Posts: 62
Joined: Sun May 12, 2024 11:16 am

Re: Learning C games dev for the ZXN

Post by danboid »

It seems the Scorpion Engine now has, or it will have soon, Neo Geo support.

I think its unlikely they'll add Next support to the Scorpion engine as its probably too different from the MD/Amiga/Neo Geo, not being a m68k machine but I've asked the dev if they've considered adding Next support. Will let you know how they respond.

I'm quite interested to hear from anyone who has used Godot to develop for the Next by integrating z88dk. What advantages does godot bring over my IDE of choice when developing for the Next?
User avatar
ParadigmShifter
Dynamite Dan
Posts: 1094
Joined: Sat Sep 09, 2023 4:55 am

Re: Learning C games dev for the ZXN

Post by ParadigmShifter »

I was wrong about Quake being written in C++ they only moved onto that for Doom 3 and later games. It was written in a C+ style though (which is to say write C in a style similar to C++, so you would have THING* THING_Create(), THING_Destroy(THING*), and nearly all THING_DoStuff functions would take a pointer to THING as first argument so basically member functions implemented in C, which is how we used to write PS1 games in C too. You can use a vtbl member for virtual functions and inheritance as well) ;)

First hit on Google says the game logic was written in QuakeC (interpreted C like language) but I don't think they used a lot of that (can be used to write plugins though).
Post Reply