MantisBT - VCMI |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0001804 | VCMI | Random Map Generator | public | 2014-06-28 05:30 | 2014-09-21 20:26 |
|
Reporter | Warmonger | |
Assigned To | Warmonger | |
Priority | high | Severity | block | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | |
Platform | | OS | | OS Version | |
Product Version | 0.95c | |
Target Version | 0.96 | Fixed in Version | 0.97 | |
|
Summary | 0001804: Client / server desync |
Description | To sum things up:
- Picking any removable object leads to crash at recalculating paths
- Random number generator on random map was out of sync. Now it is, but it doesn't solve the problem. |
Steps To Reproduce | Launch a random map, pick any treasure -> crash.
State of hero in town is different on client and server. |
Additional Information | Game would crash just when hero left the town. I made a workaround for that. |
Tags | No tags attached. |
Relationships | |
Attached Files | Bug1804.rar (46,522) 2014-07-27 12:12 https://bugs.vcmi.eu/file_download.php?file_id=1869&type=bug |
|
Issue History |
Date Modified | Username | Field | Change |
2014-06-28 05:30 | Warmonger | New Issue | |
2014-06-28 05:30 | Warmonger | Status | new => assigned |
2014-06-28 05:30 | Warmonger | Assigned To | => beegee |
2014-06-28 14:51 | beegee | Assigned To | beegee => |
2014-06-28 14:52 | beegee | Note Added: 0004803 | |
2014-06-29 05:20 | Warmonger | Note Added: 0004809 | |
2014-06-29 05:26 | Warmonger | Summary | Random map genrator creates new server window => Client / server desync |
2014-06-29 05:26 | Warmonger | Description Updated | bug_revision_view_page.php?rev_id=2574#r2574 |
2014-06-29 05:26 | Warmonger | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=2576#r2576 |
2014-06-30 13:41 | Warmonger | Note Added: 0004811 | |
2014-07-01 09:31 | Warmonger | Note Added: 0004815 | |
2014-07-15 16:22 | Warmonger | Note Added: 0004835 | |
2014-07-19 10:40 | Warmonger | Relationship added | related to 0001838 |
2014-07-25 04:46 | Warmonger | Status | assigned => new |
2014-07-27 09:39 | Warmonger | Note Deleted: 0004835 | |
2014-07-27 09:43 | Warmonger | Note Added: 0004857 | |
2014-07-27 09:45 | Warmonger | Note Edited: 0004857 | bug_revision_view_page.php?bugnote_id=4857#r2592 |
2014-07-27 10:37 | Warmonger | Note Added: 0004858 | |
2014-07-27 12:12 | Warmonger | Note Added: 0004861 | |
2014-07-27 12:12 | Warmonger | File Added: Bug1804.rar | |
2014-07-27 12:32 | Warmonger | Note Edited: 0004861 | bug_revision_view_page.php?bugnote_id=4861#r2594 |
2014-07-27 12:34 | Warmonger | Note Edited: 0004861 | bug_revision_view_page.php?bugnote_id=4861#r2595 |
2014-07-27 12:37 | Ivan | Note Added: 0004862 | |
2014-07-27 12:48 | Warmonger | Note Edited: 0004861 | bug_revision_view_page.php?bugnote_id=4861#r2596 |
2014-07-27 13:21 | Warmonger | Note Added: 0004863 | |
2014-07-27 13:43 | Warmonger | Note Edited: 0004863 | bug_revision_view_page.php?bugnote_id=4863#r2598 |
2014-07-27 16:43 | Warmonger | Note Added: 0004867 | |
2014-07-27 16:54 | Warmonger | Note Edited: 0004867 | bug_revision_view_page.php?bugnote_id=4867#r2600 |
2014-07-27 18:28 | Warmonger | Note Added: 0004870 | |
2014-07-27 18:30 | Warmonger | Description Updated | bug_revision_view_page.php?rev_id=2601#r2601 |
2014-07-27 18:30 | Warmonger | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=2602#r2602 |
2014-07-27 18:30 | Warmonger | Additional Information Updated | bug_revision_view_page.php?rev_id=2604#r2604 |
2014-09-21 10:12 | Warmonger | Note Added: 0004964 | |
2014-09-21 10:15 | Warmonger | Assigned To | => Warmonger |
2014-09-21 10:15 | Warmonger | Status | new => assigned |
2014-09-21 19:58 | Ivan | Note Added: 0004965 | |
2014-09-21 20:26 | Warmonger | Note Added: 0004966 | |
2014-09-21 20:26 | Warmonger | Status | assigned => resolved |
2014-09-21 20:26 | Warmonger | Fixed in Version | => 0.97 |
2014-09-21 20:26 | Warmonger | Resolution | open => fixed |
2014-12-20 10:51 | Warmonger | Relationship deleted | related to 0001838 |
Notes |
|
(0004803)
|
beegee
|
2014-06-28 14:52
|
|
Why does this bug occurs now (not with earlier VCMI versions)? What do you mean with too many windows / server window?
Sorry, but can't fix that bug. |
|
|
|
Well, that could be wrong observation.
Still, I have no idea why now RMG gets desync and previously it didn't. |
|
|
|
Most certainly hero in town displays corretly on client, but is not present on server. Even though initalization looks fine.
I don't think I eventually changed anything significant from engine's point of view. Messed a bit with unique/shared pointers, but now they are as they were at the beginning. Not sure what is actual reasoning behind all of them, though and how game (map?) state is synchronized for RMG. |
|
|
|
Now this is WEIRD. Line in CGameHandler.cpp
obj->onHeroLeave(h);
Is called twice in a row, both on server. |
|
|
(0004857)
|
Warmonger
|
2014-07-27 09:43
(edited on: 2014-07-27 09:45) |
|
For current state of code debugging shows crashes happen in Main Thread. Removing adevnture map objectsmay result in two types of crashes:
- CPathfinder::EvaluateAccessibility when hovering over empty area
tinfo->objects seem invalid (null)
- CAdvMapInt::TileHovered when hovering over objects
objAtTile seems invalid (but not null)
However, removing object in thread mscrv110 looks fine both in NetPacksClient and NetPacksLib.
|
|
|
|
Okay, it's actually RMG desync:
Client
12:04:39 INFO global [223c] - Seed after init is 1960254332 (before was 1406455476)
Server
12:04:37 INFO global [2140] - Seed after init is 1124503360 (before was 1406455476) |
|
|
(0004861)
|
Warmonger
|
2014-07-27 12:12
(edited on: 2014-07-27 12:48) |
|
It looks like both client and server generators start in sync, but after a while they loose it (at bank generation?). Use diff to see details.
|
|
|
(0004862)
|
Ivan
|
2014-07-27 12:37
|
|
What? Different checksums for data files?
Client log:
[413c7ceb] Original game files
Server log:
[99a803a8] Original game files
How is that possible if both client and server are in the same directory? Should be looked into even if it turns out to be unrelated to this issue.
Bank generation - all access to random numbers happens after RMG - during CBank::initObj() which should be synchronous.
Perhaps random generator is already out of sync at this point? |
|
|
(0004863)
|
Warmonger
|
2014-07-27 13:21
(edited on: 2014-07-27 13:43) |
|
Just checked and after "initTowns" seeds match, but banks diverge soon after.
EDIT: debuggin individual objects shows that the seed indeed changes at banks.
|
|
|
(0004867)
|
Warmonger
|
2014-07-27 16:43
(edited on: 2014-07-27 16:54) |
|
It was actually caused bu unitialized CGResource::val, which caused divergence. But that's not the only case.
EDIT: Another divergence due to uninitialized CGCreature::character. This is how it goes.
|
|
|
|
To sum things up for today: rng is now in sync, but it doesn't stop game from crashing :/ |
|
|
|
I enabled prison heroes to get more than 0 exp (not yet commited).
This way they are leveled correctly at server, but at client side they are NULL, which leads to crash.
Explanation to all this is, I believe, as follows:
First map is created on Client side, then it is created on Server side.
All objects are created twice. They have different adresses are are inherently of of sync -> this is fundamental flaw in design.
However, simplest RMG before worked fine, that is objects were synced. Not sure where the difference is. |
|
|
(0004965)
|
Ivan
|
2014-09-21 19:58
|
|
Isn't this one fixed now? Or there are still desync bugs in RMG? |
|
|
|
|