My first SDL2 application - a clone of a famous amiga game

Hello SDL-community,

I want to introduce you my first SDL2 application. It is a clone of a famous amiga game.
C source code and a window-exe file for the game is included.
if you want to compile under linux there is also a make file included. Hope you enjoy this little game/demo.


If you have any questions about the code and my techniques please ask in this topic.

Best regards

1 Like

Hello everyone,

I ‘forgot’ to provide some additional informations about my SDL2 projekt.

  • It is the 1000000. clone of the amiga game ‘Emerald Mine’ / Diamond Caves. (two player mode not supported yet)
  • smooth levelscrolling at 60 frames/s
    ‘game engine’ (have to use at least one buzzword here) supports a leveldimension up to 32000 x 32000 pixels
  • full screen and windowed video mode support
  • game menu music uses 4 channel protracker music, modplayer by Michal Procházka (GitHub - prochazkaml/MODPlay: Simple 4-channel MOD player library written in C)
  • game sound is realised with a very very small piece of sdl_mixer.
  • levelgroups and configuration files are stored in XML format. Ezxml by Aaron Voisineis is used as a XML parser.
  • level data is compressed with miniz by Rich Geldreich.
  • own buttons, radiobuttons and checkboxes
  • supported input devices: keyboard, game controller (tested with XBox controller) and joystick (tested with competition pro usb)
  • linux compilation: a simple makefile is included.
  • windows compilation: a code:blocks project is included, but the toolschain mingw64 should be sufficient, a windows exe file is included in the package.
  • level editor and many levels included
  • project was started in september 2022

Maybe this project is helpful for other SDL beginners like me.

Best regards

1 Like

I am a absolute beginner of SDL application.
Well, I need a C++ project for spatialized sound with SDL.
Cloud you help me please.

Hi Vnay,

I use only mono sound samples for the game and the game music is played in stereo.

I’m pretty sure that SDL2 doesn’t support “spatialized sound” / surround / 7.1 sound “out of the box”.
I can’t found surround support even in the SDL_mixer library.
If I’m wrong, someone could please correct me.

Maybe you have a look at OpenAL.

Best regards

Thank you for your reply.
Well I think that it is possible to support spatail audio using panning function in SDL-mixer.

OK, if “spatialized sound” with two channels is sufficient then you can use SDL_mixer.

There are some functions in SDL_mixer for your purpose:
int Mix_SetPanning(int channel, Uint8 left, Uint8 right);

int Mix_SetPosition(int channel, Sint16 angle, Uint8 distance);

int Mix_SetDistance(int channel, Uint8 distance);

I recommend to play around with these functions. Before you can do it you should be able to play a wav sound with SDL_mixer. wav data must be first “converted” into chunks and can then be played with Mix_PlayChannel(channel,&chunk,0)
SDL2_mixer/Mix_PlayChannel - SDL Wiki.

Thank you very much.