Synopsis
So far i tried to make games and most of the times i finished on having 'engines' ready. Not the games at all. I figured out that after having rendering, music, i/o handling, all that stuff ready i pretty found myself already burned out and having no idea what the game was about i wanted to write.
And in my at least 10 years of hobby gamedev i completed 10 engines but not a single game.
I got to know OpenGL, GLES, LibSDL and even low level frame buffer rendering - however that knowledge is nothing if you can't get your game out.
I wrote my own GL based UI systems, even coded my own scripting language, coded multiplayer tcp/udp client-server game system, coded level editors, model viewers, mesh exporters, ray tracers and tons of shaders. Meantime i worked on other things too - not related to gamedev (like Distributed Computing Libraries, Algotrading stuff, lot of IOT, exploits, machine learning algorithms..) and i finished them all, but still i come back to try to write a game and i fail.
Why?
After so many years i try to answer this question and i think the reason of me not being able to finish a simple game is because i always somehow focused on the engines, core but not the actual game itself.
It's like knowing all about how the game should be running so that you actually see it on your screen with top performance but when you ask me how does these two characters will fight - i would answer - you need to figure it out.
Today
This time is no different. I told myself i will write a game - 'simple' text RPG, no graphics at all - plain text, should be easy - no need to focus on anything but text - easy huh?
No
I just finished to build the scratch of the backend of the game, have the Rooms implemented, Entities, Parsing the input, Json loader, saveing, loading, inventory, commands interpreter and what? Well im stuck.
Problem
Imagine i have the following structure:
CEntity (base class for all entities)
CEntityItem
CEntityDoor
CEntityRoom
CEntityCreature
CEntityCreatureCow
CEntityCreaturePlayer
CEntityCreatureHorse
CCommand (base class for all commands)
CCommandLook
CCommandWalk
CCommandXXXX
The game 'engine' does nothing special, basically it goes endless loop asks for user input, passes the input into command and prints out the return
pseudocode
while(1) {
// Returns a vector of strings, users input split by ' ' space
std::vector<std::string> vCommand = GetInput();
// Go through the available commands and see which fits
for(;;;)
{
if(m_vCommands[a]->GetCall == vCommand[0])
printf("%s\n", m_vCommands[a]->Handle(vCommand);
}
}
And when a player types in (example)
Command: look
What i do is just go through the available commands, check which does it fit and pass it as
std::string strOutput = pCommand->Handle(std::vector<std::string>& rvstrCommandArguments);
A proper command object gets called out and performs action - in this example Look, returning a string that is then printed on players screen like:
Output: You look around and find nothing
Other examples of commands i am thinking on top of my head will look like:
fight <name>
craft <empty> - for a list of available options
craft <axe>
hide <where>
Just want to keep it simple to finish it this time.
But here comes the question,
Is it fair to keep the output of the command that should be displayed to the user within the command class itself (just as i do) ?
For now it's simple, but later i will add some text formatting (colors and stuff).
With my OOO approach 'everywhere' sometimes i feel i am overcomplicating things and trying to search for better solutions to problems that do not exist.