Topic: [SOLVED] Game Collision Help
I have recently encountered an annoying problem with my custom built version of Teeworlds. I implemented a patch from Dune's Teeworlds Gamer Client that that only renders the game tile, which is sometimes very useful in races to find secret ways. Well everything went well with the patching because I used this one he provided to patch the teeworlds-0.5.2-src. I complied and no errors! I thought I had reached success until I went onto a DDRace or a modded server. I noticed that the client froze a lot so eventually I figured out that the client predicted that every other tile or entities that weren't solid, no hook, death, or weapons was a solid tile so that explained why every time that I fell on a freeze tile inside a DDRace server for two seconds my client reported me as being able to stand or hook the freeze tile until the server told my client that it wasn't supposed to do that. That was why my client froze often. Any one can help me with this? I provided with screenshots and the patch I used and the source code I am currently working with. The culprit file I believe that is the one that is causing this would be the collision.cpp file because I reversed the patch on that file and the client didn't do that anymore but didn't show me the full gamelayer.
Culprit Code:
Before Patch
for(int i = 0; i < width*height; i++)
{
int index = tiles[i].index;
if(index > 128)
continue;
if(index == TILE_DEATH)
tiles[i].index = COLFLAG_DEATH;
else if(index == TILE_SOLID)
tiles[i].index = COLFLAG_SOLID;
else if(index == TILE_NOHOOK)
tiles[i].index = COLFLAG_SOLID|COLFLAG_NOHOOK;
else
tiles[i].index = 0;
}
return 1;
}
After Patch
for(int i = 0; i < width*height; i++)
{
int index = tiles[i].index;
if(index > 128)
continue;
if(index == TILE_DEATH)
tiles[i].index = COLFLAG_DEATH;
else if(index == TILE_SOLID)
tiles[i].index = COLFLAG_SOLID;
else if(index == TILE_NOHOOK)
tiles[i].index = COLFLAG_SOLID|COLFLAG_NOHOOK;
else
tiles[i].index = index;
}
return 1;
}
Patch:
http://duneudne.free.fr/source/patches/ … ower.patch
Screenshots:
Uploaded with ImageShack.us
Uploaded with ImageShack.us
Source Code:
Download teeworlds-0.5.2-src.zip