Friday, November 6, 2009

Simple C++ class factory

Modern languages like Java or C# allow programmers to create new objects dynamically using class name ( ie. Class.forName() in Java ). This feature is not easy available in C++. The question is why to use any class factory at all? Basically, if you're a game programmer you should already know about such things like serialization and deserialization processes. Also, if you own a class factory then it's way easier to control all the allocations and memory usage.

continue reading >>

Wednesday, November 19, 2008

J2ME particle system

While I was checking out XNA stuff I saw many tutorials and examples of animated particles. WIth XNA it’s rather simple task. I tried to go a little harder way and implement similar solution on J2ME compatible device.

Particles are objects which have their own lifetime and specific motion behavior. After the time is up they just simply disappear. Particle system must handle multiple objects considering that they may own different motion behavior and also different lifetime.

Because mobile devices are rather slow I decided to use a bit more memory and created sprite images for each shading/blending level. All sprites are generated by the midlet. There are no PNG files but for making more fancy particles I’d rather go with PNG images. In this case there was no such need. There’s lot to be optimize yet but I’ve made my particle system in half an hour just for checking if the idea works ;).

continue reading >>

Circuit - simple J2ME game

“Circuit” is very simple game. The idea is based on the minigame from “Ratchet & Clank: ToD” for PS3. The player controls a ball to close a circuit whenever impulse is about to jump from one end of track onto another. The goal is to unlock electronic lock. Each impulse may split or collide with another one ( which makes them both disappear ). In oroginal PS3 minigame a player was supposed to use Six-Axis controller. Mobile game uses the accelerometer to control the ball.

continue reading >>