I just completed a very simple puzzle game with SDL in C++, and I'm kinda proud of it and want to show it off here. Note, I'm proud of the technical part, not the game design or art(Coz that's simple and crappy). I worked on it for maybe 2-3 nights(yeah, I don't work in daylight), and surprisingly I didn't bump into any bugs or memory leaks.
I'm also releasing the source, so if anyone wanna try building it or look at it, you're welcome. I tried doing some documentation along with the source, but I'm not good at it, at all. Any comments? Suggestions or ideas?
-Controls:
- WASD - Move selection
- Space - Choose current coins
- 1 - Simple Mode ( Green )
- 2 - Hardcore Mode ( Red )
- Q - quit
- Enter - Keep playing ( After winning )
-Basics
The objective of the game is to score as many points as possible. The points are represented as a green or red bar in the bottom of the window.
The SImple Mode is the relaxed, no-brainer mode. The Hardcore Mode is a requires a little more thinking. You can switch mode any time during the game by pressing 1 or 2.
Every coin has a value from 0-3.The total value of the selected coins determines your score.
You move the selection with the WASD keys and choose the currently selected coins with the space button.
When you push the space button, the game rewards you with points, the bar in the bottom of the window stretches out and the coins disappear.
New coins then appear from the top of the window.
-Simple Mode (Green)
Your objective is to get as high total value as possible. You select a maximum of 5 coins at the same time, both the red and green lines mark your selection. The bar in the bottom of the window is green.
-Hardcore Mode (Red)
Your objective is to get a total value as close to 6 as possible. You select a maximum of 3 coins at the same time, the red lines mark your selection. The bar in the bottom of the window is green
-Winning the game
You win the game when your score bar reaches the right end of the window(600).
When you win, all the coins disappear and your score slowly depletes. Press enter to keep playing. I have not created a representation for scores over 600.
Edit: Want to try compiling on windows? This download should give you all the necessary source files and graphics.
Re: Simple Puzzle game with SDL
Posted: Tue Feb 23, 2010 12:27 pm
by Falco Girgis
5 starred and favorited. It's looking pretty damn good. If I didn't have a huge test in an hour for a class that I've done nothing in, I would be playing it now.
Re: Simple Puzzle game with SDL
Posted: Tue Feb 23, 2010 8:16 pm
by eatcomics
Playing it now :D I'll tell you more after I play :D
Dam didn't notice it was for Mac... Oh well sorry, I guess I'm not gonna be able to play, but looks awesome :D
Re: Simple Puzzle game with SDL
Posted: Tue Feb 23, 2010 9:46 pm
by dandymcgee
Cool. I would suggest using different colors or shapes though, as matching the lines up is really difficult to do with a time limit.
Re: Simple Puzzle game with SDL
Posted: Wed Feb 24, 2010 5:29 am
by Sanshin77
dandymcgee wrote:Cool. I would suggest using different colors or shapes though, as matching the lines up is really difficult to do with a time limit.
You did look at the rules? I don't think it's hard, and you're not really supposed to match them(check the rules). It might be an idea, but it's really a pretty different type of gameplay then. Might be a good idea for zaCoins 2 :P although I'm not going to work on that right now.
eatcomics wrote:Playing it now :D I'll tell you more after I play :D
Dam didn't notice it was for Mac... Oh well sorry, I guess I'm not gonna be able to play, but looks awesome :D
I'm sorry, I don't use windows, at all. You can download the source and it's all in SDL and C++ so it shouldn't be hard to compile it, you might have to change the #include's.
I'll try putting together a windows build soon.
Re: Simple Puzzle game with SDL
Posted: Wed Feb 24, 2010 8:44 pm
by eatcomics
Sanshin77 wrote:
dandymcgee wrote:Cool. I would suggest using different colors or shapes though, as matching the lines up is really difficult to do with a time limit.
You did look at the rules? I don't think it's hard, and you're not really supposed to match them(check the rules). It might be an idea, but it's really a pretty different type of gameplay then. Might be a good idea for zaCoins 2 :P although I'm not going to work on that right now.
eatcomics wrote:Playing it now :D I'll tell you more after I play :D
Dam didn't notice it was for Mac... Oh well sorry, I guess I'm not gonna be able to play, but looks awesome :D
I'm sorry, I don't use windows, at all. You can download the source and it's all in SDL and C++ so it shouldn't be hard to compile it, you might have to change the #include's.
I'll try putting together a windows build soon.
Cool
Re: Simple Puzzle game with SDL
Posted: Thu Feb 25, 2010 10:45 am
by dandymcgee
Sanshin77 wrote:
dandymcgee wrote:Cool. I would suggest using different colors or shapes though, as matching the lines up is really difficult to do with a time limit.
You did look at the rules? I don't think it's hard, and you're not really supposed to match them(check the rules). It might be an idea, but it's really a pretty different type of gameplay then. Might be a good idea for zaCoins 2 :P although I'm not going to work on that right now.
Wow I'm really sorry, I misunderstood the game play due to the highlighting lines being so hard to see in the video. I didn't read the rules because I didn't plan on playing it (for the sole reason of not having time at the moment to compile it for windows). Using shapes or colors would actually make this game quite a bit more difficult. :P
Re: Simple Puzzle game with SDL
Posted: Fri Mar 12, 2010 7:03 pm
by Sanshin77
So, I tried putting together a windows build some time ago, but It didn't work, I had some problems with linking SDL and SDL_image.
If this isn't too much to ask, could someone try to compile it on windows, shouldn't be too problematic, just change the includes in Lib.h to the windows equivalients. Of course I can't force anyone to do this but I'm interested in getting a windows build for this, I'm terrible in other IDE's than XCode and my windows partition is messy, slow and almost filled.
Re: Simple Puzzle game with SDL
Posted: Fri Mar 12, 2010 10:14 pm
by eatcomics
Sanshin77 wrote:So, I tried putting together a windows build some time ago, but It didn't work, I had some problems with linking SDL and SDL_image.
If this isn't too much to ask, could someone try to compile it on windows, shouldn't be too problematic, just change the includes in Lib.h to the windows equivalients. Of course I can't force anyone to do this but I'm interested in getting a windows build for this, I'm terrible in other IDE's than XCode and my windows partition is messy, slow and almost filled.
If you're using SDL then yes I can, just uh, IDK give me the code, then I get you the executable somehow...
Re: Simple Puzzle game with SDL
Posted: Fri Mar 12, 2010 10:46 pm
by Sanshin77
eatcomics wrote:
If you're using SDL then yes I can, just uh, IDK give me the code, then I get you the executable somehow...
The link has always been in the original post :P
Sanshin77 wrote:
I'm also releasing the source, so if anyone wanna try building it or look at it, you're welcome. I tried doing some documentation along with the source, but I'm not good at it, at all. Any comments? Suggestions or ideas?
What is the problem, can you expand the archive? can you see the files? They should be .cpp and .h files, if you see one or two hidden mac files, with different extensions, ignore them...(thumbs.db for instance). My project file won't work on windows, so you'll have to create a new SDL project, link to the proper libraries(SDL and SDL_image) and import my files.
I'll PM/email you tomorrow if that doesn't work...
Re: Simple Puzzle game with SDL
Posted: Sun Mar 14, 2010 9:36 pm
by dandymcgee
Sanshin77 wrote:
What is the problem, can you expand the archive? can you see the files? They should be .cpp and .h files, if you see one or two hidden mac files, with different extensions, ignore them...(thumbs.db for instance). My project file won't work on windows, so you'll have to create a new SDL project, link to the proper libraries(SDL and SDL_image) and import my files.
I'll PM/email you tomorrow if that doesn't work...
You should really consider adding error checking, especially in places like this:
Dead(false){
if(pSource == NULL)
pSource = loadSurface("Coin.png");
if(pOne == NULL)
pOne = loadSurface("One.png");
Y = 0-pSource->h; //POTENTIAL CRASH HERE
Value = zaRandom(0, 3);
}
The commented line of code is accessing the height attribute of a (potentially) NULL reference. You should check whether or not the images were successfully loaded.
There are also some other major errors that need to be fixed. See example test run (unaltered code) below:
Re: Simple Puzzle game with SDL
Posted: Mon Mar 15, 2010 10:43 am
by Sanshin77
Yea.. I'm not really good on the error checking stuff, that's usually what I start doing when it actually crashes.(Which is a bad idea, I know)
Seems like I'll have to try seting up SDL and Dev-C++ properly then, to do some Windows testing and compiling... From that Image, it seems that it's not drawing the background, don't know why though... I get the exact same effect If I comment out:
I don't expect you to do the bug testing and fixing of my source though, so nevermind. I'll ask on this forum If I can't manage to setup SDL on my own.