View Single Post
Old 04-23-13, 12:41 PM   #1689
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Hello from Portland Got diverted to the main Intel site in Portland for some work for the next two weeks. On the plane flight I managed to generate some code that prevents destroyed ships/subs from sinking through the ocean bottom. The sinking through ocean bottom is actually two problems: the SH5 code does two things with destroyed ships/subs:
- the actual problem of the unit falling through the ocean bottom is because of a timing issue in the code. One part of the code is updating the unit's depth with a new - offset every frame update while another part of the code checks to see if it's under ocean bottom every 5-6 frame updates (which then adds a small offset to try and raise it above the ocean bottom when it finds it below - problem is this small offset addition isn't large enough to counter all the - offsets from the previous frame updates). Once the destroyed sub/ship reached 500m in depth the game would finally remove it. I have code to fix the falling through ocean bottom problem now.
- the other problem with destroyed ships/subs is that there is a deletion timer set to 30.0 seconds. After the destroyed sub/ship hits the sea floor then a deletion timer is started. Once 30.0 seconds is up the destroyed sub/ship is removed from the game. I have code to override this now. The new code reads a memory value that:
- if set to a value less than 0 will cause the unit to never be deleted
- if set to a value >= 0 will cause the unit to be deleted after the deletion timer = value.

There are a couple of small problems I'm still working out on the new code. One is the unit will slightly bob up and down on the sea floor with the new code. I have to modify the new code so that when the unit contacts the sea floor it 'sinks' in just a little and thus doesn't bob up and down. The other small problem is the effects are continually played (destroyed noise and bubble effects) if the unit is set to never delete. I'm still looking for a couple of controllers so that I can disable them when the unit hits the ocean bottom.

Now the great thing about the new code is the game still treats the unit as an active unit in the game - meaning you can still collide into it and it will cause damage, it can be picked up as a contact by destroyes and escorts thus providing a false contact (them thinking it's a sub).

I'm still looking for the code that deletes airplanes immediately when their HPs are <= 0
TheDarkWraith is offline   Reply With Quote