• Advertisement
Sign in to follow this  

Strange Lock Up Problem

This topic is 2155 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, so here's the problem:

The game that I currently have in the making is using a voxel engine that I coded. But here's the problem.. When expanding the map, which by the way each chunk is stored in a list which obviously expands when it needs to. Anywho When expanding the map as soon as there are 255 chunks in the array, the game locks up. No errors, nothing. All that happens is it locks up. When I pause the program and step though, I find that the game is still apparently continuing to run and the chunks did finish generating but yet the game is still locked up. It makes no sense and it happens at 255 chunks every single time.

Now I know you're thinking "Hey, it's probably the list overloading" But I don't think it is because the list expands itself when it needs too and also it's not shooting me an error.

Share this post


Link to post
Share on other sites
Advertisement
You might have already checked for this, but maybe you are using unsigned char somewhere in your code to loop over all the chunks accidentally? Something like this:

int countOfChunks=256;
for(unsigned char x=0; x<countOfChunks; x++) {
// Do something
}


Then values of x would go like this: 0, 1, ..., 255, 0, 1, ..., 255, ... and never reach 256. I've managed to do something like this more than once even when I technically knew what it was doing :D

Share this post


Link to post
Share on other sites

You might have already checked for this, but maybe you are using unsigned char somewhere in your code to loop over all the chunks accidentally? Something like this:

int countOfChunks=256;
for(unsigned char x=0; x<countOfChunks; x++) {
// Do something
}


Then values of x would go like this: 0, 1, ..., 255, 0, 1, ..., 255, ... and never reach 256. I've managed to do something like this more than once even when I technically knew what it was doing biggrin.png


Unfortunately I am not using any unsigned characters! =[ Thanks for the input though

Share this post


Link to post
Share on other sites
I'd be surprised if this were the case but have you tried checking your memory usage? If each chunk is quite large then it might just be at 256 it is too big to handle.

Share this post


Link to post
Share on other sites

I'd be surprised if this were the case but have you tried checking your memory usage? If each chunk is quite large then it might just be at 256 it is too big to handle.

Hey Darg, yeah that's what I was thinking, although you'd think it would still throw you an error. I found that by getting rid of the first item in the chunk list when adding the 255th chunk just to keep it under 256 it seems to continue just fine, so it's not the actual creation of the chunks, just some sort of weird storage issue

Share this post


Link to post
Share on other sites
Since it's a reproducable bug and appears to be still running, it's some form of infinite loop.

I would step through a few entire loops of the main game loop, making sure execution is reaching all of the critical parts of code:

When you encounter the bug, suspend the process and use the 'step out' command until you reach the outermost part of the game loop. If you can't reach it, you can at least find the place in the callstack where it's not returning - the infinite loop will be narrowed down to code being called by that.

Share this post


Link to post
Share on other sites
set your break points after each loop this way you don't need to step through very long loops with the f10 key
if a brake point not does not break you found the loop????

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement