"State machine file is too big" - what am I doing wrong?

Game development with Board Game Arena Studio
Post Reply
User avatar
salty-horse
Posts: 78
Joined: 14 June 2012, 23:08

"State machine file is too big" - what am I doing wrong?

Post by salty-horse »

When I run Victoria_La's project checker, it warns that my state machine file is too big (231 lines at the moment).
I'm not sure if I should ignore it, or if I'm misunderstanding how to use the state machine.

My game, Mottainai (rules PDF), has 8 phases in a player's turn, and one of these phases is a loop that goes through all opponents, and a subloop where you perform an action several times. And another two phases have loops where you can optionally activate card effects in any order.

And this is just the core flow, that I'm still not done implementing and will probably need 2-3 more states. There are 50+ card effects to implement, many of them unique (not variations of each other), and each one requires different prompts from the players.

Is this something that can be implement with a small number of states?

Here's my code for reference: https://github.com/salty-horse/mottainai-bga
Note that the states file has few leftovers from the Hearts tutorial, but these should be a good stand-in for the states I'm still missing for the core game flow.
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: "State machine file is too big" - what am I doing wrong?

Post by Tisaac »

The file look ok to me. I'm usually putting the define in a separated constants.inc.php file which contains other defined constants.
There is always a tradeoff between number of state and complexity of state, the two extreme being :
- only one state which handle all the game, very complex to debug
- a very large number of simple states
You have to find a good compromise but there is no general rule for that.
User avatar
Lymon Flowers
Posts: 196
Joined: 01 April 2020, 21:14

Re: "State machine file is too big" - what am I doing wrong?

Post by Lymon Flowers »

I don't think you need a state every time you have a new prompt. Stuff like this can help:
https://boardgamearena.com/forum/viewto ... 741#p65677

That would help lowering the state numbers.
User avatar
salty-horse
Posts: 78
Joined: 14 June 2012, 23:08

Re: "State machine file is too big" - what am I doing wrong?

Post by salty-horse »

bdrieu wrote: 15 October 2020, 09:10 I don't think you need a state every time you have a new prompt. Stuff like this can help:
https://boardgamearena.com/forum/viewto ... 741#p65677

That would help lowering the state numbers.
I'm not sure if this is applicable to my situation. I use state to mark different places in the game flow. If I ever have identical prompts, they will be in different places in the game.

For now, I know to ignore that warning about the line count in the states file. Thanks!
User avatar
Lunalol
Posts: 584
Joined: 09 October 2016, 23:21

Re: "State machine file is too big" - what am I doing wrong?

Post by Lunalol »

Don't worry, I have 633 lines in my state file.
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: "State machine file is too big" - what am I doing wrong?

Post by Victoria_La »

You can ignore it, but the more states you have the more complex the game and more unmanagable. 200 lines is actually not bad, I think I should change it to count numer of states not the lines though :)
Post Reply

Return to “Developers”