It is currently 05 Jun 2024, 23:32
   
Text Size

Game State?

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Game State?

Postby spr » 19 Aug 2013, 05:53

In the Dev menu there is an option - Setup Game State - in which you are asked to select a game state file. This sounds like it could be very useful but how does one go about generating such a file in the first place? I am not aware of any Save Game State functionality.

Thinking out loud, how useful would it be if you could somehow serialize the game state and include it in the error report? And if you could save the game state, how difficult would it then be to include undo and even replay functionality.

Cheers,
Steve
User avatar
spr
 
Posts: 213
Joined: 06 Jul 2013, 19:31
Has thanked: 28 times
Been thanked: 60 times

Re: Game State?

Postby moomarc » 19 Aug 2013, 07:28

The devmode game state files refer to hand created txt files for scenario setups. It is not a full game state. The info on the files can be found in this thread (the possible params are in the first post).

Edit: There's also a section in the wiki here (I think Sol originally compiled it there)
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: Game State?

Postby Max mtg » 19 Aug 2013, 07:42

It should not be a significant problem to have the game serialize the current board state to a chunk of text in that very "game-state" format. Might come handy to reproduce bugs and run some test scenarios.
Keep in mind though, that this format assumes stack is empty and never stores any 'remembered' information (like chosen colors or imprinted/exiled cards)

A commonly used approach to implement undo & redo functionality is the Command pattern. Thus, to estimate what it would take, try to design a set of commands firstly.
The commands themselves would be a fine improvement for Forge. But I fear to think of the what it would take to code them being done and un-done.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Game State?

Postby moomarc » 19 Aug 2013, 08:03

AFAIK, those game state files also don't work for multiplayer formats as they only assume one opponent.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 62 guests


Who is online

In total there are 62 users online :: 0 registered, 0 hidden and 62 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 62 guests

Login Form