PDA

View Full Version : Optimising....



jasonf
20-01-2005, 12:51 AM
Who was it who said the fastest line of code is the one that doesn't get executed....

Well, (brief bit of history) I started writing the core units for my game a LONG TIME AGO.. (when Kylix 1st came out) and all in all, they're very stable.. If a little slow. They handle a lot of stuff from animation, sound and multi layered parallax scrolling and pixel level collision detection.. blah blah blah (enough history)

What was I smoking at the time? The collision detection routine was the culprit the entire time (OK more history.... earlier on on this forum I complained that my logic loop was taking 40ms to complete and I was blaming the lists) By making sure that collision detection isn't even attempted on layers which have no moving elements and that objects can be set as active or passive for collision checks and that the collision loop is only called once!! :oops: I've got my logic loop down to 11-15 ms in places.. And thats will a lot of stuff going on including some invisible AI-sensor type objects scanning to see if anything dangerous is coming... they check everything.. and each sprite has 17 of these.

That my friends in my book... is a result :D

I feel a whole lot better about the way my game is going now.. Expect to see something soon. (ish)

Sly
20-01-2005, 01:54 AM
That was me who said that. 8)

That's a good result you've got.

jasonf
20-01-2005, 10:10 AM
Cheers mate,

I don't think there will be too many more "Quick Wins" like that one. But I certainly didn't expect to find one there. But I guess it's because the collision detection code causes so many things to happen.

The other optimisaitions will be a lot smaller and I gotta add the Net code yet :D

Mr Technomage, how's my CBCNet code coming along? :D (Just kidding).