• entries
    13
  • comments
    13
  • views
    14144

DevLog #3 - Weekend in sign of troubles

Sign in to follow this  
KaRei

429 views

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 = §orsM; break;
case 1: actSectorSet = §orsS; break;
case 2: actSectorSet = §ors; 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
Sign in to follow this  


2 Comments


Recommended Comments

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

Share this comment


Link to comment
[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 :)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now