Hello everyone!I would like to show you my progress in creating a platform game on the M5Stack (I know that the device is not intended for this, but why not?).
!!!Warning!!!
This project is a fan work, created mainly for educational purposes. All characters and graphics are owned by Sega.
First Steps
It all started with the usual attempt to make the animated picture move. I created an image with a set of sprites in Photoshop and converted it into a C array, and then wrote a function that copies these specific fragments of this image to the screen using the drawPixel function:
But it was a failure, as you can see, everything flickers when redrawing the frame. In addition, all this has a very low frame rate. I shared my progress on the Russian M5Stack community and wrote the problems that I encountered. And there Konstantin Bredikhin(thx him a lot) told me about the Sprite.h
library.
First good results
After my first try I spend a week exploring the Sprite.h
library. And now I was able to eliminate flicker and increase FPS. Finally, I could focus on the gameplay itself, made gravity, movement along slopes, added the ability to jump. I even wrote in C# my own level editor for this game.
But now another problem has arisen, the M5Stack does not accommodate Sprite with a size of 320 x 240 pixels and a depth of 16 bits. The solution was to use the best possible 192 x 192 16 bit sprite, so after one month, I decided to write my own rendering system.
Final
One year has passed, the goal of making a simple platformer has grown into a full porting of the first level of the game Sonic the Hedgehog. By exploring the source code of the original game, I managed to pull out level mappings, tiles, mask heights, objects positions. Also, thanks to the Sonic Physics Guide, I managed to make physics as accurate as possible to the original game.
Screen now is re-sizable, you can configure this in GameSettings.h
file.
- Optimal screen resolution is 160 x 120, on this resolution game reaches 30 fps.
- Maximal resolution is 320 x 200, on this resolution game is going on 9 fps.
- Over 50 fps is reachable on 80 x 80 resolution, but it's hard to play on that.
if you have any idea how to make game run on resolution of 320 x 200 with more than 24 fps, then you can send me a message to email - vadim.kadyrin@mail.ru
So,what was implemented?
- 360 movement
- Objects and Enemies
- Animated background
- Effects
- Animations
What was NOT implemented?
- Monitors
- Some enemies
- Background scrolling
- Music and Sounds
- Spikes
New rendering system based on palette and index buffer for it. Little example how it works:
Controls
- left, right button - movement
- middle button - jump
- left + right button in move - roll
- left + right button when standing - spindash (Sonic CD style)
Settings
You can configure stuff like key mappings and screen resolution the game in GameSettings.h
file.
Comments