I recently tried to used MVC for a text based game. However, it
appeared to me, that it became much complex to handle it when it grows
bigger. The biggest problem i had been facing was the number of
validations it requires on each step. That generates convoluted code
algorithms, badly nested if-else conditions and ultimately lot of bugs
in the logic.
I want some suggestion, on this, if there is some available framework
that can help coding text based games in a better organized way?
Was looking into using Entity but unsure whether that would work well
for a game of this kind that could be ported to any platform. Any
replies will be greatly appreciated.
Please log in or register to post a reply.
You’re thinking classic game flow programming, which is why you’re
getting code bloat. Developing the core of a text based game is
technically simple and highly maintainable if you architect it properly.
It requires you spend time establishing that framework first, before you
start writing the game itself. Using object oriented designed code with
features like dictionaries (key-value mapping), graph theory, events and
delegates (aka signals and slots), databases, finite state machines, and
MVC (model-view-controller) patterns, you can write a robust framework
that will make building your game and content much easier. I’m not aware
of any text based game frameworks that offer anything similar to this,
but you may be able to search for MUD (multi-user dungeon) based
frameworks. Personally, I think it would be a good exercise for you to
try and do this yourself. Unlike a graphical engine, text based engines
can be small, simple, and will provide you with some valuable experience
when you complete it.
Yes, there are some frameworks/engines like Inform, but I agree with
TheNut, it’s a matter of organizing how puzzles are developed and
executed. Your first try will be messy, but write a small game, and
you’ll be surprised at how it all comes together after some experience
and you are able to organize it in an object oriented way. Text, really,
is the ideal way to get a handle on programming because the output is so
simple. Of course, writing a good game is probably even harder for the
same reason. The best game writers will be using Inform or something
because they are masters at crafting words more than programmers.