Huge patch from viktor muraviev - Page 2

Huge patch from viktor muraviev

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
SwiftSpear
Classic Community Lead
Posts: 7287
Joined: 12 Aug 2005, 09:29

Post by SwiftSpear »

Save/load... does this mean that if I'm hosting and people start desyncing, I can save the game, restart, and start playing again with all the players from the saved game without desyncs? It's a bit of a hackjob way of fixing, but it's FAR preferable to the current, "lol, game fucked, try again!"
MelTraX
Posts: 470
Joined: 02 Jan 2007, 16:18

Post by MelTraX »

If I understood it correctly, that won't be necessary.. The game would just have to call the resyncing part of the load stuff automatically..

But then again I know nothing about all that stuff ;)..
User avatar
clericvash
Posts: 1394
Joined: 05 Oct 2004, 01:05

Post by clericvash »

The idea of resync is not to exit the game i think.
The way it should work imo is save the gamestate, then do sync all over again and just carry on, which is exactly as the name suggests resync, so it should be an auto thing.

Once again a big thank you to the guy!
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

The Spring non-ExternalAI part of the patch looks pretty much OK, apart from some minor points:
  • It does not compile with any of the configurations in VS8 (some libs are missing from his project file and some files weren't properly marked as not using PCHs). Did it compile without changes for you JC?
  • It probably does not compile on Linux either (#include "smath.h" instead of #include "SMath.h"), but this should be minor stuff to fix.
  • Some stuff that has intentionally not been changed by us, like adding a hyphen "-" between unit name and unit description (because various mods already include a separator in the description).
  • Many stuff that's supposed to be removed/changed just has the old code commented out.
I will try to see if I can get to commit it in logically separated chunks tonight.
Last edited by Tobi on 20 Jun 2007, 12:36, edited 1 time in total.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

There might be different methods but a long time back on the mailing list it was agreed that the best way for spring would be to save the game on all pc's, then use a tool called rsync to make sure everyone has the same savegame, and load the game again.

EDIT: It compiled ok with the release mode in vs8, but otherwise i haven't tested. I also had a discussion with trepan about std::set<Pointer> causing desyncs. That might have been why he changed a lot of stuff to std::list, but this does not scale well with the number of units. IMO someone should create a hash_unit_set or something, to sort unit pointers by unit ID.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

jcnossen, can you get debug builds of AIs to load with normal builds of spring when both are compiled with VS2005?
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

It should work, debug/release mode don't change the structure padding or the way interfaces work. IIRC I used to do that with JCAI but that was vs2003, since then I haven't tested.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

jcnossen wrote:EDIT: It compiled ok with the release mode in vs8, but otherwise i haven't tested. I also had a discussion with trepan about std::set<Pointer> causing desyncs. That might have been why he changed a lot of stuff to std::list, but this does not scale well with the number of units. IMO someone should create a hash_unit_set or something, to sort unit pointers by unit ID.
Could just use std::map<int, CUnit*> (where the int is the unit ID) I guess. But encapsulating it in a unit_set would be cleaner definitely.

EDIT: as for the resync, I don't remember what exactly was discussed on the mailing list, but at this moment I'd prefer a resync solution that is closer to the actual game data, so it can actually give useful debugging output to fix the sync error. (ie. checks to see whether the loaded unit is any different from the to be deserialized unit)
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

EDIT: as for the resync, I don't remember what exactly was discussed on the mailing list, but at this moment I'd prefer a resync solution that is closer to the actual game data, so it can actually give useful debugging output to fix the sync error. (ie. checks to see whether the loaded unit is any different from the to be deserialized unit)
Wouldn't that require yet another way of serializing all game data? I think you might get what you want by loading the old and new savegame to seperate structures for comparison.. Should be possible with a bit of work on the save/load code (it would only require some new code in LoadSaveHandler I think, nothing else).
heze
Posts: 38
Joined: 28 Apr 2005, 23:32

Post by heze »

Wow, what a fella. Maybe (s)he's trying to avoid all the request flood by staying anonymous. So (s)he can work on whatever feels good to work on.

Anyway just amazing if credit is left unclaimed. Big thanks whoever ya are. :)
iddq?
Posts: 3
Joined: 20 Jun 2007, 14:37

Post by iddq? »

Would the "Added max time diff" cause clocks to go out of sync in a multiplayer game if one player was lagging and the others weren't?
User avatar
hunterw
Posts: 1838
Joined: 14 May 2006, 12:22

Post by hunterw »

resync soon?????////





:shock: :shock: :shock: :shock: :shock: :shock: 8)
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

iddq? wrote:Would the "Added max time diff" cause clocks to go out of sync in a multiplayer game if one player was lagging and the others weren't?
No

At worst you disconnect earlier if your PC really can't handle it, but I'm not sufficiently into the intrinsics of the code to change game speed based on CPU load.
User avatar
Boirunner
Kernel Panic Co-Developer
Posts: 811
Joined: 05 Feb 2007, 14:24

Post by Boirunner »

I like Viktor Muraviev.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Committed everything below rts/ apart from rts/build/vstudio8 as I need to test that better on Windows (and I'm on Linux now).

Fixed some things here and there and left some to do's open, see commit message:
http://spring.clan-sy.com/fisheye/chang ... g/?cs=3826
User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Post by Zpock »

jcnossen wrote:The only weird thing so far is that he changed lots of std::set uses to std::list, which will slow down the game a lot when there are a lot of units. Otherwise its all good code.
You didn't leave this in right???
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Dont overreact if you read 'slow' please ;-) . It is left in and it will (most probably) be refactored later.

Committed AAI changes too, submarine should review those TBH.

Only GroupAI, KAI-0.22 and project files to go.
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

having a short look a the dif file it seems he only changed some old school array to stl vectors... i began doing that myself a few weeks ago
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

is it just me, or do Draw world and Draw interface steps take a lot of CPU now?
User avatar
Relative
Posts: 1371
Joined: 15 Oct 2006, 13:17

Post by Relative »

Cuppy needs to buy the http://www.viktor-muraviev-is-a-god.com domain now!!
Post Reply

Return to “Engine”