SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SHIII Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 01-10-11, 07:19 AM   #871
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default

Quote:
Regarding the variables: They change almost everytime you load a new game, since they are allocated dynamically.
True. But I thought they would be relative to a xxxx(0)000 boundary. Pity they are not.

[Edit:] And thanks for the code idea. I shall try to find the relevant code.

Stiebler.
Stiebler is offline   Reply With Quote
Old 01-10-11, 07:36 AM   #872
Tessa
Grey Wolf
 
Join Date: Feb 2007
Location: CG 96
Posts: 861
Downloads: 22
Uploads: 0
Default

Quote:
Originally Posted by h.sie View Post
E.g. the flooding level of the front torpedo room needs a pointer of 12th order. (pointer that points to a pointer that points to a pointer, that points to a pointer, that points to a pointer, that points to a pointer, that points to a pointer, that points to a pointer, that points to a pointer, that points to a pointer, that points to a pointer, that points to a pointer that points to the variable)

But: Instead of finding a pointer and changing the variable referenced by that pointer, I suggest to first try to find and modify the code that writes the variable. So you don't even need a pointer.

h.sie
To write code such that it requires such a massive array of pointers is either severly careless coding, or the result of a recursive function where the 12th iteration gives you the number you need. Sorry that my knowledge of machine code is limited, but might I suggest you look at what the other pointers are linked to? I agree that using such a complex function is not very efficient, it may be done out of some necessity.
Tessa is offline   Reply With Quote
Old 01-10-11, 07:41 AM   #873
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 131
Uploads: 0


Default

It's common for modern 3D games, which are programmed object oriented with many objects including other objects and so on.

Class Submarine - contains sections - containing subsections - containing machines - containing damage counter.

Compiling/Linking the example above leads to a pointer of at least 5th order.
__________________
My Mediafire page: http://www.mediafire.com/hsie
h.sie is offline   Reply With Quote
Old 01-10-11, 08:02 AM   #874
Hitman
Pacific Aces Dev Team
 
Hitman's Avatar
 
Join Date: Sep 2002
Location: Spain
Posts: 6,099
Downloads: 109
Uploads: 2


Default

@Stiebler and H.Sie

This is excellent news!

I hope that better comprehension of the tanks model for the game can help both making a better Anti-Humming-Bird mod, and a feature I think would be worth adding:

- A % random chance of crash dives getting out of control, as it happened in real life, with a risk of getting below crash depth and crushing. Ideally more probable with greener crew, but this would probably be too complicated.
__________________
One day I will return to sea ...
Hitman is offline   Reply With Quote
Old 01-10-11, 09:11 AM   #875
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 131
Uploads: 0


Default

Funny: The more progress I, or better WE, make the more wishes arise. To be honest: After fixing the crash dive blues (together with Stiebler) and after progging the external torpedo issue, I really plan to PLAY a sh3 career for the first time. I don't even know if I will like this game.
__________________
My Mediafire page: http://www.mediafire.com/hsie
h.sie is offline   Reply With Quote
Old 01-10-11, 09:51 AM   #876
Silent Ace
Seaman
 
Join Date: Feb 2010
Posts: 36
Downloads: 64
Uploads: 0
Default

See how easily and realistically performed control ballast tanks in the next little game-http://www.purely-games.com/unusual_submarine_game.html
Similar simulator at the Museum of Science and Industry in Chicago-http://www.msichicago.org/whats-here...nce-challenge/
Something like this implemented in GWX and NYGM would be a major step toward realistic management of U-boat.
__________________

Last edited by Silent Ace; 01-15-11 at 02:22 AM.
Silent Ace is offline   Reply With Quote
Old 01-10-11, 09:55 AM   #877
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 131
Uploads: 0


Default

@Stiebler: I discovered an Crash Dive Flag (Byte) which is 1 only during crash dive and 0 otherwise, this could be used to control / fix the fast-dive-tank.

Simply writing repeatedly 0,5 into the memory won't help, since the program will repeatedly overwrite it again, so we'll have some dirty oscillation, which could result in a helicopter instead of a submarine. so it will be necessary to do some re-engineering and find the right code (the phyisical model behind that all) to fix. I'll also look at it in the next days. Really interesting.
__________________
My Mediafire page: http://www.mediafire.com/hsie
h.sie is offline   Reply With Quote
Old 01-10-11, 11:46 AM   #878
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default

@H.sie:

Your previous post acknowledged with thanks.

It is necessary for me, once again, to try to discover which memory locations are associated with the quick-dive tank, as I try to discover the code associated with this tank. Ho hum.



Stiebler.
Stiebler is offline   Reply With Quote
Old 01-10-11, 11:56 AM   #879
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default

@H.sie:
Is the crash-dive flag cancelled (=0) after an interrupted crash-dive?

If so, the programming solution should be fairly simple. Check the flag, and always set the quick-tank variable to 0.5000 if the flag is cancelled.

Doubtless this 'simple' solution will not work, or will become more complicated.

Stiebler.
Stiebler is offline   Reply With Quote
Old 01-10-11, 11:58 AM   #880
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 131
Uploads: 0


Default

@Stiebler: For code finding purposes, I often look into the stack. The return adresses in the stack tell me, which routines called my routine, and so I often find the code I search for (stack trace). Also, the stack contains the arguments of the function calls, which also can help.

I'll be able to sit in front of my modding PC in 2 days. Unfortunately.
So I don't remember all details of this flags behaviour. But one can find it easily.

h.sie
__________________
My Mediafire page: http://www.mediafire.com/hsie
h.sie is offline   Reply With Quote
Old 01-10-11, 01:23 PM   #881
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 131
Uploads: 0


Default

@Hitman: On the other hand: if we manage to fix the crash dive bug, we can easily add a certain chance that the crash dive ends on the ground of the ocean.
__________________
My Mediafire page: http://www.mediafire.com/hsie
h.sie is offline   Reply With Quote
Old 01-10-11, 02:51 PM   #882
LGN1
Ace of the Deep
 
Join Date: Mar 2006
Posts: 1,138
Downloads: 147
Uploads: 12
Default

Hi all,

when we discussed the compressed air topic I realized that you consume compressed air when you order a crash dive. My assumption was that the compressed air was used for blowing the quick diving tank. When you interrupt the crash dive this does not happen. Maybe this can help you to solve the crash dive blues 'Give the order' to blow the quick diving tank?

Quote:
Originally Posted by Delareon View Post
Shouldnt it be possible to reload them all times? (at heavy seas only when dived maybe).
Quote:
Originally Posted by h.sie View Post
@Delareon: This is not a dumb question. It's a question that has to be discussed before I start programmming this. LGN1 wrote something about this topic earlier and via PM to me. Either we search the post or LGN1 is so kind to repeat what he knows regarding this question. Or any other historical information welcome, too.
As Delareon has written: the idea was to allow reloading internal torpedoes in case of a storm only submerged, i.e., if there is a storm and you want to reload internal torpedoes you have to dive.

See our old discussion on page 52 and my comment there:

http://www.subsim.com/radioroom/show...&postcount=771

Cheers, LGN1
LGN1 is offline   Reply With Quote
Old 01-11-11, 08:18 AM   #883
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default

@H.sie:
The crash-dive routine is as follows:

The quick-dive tank is filled very fast. In order to see the filling, one has to make a break in the code at Sh3Sim.act+0x8527 immediately after pressing key 'C' (for crash-dive).

The relationship of key variables is this:
hydroplane (A) = (relative 0)
hydroplane (B) = hydroplaneA + 2C
diving tank = hydroplaneB + 1C
quick-dive tank= diving tank + 0x14
I've verified these relative values over four different cold starts of SH3 now, but you have to identify one of these starting variables first.

The quick-dive tank starts at 0.5000 (not at 0.0000, as I thought previously), and rises to 1.0000.
At a depth of about 35-39 metres (it varies even with the same IXC U-boat), the quick-dive tank starts to empty slowly.

The code which empties the quick-dive (q-d) tank is a subroutine called from Sh3Sim.act+0xB002, and located at Sh3Sim.act+0xA690.

This subroutine is called *only* to empty the q-d tank, not to fill it. The subroutine is NOT called after an interrupted crash-dive at 40-45 metres. Hence, the q-d tank never gets emptied (ie, restored from 1.0000 to 0.5000). It may be partially emptied, depending on what depth was reached before the crash-dive was interrupted.

When the U-boat is floating level at a depth of 40-45 metres (interrupted crash-dive), the only calls to Sh3Sim.act+0xAEB3 are to the hydroplanes. Otherwise, Sh3Sim.act+0x8527 provides a break-point for calls to hydroplanes and to the q-d tank.

Therefore it appears that the code needed to handle an interrupted crash-dive (to restore the q-d tank to a value of 0.5) is going to have be quite brutal. We could set a flag when the q-d tank fills to 1.0000 (occurs while the U-boat is still on the surface), check flag and depth and hydroplane status, then restore the q-d tank.

I think all three of these tests are going to be needed wherever, or however, the code gets implements (although your crashdiveflag that you reported earlier could replace the 'q-d tank = 1.0000' test.)

The big problem is this:
After an interrupted crash-dive, and if the player goes to speed = slow, the hydroplanes both have a steep up angle (about 0.5 for the front planes, and nearly as much for the rear hydroplanes), yet the U-boat continues to sink. Therefore the method of checking hydroplanes only works at high underwater speeds.

We need some new way of checking for an interrupted crash-dive, and I think this requires knowledge of depth plus something else. A crash-dive to 80m can be interrupted if the player clicks on the depthgauge for 40m, 80m or 120m, so it is necessary to check only that the depth is below the surface (>10m). But what is the 'something else'?

I suggest the simple test:
IF depth > 40m AND q-d tank value = 1.000
THEN q-d tank = 0.5000

That should resolve all problems, is easy to code, and we know that the q-d tank will be emptied to 0.5000 below 40m anyway! The only potential problem is that the U-boat will now sink less quickly to the crash-dive depth - but it will be safely below the surface. (Implement in code at or near Sh3Sim.act+0x8529.)

In fact, possibly (?) we can even remove the test for the q-d tank - implement the code whenever the depth falls below 40m however the player chooses to dive.

Stiebler.
Stiebler is offline   Reply With Quote
Old 01-11-11, 08:50 AM   #884
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 131
Uploads: 0


Default

@Stiebler: I'll look into it this evening. Higher priority than external torpedoes.

My ideas are similar, but we may not forget the blow ballast. If we permanently force q-d-tank=0.500 when depth > 40m, then a blow ballast would not work as intended (provided blow ballast affects q-d-tank, but I think so).

h.sie
__________________
My Mediafire page: http://www.mediafire.com/hsie
h.sie is offline   Reply With Quote
Old 01-11-11, 01:44 PM   #885
LGN1
Ace of the Deep
 
Join Date: Mar 2006
Posts: 1,138
Downloads: 147
Uploads: 12
Default

Quote:
Originally Posted by Stiebler View Post

I suggest the simple test:
IF depth > 40m AND q-d tank value = 1.000
THEN q-d tank = 0.5000

That should resolve all problems, is easy to code, and we know that the q-d tank will be emptied to 0.5000 below 40m anyway! The only potential problem is that the U-boat will now sink less quickly to the crash-dive depth - but it will be safely below the surface. (Implement in code at or near Sh3Sim.act+0x8529.)

In fact, possibly (?) we can even remove the test for the q-d tank - implement the code whenever the depth falls below 40m however the player chooses to dive.

Stiebler.
Hi Stiebler,

nice work The first version, however, might be problematic for people that have a less deep crash-dive depth in their cfg files so that their q-d tank value is already smaller than 1 at 40m I think one should keep it in mind that different people/mods have different crash-dive depths.

Cheers, LGN1
LGN1 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.