DevLog #3 - Weekend in sign of troubles

posted in StarDust DevLog
Published May 23, 2011
Advertisement
The weekend is over. Code has went to Bitbucket repositories, initial encounter with TortoiseHg was relativelly successfull and optimization of sectors for generating stars brought a significant performance increase. But not everything was so bright. VisualStudio on second PC began randomly throwing error MSB4014 (can't find MSBuild.exe). Waiting several minutes for a timeout to throw this error to be able only start building again and ohping it'll pass this time was at least very frustrating. Except of this an STL vector entered a strike and was throwing "incompatible iterator" exception during runtime. Mystery is that there were 6 vectors, and only one was causing troubles, although they were all processed in a same loop.

Below is a code example that was causing problems. The loop processed sectorsM and sectorsS, but when the it came to sectors, it crashed on the != operator in the inner loop:


vector sectors;
vector sectorsS;
vector sectorsM;

vector* actSectorSet;

for (int i=0; i<3; i++) {
switch(i) {
case 0: actSectorSet = &sectorsM break;
case 1: actSectorSet = &sectorsS break;
case 2: actSectorSet = &sectors break;
}

for (vector::iterator iter = actSectorSet->begin(); iter!=actSectorSet->end(); iter++) {
...
}
}


In the end I added one more vector to be used instead of the malfunctioning one and it magically worked. Really a strange bug.

While fighting with both MSBuild.exe and STL vectors not really much has been done. But at least the sectors were optimized. If you looked on the video in previous log, you could notice that there were only sectors with same size, creating thus a regular grid. This was naturally resulting in browsing through many (several hundreds) tiny sectors, reducing the speed significantly. So sectors of 6 different scales has been brought in, reducing the total amount of sectors to be drawn at one moment to 117 in full 3D generating.

I was thinking about bringing another video or a picture, but instead of putting another technical render with grey lines around sectors and placeholding blobs for stars I'll wait till the next entry, when I want come up with planets for the already generated stars. That will be finally something more interesting to watch at.

Have a nice week and see you with the next dev log.

Petr Marek
1 likes 2 comments

Comments

kiwibonga
I think the reason your vector pointer didn't work properly is because &sectors actually gives you the address to the first element in sectors rather than a pointer to the vector itself. You should use a reference instead, or perhaps that "std::vector<T>::pointer" that I've never seen used before :P
May 25, 2011 03:34 AM
KaRei
[quote name='kiwibonga' timestamp='1306294453']
I think the reason your vector pointer didn't work properly is because &sectors actually gives you the address to the first element in sectors rather than a pointer to the vector itself. You should use a reference instead, or perhaps that "std::vector<T>::pointer" that I've never seen used before :P
[/quote]

Thanks a lot for the tip, I'll look at it and will try to use it instead. Seems to be cleaner solution for a vector :)
May 25, 2011 09:59 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement