Happy go lucky bugs

Miscellaneous Forums/General Discussion/Happy go lucky bugs

Can somebody enlighten me a little. I'm no coder by any stretch of the term but I'm just about getting by in Blitz and really neck deep in my own spaghetti code which I wrote almost 16 months ago...now i've got a bit more time I'm back on my own game again. Apart from the fun yet slow process of wondering what the hell I was doing once again, or where the heck I tucked that particular function, I'm really naffing puzzled to the point of insanity regarding obvious flaws in my code that go by unnoticed on one machine yet won't work on another machine when the logic of it is that it should NOT work on either machine? How does this happen? I'm not talking about wrestling with memory addresses, peeking and poking until it all comes tumbling down, just simple things that are easy to spot once the problem is noticed.

For example I had in my projectiles bb a bullet making function and then a bullet management function that checked for collisons and deleted the relevant entities - this also fed an impacts function for my little impact cloud animations.

This impacts function should never have worked as it was mistakenly only called while the bullet collided after which the bullet was immediately deleted and the impacts function only received one single call that particular program loop. Yet on my laptop the whole caboodle peformed and animated flawlessly when it is impossible!

When I copied all my Blitz work directories across to my main machine the code failed as it should, and impacts just showed the first frame and hung staticly in the game world where they were created neither animated or deleted!

Traced the bug quickly - but it baffles me how it ever worked and animated and deleted the impact sprites in the first place - it simply didn't have time and the function was not being called each program loop...any clues anybody? What goes on inside Blitz that I'm unaware of?

Probably this has something to do with the directX version on those machines. I guess DirectX is frequently doing garbage collections and this may differ on various DX versions. So if you free an entity, physicly it's still there and the handle may even still function, at least until the next garbage colletion will "officially" free or overwrite this memory area.

That's why you should set a handle to zero after freeing its entity, eg:

FreeEntity mesh
mesh=0

This way you will always be able to see if an entity exists.

Also... speed is an issue. A faster machine would run through the animation process a lot faster than most laptops. What kind of animation management are you doing?

Hmmm - thanks for the insight. The bullets are types which get deleted and then the old handles are set to zero by default just incase as I remember reading about this suggestion on these forums, as are the impacts.

The difference could be in the speed of the machines I suppose though - my laptop works at around 250-300 fps (intel 3 gig with 9800 card) while my main machine is slower at around 120-200 (amd 2.2 gig with geforce 6600 card).

Animation for the impacts are made with a create,show hide and then delete system using children of an animmesh.