11
« on: March 27, 2011, 05:03:42 PM »
Hello there,
i discovered this community when i decided to start my first roguelike project and immediately registered in order to share my ideas with you experienced roguelike programmers...
I'm NOT new to game programming, this is just my first roguelike game.
I intend to use c# with no additional library (i know most people use some version of the curses lib). I know that a large part of you think that many aspects of roguelikes are not to be designed in advance but i think it would be wise to design the major framework at least...
I want to share with you the data structures i had in mind (pseudo-code, of course):
// entities represents anything in the dungeon
//
class Entity
{
Char glyph;
Color Background;
Color Foreground;
int X, Y;
}
// hero and monsters are actors
//
class Actor subclass of Entity
{
abstract Action Think();
}
// an object that tells you the next actor that has to make
// a move
//
class ActorScheduler
{
Actor Current;
void GoNext() { ... }
}
// an action is anything that an actor can do
// examples are:
// MoveAction
// UseItemAction
// AttackAction
// etc
//
class Action
{
abstract void Execute();
}
class Dungeon
{
grid of tiles (empty, wall, corridor, room, door etc)
list of entities
}
The main loop should look like this:
Action action = actorScheduler.Current.Think();
action.Execute();
actorScheduler.GoNext();
// maybe update fov, stats display etc...
repeat untill gameover
That's all about the framework. Another thing i had in mind was the following:
class Entity
{
everything like before
// This method has the following meaning:
// if the hero touches this entity, what happens?
// for example an ItemEntity should return the PickUpItemAction
// I'd really appreciate suggestion for the name of this method...
// I know that ProvidedInteraction is not very clear...
//
Action ProvidedInteraction(Actor actor);
}
WELL... i know it's a long post but i hope someone reads it all and shares his opinion with me...
Bye