lördag 19 februari 2011

Damn you SpriteBatch!


I have spent several days trying to find the cause of a very annoying bug in the engine...
After days of stairing at my screen, houers of debuging and checking evry f**king variable, evry god damn Vertex renderd... you name it, i cheecked it...

The visual effect it had was totally crazy, it painted my god damn world dark blue(exactly like a blue block in a shadow) in the segments (chunk) i was blowing holes in, it also happened if i reloaded the terrain, but it never happen when the same method generated the terrain in the first place...odd indeed.

So of course, i would assume it had something to do with data generation... even tho i could not understand why it didn't paint things blue when the terrain was FIRST generated "memory leaks? in C# ... it cant be.... can it?"

Imagine my confusion when it was still shadow blue with shadows turned off.... no blocks was ever generated in that shade of blue in the first place... *snort*

After several days I started to get real desperate, and for a brief moment i considered ripping out SunBurn just to make sure it was not a bug in the rendering engine.

Luckely... I didn't tear out SunBurn!
I manage to find the bug just moments before that.... and the reason for it? ... xna SpriteBatch class used for 2D rendering. *mutter*

Turns out it didn't like that i rendered 2D(fps and debug text) after i rendered 3D... *sigh*

This is no big news, i knew from past experience that SpirteBatch can cause some problems in combination with 3D... I think it has to do with settings for Z-buffer getting screwed(or something), I'm not sure... ether way... it was pure luck that i un-commented that line, what if i never did that? what if it would have jeopardized the whole god damn project?

Took me 3 days to figure it out... bah...
what a waste of time!

So many features i could have implemented if i didn't get stuck on this, oh well, i guess the main thing is that I'm back on track again. :)

And while I'm here, I might as well post a fun(not to serious) screen-shot i took while i was debugging things.
I swapped the original Liero texture for a more color-full "candy" texture.
Don't worry, it wont look like that, but it sure do seem liven up the place ;-)

PS: is it only me, or whats up with the giant green "Death star" thingy?

2 kommentarer:

  1. That picture make me want to go buy a packet of skittles for some reason.

    Nice progress tho mate, keep it up!

  2. Maybe you could have an option I'n the game to choose you texture ( theam) an that could be candy land?