I’m in!

Posted by
April 16th, 2012 10:38 am

I’m in! Second time, using:

  •  Language/Framework: C# with XNA and an own library called GB2D presented in this post
  •  IDE: Visual Studio 2010 C# Express
  •  Graphics: GIMP, Inkscape
  •  Sound and music: Sfxr, Autotracker (perlscript to generate random music), perhaps trying Otamata or Aviary (presented here)

Why do I program an own library for 2D games? There are a lot of things I could use, like FlatRedBall. But… programming primitive components makes fun and I learn a lot – that’s all.

Here we go. The framework is downloadable here:

One of two main parts is the agent modeling. Every entity in the game is modeled as an agent which you can extend by loading the components you need. Available components are:

Audible: Playing sounds.
Bodily: For physical information like position in the game world.
Collisionable: This components allows to use collision detection. Two implementations (CollisionableBoxed and CollisionableLine) of this class exists: box-collision and collision with a set of lines.
Logical: Used for game logic and agent’s state.
Movable: Agent’s moving abilities. An example implementation (MovableSimple) of this class allows to move an agent in 4 directions with a given speed.
Visual: For drawing the agent. An inheritance of this class (VisualAnimated) allows to load an animation and provides animation functionality like starting a specific one etc.

So if you want to add a decorative element like a flying bee, you can initialize an agent with an own implementation of Audible (for humming), a Bodiliy component for positioning on the map, the Logical part to model the bee-specific flying in the game, a Movable part to allow moving in all directions and a VisualAnimated for drawing the bee.
A Collisionable component isn’t needed so it is not initialized. A decorative tree would have no Movable component. An invisible entity like a spawnposition no Visual part.

The second main part is a set of managers. Managers provide common and generic functionality:

DebugManager: provides debug textures and fonts for drawing debug things on the screen.
GameStateManager: handles the current state of game.
GuiManager: holds the GUI elements.
InputManager: manages the input from keyboard and gamepad. Allows to bind multiple keys to actions and set additional properties like a press lock, so an action is just triggered one time after pressing (the user must release the key and press it again to trigger an action again).
IntroManager: Shows a generic intro with name and that the game is used for the Ludum Dare competition.
MapManager: If the game has something like a map, this is used. It has just a MapSize attribute, an empty constructor, empty update and draw methods and a method to check if a given coordinate is within the map’s bounds.
MusicManager: Allows to load music and to play (stop, pause etc.) it.
PlayerManager: Holds the player’s controllable agents and was introduced for my network support (which is not part of the downloadable framework).
ScreenManager: This manager can handle multiple cameras on the map, different screens (split screen) and some methods to translate mapcoordinates to screencoordinates vice versa.

Many of these managers are just „stubs“, e.g. the GameStateManager – every game derives an xxxManagerImpl class to implement and overwrite the needed things, like introducing the game-related game state variables.

Additional there are some basic classes summed up as „common“ like basic math-method-wrappers in Util, a Line class or a Timer.
The obligatory Game-class (Game2D) for XNA-games is also included. It initializes the managers and the framework itself.
A very funny thing is the Textbox functionality which I implemented last days. Now it is possible to show a conversation – multiple textboxes typical in old roleplay games. Even the continuous display of the text is added and available via configuration.

There is also a sample project which sets up generic things like implementing the mentioned ManagerImpls. The IntroManagerImpl is fully implemented, because the Ludum Dare rules allow it. The Game1 class is filled with basic stuff, like setting up the empty and/or generic managers. The correspondent Content project includes a folder-hierarchy. The only content is a little sound used in the intro and some fonts (for intro and debug purposes, the latter used in the DebugManager class).

So if Ludum Dare starts, I will use the sample project, rename it and start implementing the Manager classes and agent components.

Preparation done 😀

If I have the time until weekend, I try to add graphic shader functionality or lightning.

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]