Fabien Sanglard's non-blog

  




Shmup: Source code

June 30th, 2011


Source Code Released


I have decided to release the full source code of SHMUP a shoot'em up 3D engine specially designed for mobile platform and released on iOS in 2010. The game and engine are fairly inspired of Ikaruga, the legendary shmup from the 1999 DreamCast. Anything you saw in Ikaruga, this engine can do it too.
The license is GPL which mean you have to release the source code of what you produce with it. Note that the data folder is provided so you can play with it but you are not free to redistribute it and I remain the owner of the content (except for the song from Future Crew that was licensed).

A few noticable features:


Source code (GPL) Video

License

The source code is being released under GPL license. Note that the data folder is provided so you can play with it but you are not free to redistribute it and I remain the owner of the content (except for the song from Future Crew that was licensed).

Android port

Since the core of the engine is pure C it should be easy to port to Android. The Native Development Kit should allow the engine to be compiled as a library and you just have to write a few wrappers to take the user input, play the music and sync with the screen. If anyone is willing to do it I am ok with publishing it and sharing the revenu 50/50 (just let me know in advance you are working on it to avoid overlap).

3D world but 2D control


The game is a bit special because it is all 3D but you only control your ship in 2D within the screen space. I was not so trivial to accomplish at first but I wrote a first version in Java a few years ago: What I did was to draw the background with perspective projection then clear the depth buffer, switch to orthogonal projection and draw the entities/bullets. It was working ok but there was no way to have continious transition between cinematic and game since the entities were not really part of the 3D world.

This version actually recalculate each entity matrix for each frame starting from their 2D screen coordinates. This way even though the camera moves in the 3D world, the entities look "glued" to the screen...and you can switch from cinematic to game at will.

With more time...

There are a few things that I wish I had time to do. The reason it wasn't done is because I was burned out.


Add a comment



Name Homepage
E-mail
(Will not appear online)
Comment



Comments (11)


#1 - Gary - 07/02/2011 - 07:51
Thanks for this great source code, it really helps beginner like me to start learning OpenGL ES and game programming. May I ask for some suggestions to learn 3D programming ? I currently started studying Opengl ES, and would like to learn shader, what techniques I must acquire to become a professional graphics programmer like you, do I even learn assembly programming for optimization? Thanks again.
#2 - Fabien Sanglard - 07/02/2011 - 11:37
@Gary If you want to learn:

- Start with very simple easy things, if you look at the articles on my website you will see a progression in what I worked on:
- Java Demomaking
- 2D shmup
- 3D shmup
- Shaders, bumpmapping, shadowmapping
- Move to high grounds: Write your own 3D engine, game, harder effect (light scattering).
- Read as much quality source code as you can find.
- If you have the passion all this will come naturally
#3 - Joel - 07/05/2011 - 17:00
Thank you so much for doing this, I am an aspiring programmer and you site has been very inspirational to me.
#4 - Pavel - 09/04/2011 - 12:45
have you tried valgrinding dEngine? You have a couple of memory leaks in readConfig/ related code. So of them make it crash for me with gcc4.6/ linux. Furthermore you do use some c99 loops in contrast to your previos article. However if I can get it running on linux/Qt, I might try porting it to Android..
#5 - tibo - 11/10/2011 - 10:28
Hello Fabien and thanks for the source code.

I was looking for the complete source of a shmup that I could compile and run so I can understand how everything works. Is it possible to compile and run your code on windows, I don't see if I can link and use opengl ES on windows...

Thanks!
#6 - Fabien Sanglard - 11/10/2011 - 11:21
@Tibo,

There is a Visual Studio project in the source code. You need to download Imagination Technology OpenGL ES framework (there are the manufacturer of the PowerVR chips found in iPhones and Android devices.

The vs project is a bit outdated (missing a few includes) but last time I tried it was building fine.
#7 - Shanflin - 02/26/2012 - 23:53
Hi,sir! I want to know how you generate the resoures such as the .scene files ,the script, using some tools?
Can you tell me?
Thank you!
#8 - Fabien Sanglard - 02/27/2012 - 00:03
@Shanflin

The scene and script are generated by hand. If you write anything to generate them automatically
please let me know :) !
#9 - Robert - 08/18/2012 - 15:43
How can make pause/resume the game?
I see GameCenter implementations. But you can not see that anything was saved.
Example, points earned? Other achievements?
How generate scene and map file?

Thanks
#10 - Marco - 10/04/2012 - 13:37
Your code is helpful to learn and study game dev. Thanks.
I have tried to convert .cp to .cp2b, and it always fails with your functions provided.
Would u provide some guide for me?
Thanks.
#11 - Fabien Sanglard - 10/06/2012 - 22:49
@Marco

Can you explain further how it fails ? The game was produced with this exact source code so it should work :) !

 

@2011