January 16, 2017

Engine Under Construction: TinyEngine - Part I

During the past two weeks, I started working on the TinyEngine framework. This library defines the object structure that I will build upon when writing the game. It will speed up development time and in a couple of months -if the binary gods are on my side- it will allow me to focus on the game rather than getting caught up in annoying technical details. 

Let's take a look at the first series of classes which I have already coded:

GameObject is an abstract class from which many of the game object classes will be ultimately derived. The functionality of this class is limited. It has two methods: Draw() and Update(). The Draw method is used to... Draw? Yes. It is used to render the game object on screen while the Update method is used to update the state of the object.

Derived from GameObject is the Sprite class. This concrete class contains the core functionality to manage sprites. It has a good number of properties like Image, Position, Scale, Rotation, Acceleration, Velocity, Color, BoundingBox and HitBox among others. The collision system will be based on axis-aligned rectangles which should be enough for the game I've in mind.

My second computer (TI-99/4A)

(From Wikipedia) The term sprite was first used in the graphic sense by one of the definers of the Texas Instruments 9918(A) video display processor (VDP). The term was derived from the fact that sprites, rather than being part of the bitmap data in the framebuffer, instead "floated" around on top without affecting the data in the framebuffer below, much like a ghost or "sprite". You can read more about it in the following Wikipedia Article.

Let's continue with the framework presentation. Derived from Sprite is the AnimatedSprite class which augments its base class with frame-based animation capabilities and the TextSprite class that represents text on screen.

The ViewportAdapter class is responsible for the resolution independence rendering that will scale all the graphics and input to fit the size of the target screen. BTW, the native game resolution will be 320x180 pixels.

Lastly, Scene is another abstract class used to represent the different screens available during the game such as the main menu, the different rooms and any other kind of screen we can think of. So, whenever I need to create a new screen for the game I will be inheriting from this class to insert the required game logic and sprites.

As you can see, the class diagram is very clear and precise; all class names are obvious. This is for sure a good design signal. 

Visual Studio includes code analysis tools to discover potential issues in code, such as non-secure data access, usage violations, and design problems. Code metrics is a set of software measures that provide developers better insight into the code they are developing. Luckily, the library has very good results.

So, everything feels tiny and solid! So it's time to celebrate!

My Kids!

This week will be spent on coding the remaining set of classes. My idea is to get the TinyEngine  library up & running by the end of January :-)

- Diego

1 comment:

  1. Amazing Diego. Keep the good work!! We will be looking into your job deaply. Thanks for sharing!! Beautifull kids.