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.

Download:
https://github.com/Mikiman1964/FirstSDL/releases/download/v1_05/FirstSDL2.zip

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

Best regards
Mik

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
Mik

1 Like

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

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
Mik

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

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:
panning:
int Mix_SetPanning(int channel, Uint8 left, Uint8 right);

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

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.

Hello everyone,

I want to bother you with my SDL2 app one last time. Thanks to all the people who downloaded the game.
You can download the latest version from github: https://github.com/Mikiman1964/FirstSDL/releases/download/v1_06/FirstSDL2.zip

News in this version:

  • pipes: The player is protected against explosions and enemies within a pipe
  • shield coin: The player is protected against explosions and enemies for a certain time
  • growing walls: very nasty
  • some new steel elements
  • many new levels

Older levelgroups are compatible with the latest version.

I added a README.md with instructions how to compile under linux. For compiling under windows there is a code:blocks project included.
An exe file is included for windows. (\FirstSDL2\bin\Release\FirstSDL2.exe)

PS.: Please send your own levelgroup to dieter1964(at)gmx.net.

I wish you all a Merry Christmas and a Happy New Year.
Mik