taby said:
I also found this (kinda cool) tutorial:
Wow. I have learned how to replace this:
struct Light
{
int state = 0;
void Toggle () {state = (state+1)&3;}
};
With 5 classes, singletons, pointers, something like 10 files, designs and concepts.
But still no reason to use, or giving an example requiring a state machine.
That's the kind of coolness you get from wearing Nike shoes, but not the coolness you get from running 100m in 7s. ;D
taby said:
That said, what do you think a tactics rip-off would need, in terms of states?
Idk, but it's surely something you'd like to be ‘tweakable content’, not actual ‘program code’. So something data driven.
Big engines use node graphs and scripting languages for that. But that's too much work for just one little game, i guess.
But you can still do it in some minimized fashion.
I use something like a ‘Command List’. I can add commands to represent various processing tasks and their order, e.g. ‘Simulate’, ‘Upscale’, ‘Surface to simulator’, ‘Simulate erosion’…
It can also do loops which i use to do my tiled processing stuff.
It could also implement branches and jumps to implement some logic and state machines.
So basically, a very simple scripting language running some byte code, which could be written in text files.
Maybe that's a reasonable alternative to having tons of C++ classes for every little thing.
I just don't know how ‘minimized’ and low effort this can be vs. using a ‘real’ scripting language (lua, Angle Code, etc.), which might be the better option.