Bug #50
Bug #402: fix and improve ground and friction in 0.37-r1
improved terrain collision limit
| Status: | Closed | Start date: | 12/17/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | RoR - Physics | |||
| Target version: | 0.37-r1 | |||
| Operating System: | All | Operating System Bits: | ||
| Votes: | 7 |
Description
This patch tries to remove the existing limitation in collision cells by replacing the hardcoded array
cell_t cells[MAX_CELLS];
with such an dynamic array.
std::vector<cell_t> cells;
For this to work properly, you need a resize method that will initialize the values properly.
EDIT: it crashes when using more than the initial size of collision cells (1000) upon resizing and using.
The attached patch seems to be logically correct as far as i see it, but still crashes for yet unknown reasons.
help appreciated!
History
Updated by tdev over 1 year ago
- Target version set to 0.37
- Operating System set to All
- 2 set to 0.37.x
Updated by Aperion over 1 year ago
Is this issue even valid any more as estama redid the collision code? or was that just for the vehicle to vehicle collisions?
Updated by donoteat over 1 year ago
Very much still valid, see thread in invited.
http://forum.rigsofrods.com/index.php?topic=35145.0
Updated by Aperion over 1 year ago
- Assignee changed from tdev to Aperion
This crash in this patch is most likely due to not updating the hashmap with the correct pointer value. After the vector is resized it's location is moved. So all the pointer values stored in the Hashmap are no longer valid. I should be able to come up with a fix for this.
Updated by Aperion over 1 year ago
- Status changed from New to Researching
- % Done changed from 0 to 20
Updated by Aperion over 1 year ago
- File ape-collision-limits.patch added
- % Done changed from 20 to 70
Good news I found the problem with the provided patch, and found a way to fix it. Problem was the hashtable contains pointers to the cell array, when the vector resizes the array moves to a new location in memory, but the hashtable pointer values are never updated.
I've got this hacked together but at least it works, will cleanup and get some testing done.
attaching patch in case I die in my sleep or something horrid and I am not able to finish.
Updated by Aperion over 1 year ago
Been looking at this a lot lately, I have good reason to believe there are some array bounds issues going on and the data in the cell array is being over written. some maps work but others like wild west crash because of invalid memory access. I may try to use a third party hash_map implementation instead of the home brew one, I've read references to one by google that was good.
http://code.google.com/p/google-sparsehash/
still researching though :(
Updated by tdev over 1 year ago
- Target version deleted (
0.37)
Updated by tdev over 1 year ago
- Target version set to 0.37-r1
Updated by tdev over 1 year ago
- Parent task set to #402
Updated by Aperion about 1 year ago
woot woot looks like this is fixed with r1558
Updated by Aperion about 1 year ago
- Status changed from Researching to Closed
- % Done changed from 70 to 100
closed with r1558