Archived

This topic is now archived and is closed to further replies.

Dawnstrider

Text engine

Recommended Posts

I have yet another question regarding my text RPG engine. If I''ve been posting a bit too much on this subject, someone let me know, I seem to get stuck a lot. Anyway. I''m trying to figure out how to do my text display. Since for the most part I only have my creatures different from my players in how they receive input, what I have is a global Creature (the abstract class both players and mobiles inherit from) pointer called pointOfView, that represents what Creature object is linked to the text display. I''d like a lot of functions, such as some attacks, to also be in Creature and work with the same code regardless of whether a Player or Creature object is using it. The problem is this: My basic punch attack could be displayed as any of the following, depending on the point of view and what is attacking what. "You punch a kobold." "A kobold punches an orc." "An orc punches you." And of course the same problem arises with a lot of other abilities. I really haven''t managed to come up with any generalized solution to this. I could do a ton of conditionals for every ability, but that seems like way too much work. I considered a script system of some sort, by maybe deriving a new stream class and having text output handled by inserting into it then sending the stream object to the point of view to be parsed. That seemed promising, but I had a lot of trouble thinking it through and wasn''t sure if it was really a good idea or not. Beyond that, I really have no idea. I''ve also read something on here about how usually your game state updating and display code are handled separately usually. Currently, my attack functions and such have done all of that together, ie the creature outputs a dodge message when it successfully dodges immediately, and I''ve tried to keep a certain pattern to when the messages are displayed so I don''t have to worry about the order. I would assume the idea of separating updating and display would apply just as much to a text game engine as a graphical one, so would it be a good idea to change my design to that pattern, or is there something else to it I''m missing? As always, any help would be greatly appreciated. Thanks, Chris.

Share this post


Link to post
Share on other sites