It is currently 25 Apr 2024, 07:22
   
Text Size

Game+AI module extracted

Post MTG Forge Related Programming Questions Here

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

Game+AI module extracted

Postby Max mtg » 20 Jan 2014, 19:02

Today I managed to eliminate the last visible call from game to gui and attempt module separation. I was doing it in a rush, being afraid of concurrent changes, that's why some points were made quite roughly. Despite there were no ui calls, there remained:
1. references to FThreads that checked that the current thread was not the swing ui one and helped to obtain stack traces for debug purposes - these were removed, for the game module does not know about swing.
2. References user settings accessed via singleton and preferences, I had to set up an interface in game module to read those, while the gui app instantiates a derived class and assigns it to a global variable in game module, so that game is still able to read those. But this is temporary solution, and this communication has to be removed.
3. References to ImageCache. Solved in the same way as the point above. Thie ingame cards on server's side probably should not have image keys, or should they?
4. CardUtilhad a method that checked if a card could be shown to gui player - just moved that method back to gui.

Since I was in a hurry, I made some mistakes, that is lost changes history for files addedd to game module. Maybe I should rollback the changes and then commit them again but this time paying attention to svn, to make it consider such operation a move and keep changes history. - commiyted again, but this time with history preserved
5. There's also an incorrect dependence between modules (game depends on ai) - I will fix that soon. - now ai refers to game (as it should be)
In general, the separation was a success, report any other problems here.

Next steps:
1. Figure out what to do with dependencies to preferences and imagecache.
2. Make code PlayerType-agnostic (remove the remaning 6 isHuman calls)
3. Game and AI code are now coupled inside game module - separate them.
4. Some code that is adding spells onto stack in a manner specific for human has been left in gui - that has to be extracted and moved to game module.
5. Detach forge.net from GUI.
Last edited by Max mtg on 24 Jan 2014, 08:26, edited 2 times in total.
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+AI module extracted

Postby drdev » 20 Jan 2014, 19:12

In that case, I think it's time I start working on the mobile app. Thanks for all your hard work on this.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: Game+AI module extracted

Postby Max mtg » 21 Jan 2014, 06:35

Update: I reverted the previous move and performed it once again. Now the history is kept for all files.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times


Return to Developer's Corner

Who is online

Users browsing this forum: KeithOvart and 69 guests


Who is online

In total there are 70 users online :: 1 registered, 0 hidden and 69 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: KeithOvart and 69 guests

Login Form