Archive | March 2014

Wireless Chess

Thanks to the electronics prototyping platform Arduino, some people (ok fine I don’t know who) managed to make a wireless chess board and I just find it awesome.

The best thing is the move of the pawns that are getting removed of the board.

It could be great if you want to play chess remotely while still touching the pieces. It would just take a lot of time to redo such a board.





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





Scrolling in Unity Space Shooter.

In the last post I was saying that the tutorial of Unity doesn’t describe how to do the scrolling in the SpaceShooter.

To do that, create a script for the Background component, file it under the “Scripts” folder.
And in it write or copy that:

using UnityEngine;
using System.Collections;

public class Scrolling : MonoBehaviour {

public float ScrollingSpeed = 0;

// Update is called once per frame
void Update () {
renderer.material.mainTextureOffset = new Vector2 (0f, Time.time * ScrollingSpeed);

Then save and go back to Unity. Click on the Background component, put a ScrollingSpeed (0.1 is good) and make sure your Texture’s Wrap Mode is in “repeat mode” by selecting the Texture in your Project view.

That’s all, you should now have your scrolling.





Unity Tutorial 2: Done ! (Space shooter)


I’ve finished the second tutorial on the Unity website.

You can play it here.
Again you’ll need the Unity Web Player to play it.

Arrow Keys – Move
Left Ctrl – Fire
R – Restart when dead

The chapter is cool but it doesn’t show how to have a scrolling background unlike what’s shown in the presentation of the tutorial.

If your Mono develop doesn’t want to start anymore for no reason like mine, you have to follow these steps to make it work again.