Friday, June 23, 2006

Incan Chatterbots with roses

Brief Thoughts On A Object System For An RPG

In RPGs you generally want lots of objects, that can be used in a number of ways.
I think a good object interface would be:

interface IItem
{
void Render();
void Process();
void HandleMessage(IMessage m);
}

By default messages are ignored. But you could send messages like "Hear footsteps", "It's nighttime", "You've been stepped on.", "You've been moved by the wind", "You can hear talking" ...

I've mentioned message systems before in regards to implementing them in C#.

Today was quite productive really, I finished off the texture manager. Source code's avaliable here - I think it's overkill for anyone who isn't juggling multiple game maps on the screen at once. Have a look through, feel free to tellme how stupid I am :D It's fairly well commented and there's a windows application that demonstrates the idea quite well.

Next I switched back to the batching stuff I was doing. I added some code to my quad class and now it's texture setting stuff allows you to flip the texture on the horizontal, vertical or both axes. This is something that was noticably missing in the main project.

Weekend goals:
Simple Quad Tree Prototype (for einfall)
Houses (einfall)

Fuzzy Vague Goals
Tight map class (batching knowledge)
Hack tight map class into einfall.

One thought I was having is that classes like map, tile, sprite can get quite massive - you've got IO, GameStuff, Resources and Rendering. It's nearly impossible not to avoid having these things in your class to some extent - or at least they're prescene effects the design. (You could have IO entirely external but your class would have to be quite open).

I thought maybe something like:

Tile
{
RenderInfo renderInfo; // vertices, colours, highlights, position
GameStuff gameStuff; // blocking, objects / monsters, triggers
IO io; // save load the tile
LayerInfo layerInfo; // tiles stacked on top of this one.
}


But it's messy and it makes really long code lines. Instead I think I'm just going to resign myself to the fact some classes are fatter than others and split the code into logical chunks using partial classes.

If you don't know what partial classes are you may not have played with c# recently - basically it allows you to split a class over a number of code files.

No comments: