Archive | Programming a game RSS for this section

2D Roguelike Unity 3D Tutorial

I followed this tutorial to the letter :

And it worked. I was wondering about some of the teacher choices, but it became clearer towards the end.

I discovered some new tools of Unity 5 with this.

And I tried to build it on a lot of platforms.

So while in the Unity Editor, it looks like that:

In the Android version it looks like that:

Yeah…. The camera is not adapted. Also I ran in a lot of issues while trying to compile for Android. If you download the Android SDK with Android Studio, you must download the tools separately and replace the tools folder in the Android SDK. And be sure to change the publishing name in the Player Settings like being told to, because Unity won’t compile otherwise.

I tried the web browser version… and:

Yeah… I don’t know what happened here. You can try the game yourself here.

The game only usually works with the arrow keys, or slides on Android, but here, nothing is recognized.

Finally on a “normal” Windows build, we have:

There is a weird line in the middle of screen.

So as you can see, I’m up to some tweaking ! After that I’ll try to add some new features !


Paper Shooter

Paper Shooter is a version of Shootius with new graphics made by one of my friends.

You can download it here.


Everything else is the same than here :

Except I fixed the Wood Satellite weapon! 🙂


Follow me on Facebook : RockMarc

Or on Twitter : @DebuggingWorld


Share if you like the content of this blog.

It’s alive ! AAA-LLIVE ! Shootius 0.25 !

After many months spent with a buggy version of Shootius, I finally took the time to debug it.

Thanks to Visual Studio’s cryptic error messages, it took me a while to figure out that in C++ when to do that in your .hpp :

static std::vector<Player*> playerList;


You have to declare it also in your cpp:

std::vector<Player*> GameState::playerList;

Because it is static.Coming from Java and C#, I didn’t find that very intuitive.


New release of my game !
Download Shootius 0.25 for Windows

Release Notes:

– Changed resolution

– Working on 4 players mode

– Changed Life bars display

– Made the code cleaner and more dynamic as always.



Known Issues:

– I screwed up the Wood Satellite weapon

– The score now displays in the Enemy Selected Life Bar


Arrow Keys – Move
Spacebar – Fire Shot
X – Elec Spark
C – Wood Satellite
P – Pause
Esc – Quit the game


Follow me on Facebook : RockMarc

Or on Twitter : @DebuggingWorld


Share if you like the content of this blog.

Cataclysm Hunter : my Dawson College pre-jam game.

I tried my first game jam ! Weeks ago ! (but since I publish one post by week-end and I wanted to show the game at a meetup I kept the “exclusivity” for the meetup.

First I want to thank all the pre-jam team including Dawson College, Critical Hit and the mentors. The power plugs were ready, the wi-fi was working, the people were kind and there was food.
Only the weather was freaking cold but it’s not because of the game jam people. 😛

What is a game jam?
It’s an event where everybody meet and team up to do a game during a limited time (Usually a week-end). You don’t have to know how to make a game or to code to participate. Everybody is welcome and can come and learn. Of course there are some artists, game designers, sound designers and programmers but you can try one of this job/task during the jam.

The theme was “Cataclysm”. So I teamed up with another programmer and we did “Cataclysm Hunter” in less than 2 days.
You know the people who go near cataclysm to have sensations and/or take photos? That’s what we tried to do with the game.

The game can be played from 0 to 4 players. It only works with one Xbox 360 controller (other controllers should be fine but we didn’t try them) by player. You choose the number of players by plugging enough Xbox 360 controllers.


The goal of the game is to move your character the closest possible to the volcano while using the Left Stick of your controller.
Take a photo while pressing A and go back to the car to get your points. All that while avoiding hazards and other players.

You can also push other players with the B button and while holding a direction. So aim for the other player direction­.

The closest you get from the volcano, the more points you get. You can only take one photo by roundtrip. So if you can’t press A anymore it’s because you have to drop the photo to the car. You can take a photo wherever you want, but of course it’s more advantageous to get closer to the danger. You can’t move while taking the photo, leaving you vulnerable to the other players and hazards. 😀

There is also a bug which ended as a feature (programmer’s life): If you get pushed while taking a photo, you’ll end up pushed way more far than planned.

This game was made with Unity3D, and I learned to use it for 2D games during this game jam (because I only did the tutorials before which were made for 3D games even if made for a 2D plan).

The thing to transition from Unity 3D to 2D is to change the names of the classes you usually use:

RigidBody? = RigidBody 2D !
Collider? = Collider 2D !
Same for the methods OnTriggerExit and OnTriggerEnter which become OnTriggerExit2D and OnTriggerEnter2D.

And voila ! Enjoy !

Click Here to play the game.

Unity web player plug-in needed

Julien Deville and me – Programming and … “programmer’s art”
Zach Miller – The great chip tune lasting exactly 2 minutes.







Migrating Shootius from SDL 1.2 to SDL 2.0

As written here, I wanted to migrate my little game to new version of SDL.

Oh wow what a pain it is !
There is a lack of documentation and examples for both versions of SDL.
I should really stop using this library. I even thought of migrating Shootius on PS Vita, but then nobody would be able to try it.
Regarding Unity 3D, it seems practical for 3D but not really for 2D.

So I stayed with SDL 2.0 and this is what I’ve learned:
– It’s better and faster to use SDL_Texture instead of SDL_Surface but don’t erase them immediately ! You in fact need both.
For my case I had to first load optimized SDL_Surfaces, then apply the transparency, then convert them to texture. Then you render the texture… which makes 3 times more lines of code…
– Replace SDL_BlitSurface by SDL_RenderCopy
– Replace SDL_Flip by SDL_RenderPresent
– Replace SDL_FillRect by
SDL_SetRenderDrawColor(sdlRenderer, 50, 50, 50, 255);

for full screen OR
SDL_SetRenderDrawColor(sdlRenderer, 0, 0, 0, 255);
SDL_RenderFillRect(sdlRenderer, &positionGameplay);

for a specific rectangle(SDL_Rect).

Naahhh I was wrong. You can certainly do what’s above but if you have “SDL_Surface”s you can just keep them and change “SDL_BlitSurface” by “SDL_UpdateSurface”. It’s way simpler. Also some of your constants like SDL_HWSURFACE are not recognized, since they were equal to 0, you can just replace them by 0. I should still use textures but SDL_RenderCopy is giving me trouble not wanting to take my destination rectangle into account.

– You should instantiate a SDL_Window instead of a SDL_Surface. Read me.

– In SDL_SetWindowTitle, give the sdlWindow instead of the main SDL_Surface (often called “screen”).

That’s it for what I understand so far. I’m going back at it.

SDL Wiki Migration Guide
Lazy Foo productions






Space Shooter 2

I made a little modification of the Unity tutorial project.

You can play it here.

You can no longer shoot. You just have to avoid hazards. Strangely there is a bug at the beginning of the game which disappear after a while. It makes asteroids disappear randomly.
I have to look into it.

There is also the scrolling of the background I talked about here.

Pro tip: You can reduce your hitbox by moving left or right.

My record is 6540 points. I could have gone more far but the background and the music got the best of me.





Shootius 0.24 released

New release of my game !
Download Shootius 0.24 for Windows

BUT I discovered that SDL is now available in version 2.0 and my game is using version 1.2, so it will take a lot of time to switch between the two versions.
In the end, it should be easier to develop with version 2.

Arrow Keys – Move
Spacebar – Shoot
Z,X,C – Switch between weapons ( Z is the default one)
P – Pause
Esc – Quit the game

Release Notes:
– Changed some sprites (took some temporary sprites from Spelunky and Gradius Rebirth)
– Game Over screen
– Restart level if dead
– Cleaning code as always
– When you kill the boss, you move directly to the next level

Known issues:
– Only 3 levels available