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 > Silent Hunter 4: Wolves of the Pacific
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 10-05-20, 09:27 PM   #1
Capt Codetrucker
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default SH4 Stopped Saving "SaveData.map" Data For Stellarium

Hello,


The title tells it all. I have no idea why, but it is impossible to use the "SHtoStellarium" script to copy my SH4 time and position to Stellarium.

The below spoiler contains some extensive information which may help.

 


Capt Codetrucker (Bullhide009)Yesterday at 8:47 PM
Well, I'm not sure what happened, but the script stopped working. I am getting this error...

Traceback (most recent call last):
File "C:\Users\cjw\Desktop\SH4toStellarium.py", line 37, in <module>
longitude = float(content[longst+4:longnd])/120000
ValueError: could not convert string to float: 'ark]\nPointsNb=0\n\n[Ruler]\nPointsNb=0\n\n[Range]\nPointsNb=0\n\n[Angle]\nPointsNb=0\n\n[Waypoint]\nPointsNb=0\n\n[KGSelector]\nPointsNb=0'

This happened when I performed a fresh install of SH3 and SH4.

Does this look familiar? Any ideas?
Capt Codetrucker (Bullhide009)Yesterday at 9:45 PM
FMI - Am I supposed to post technical requests here or on the Subsim forum?
October 5, 2020
Capt Codetrucker (Bullhide009)Today at 7:10 AM


SUCCESS! I have overcome the fails, but only by going back to the raw script in the doc. I never was able to ferret out the culprit code, but since my present customized script works I am going to enjoy it for awhile. Thanks for all the help.
Capt Codetrucker (Bullhide009)Today at 7:31 PM


FAILURE! After getting a number of successful SH4 to Stellarium exports, I am now having the same error as the 3rd post above this one. The error Traceback is the same, "ValueError: could not convert string to float:" I have determined the error comes from the fact SH4 is not producing a good "SaveData.map" file, but I have no idea why?
Any ideas?

UPDATE: Verified the failure is due to SH4 producing an erroneous SaveData.map file. There is no data in the sections of the file, so the script is attempting to read in only the structure of the file and not the data which should be there. For some reason I have been able to get SH4 to produce the needed data and then it fails. No rhyme or reason yet.





Thank you in advance for the assistance.
  Reply With Quote
Old 10-06-20, 06:48 AM   #2
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,735
Downloads: 439
Uploads: 2


Default

With some of the older SH tools, you had to have the utility in the Save folder for it to properly find and gather the needed data. I'm sure a custom script could point the app to the proper location, but is it using your script still?
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 10-06-20, 12:11 PM   #3
Pisces
Silent Hunter
 
Join Date: Dec 2004
Location: AN9771
Posts: 4,892
Downloads: 300
Uploads: 0
Default

For debugging purpose I would add statements (or let the debugger show the contents of variables) that show what "content[longst+4:longnd]" or just longst and longnd contain. Something in this expression does not allow it to become a float. I'm too unfamiliar with Python to know what that could be, just familiar enough in general with such languages that it always helps to check the intermediate conversion steps.
__________________
My site downloads: https://ricojansen.nl/downloads
Pisces is offline   Reply With Quote
Old 10-07-20, 12:42 AM   #4
Capt Codetrucker
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

@propbeanie - My laptop crashed several hours ago, so I am having to start from scratch. I was using the script and it produced as file, but since the correct numerical data was not produced the script threw errors because the data it did read was alphanumeric which the script could not digest.

@Pisces - That is a good idea. Thanks.




The problem is not the script. It works well if I feed it valid data manually. The culprit is SH4 itself. The SaveData.map files is not being populated. The framework is there, but no data, like my position is saved.



I will report back.
  Reply With Quote
Old 10-07-20, 09:17 AM   #5
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,735
Downloads: 439
Uploads: 2


Default

I have a SaveData.map in some of my "more involved" saves, and this is all it has:
[Mark]
PointsNb=0

[Ruler]
PointsNb=0

[Range]
PointsNb=0

[Angle]
PointsNb=0

[Waypoint]
PointsNb=2
Pt0=14383529.11,1699511.52,-2.97
Pt1=13184944.00,1465757.00,0.00

[KGSelector]
PointsNb=0
Near as I can tell, there is no "CurrentLocation", or whatever the game would call it. It does record the Waypoint locations, beginning the numbering at "zero". I'm not certain if that is long, lat, heading, or what for the Waypoints. Now, some of the Saves I have that do not have Waypoints or marks, etc., the SaveData.map is not present. I wonder if the py script has error catching for if the file does not exist yet? Also, since SH4 saves a lot of its data in txt files, the numerical characters would be string. Python does have a type-cast, doesn't it? Such that you can do a "string-to-float"?
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 10-07-20, 11:04 AM   #6
Pisces
Silent Hunter
 
Join Date: Dec 2004
Location: AN9771
Posts: 4,892
Downloads: 300
Uploads: 0
Default

In that case, place a waypoint and save. Pt0 should be the location of the sub at time of the save.
__________________
My site downloads: https://ricojansen.nl/downloads
Pisces is offline   Reply With Quote
Old 10-07-20, 12:17 PM   #7
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,735
Downloads: 439
Uploads: 2


Default

I would say that you are 99.999999% correct Pisces (catch the SH4 6-digit joke??). I do not understand why that failed to register with me to begin with - Most of my test Saves for FotRSU have one waypoint set, just to be certain the Load of Saves actually function correctly...
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 10-07-20, 01:39 PM   #8
Pisces
Silent Hunter
 
Join Date: Dec 2004
Location: AN9771
Posts: 4,892
Downloads: 300
Uploads: 0
Default

Sorry, unfamiliar with 6 digits in the context of SH4.

I always set a waypoint as a stopgap for the helmsman that goes out for coffee when he figures he is close enough to the commanded course, but doesn't maintain it. At high timecompressio he will wander off course.
__________________
My site downloads: https://ricojansen.nl/downloads
Pisces is offline   Reply With Quote
Old 10-07-20, 07:30 PM   #9
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,735
Downloads: 439
Uploads: 2


Default

The "joke" part is that SH4 saves almost ~everything~ with six decimal places, whether it needs that much "resolution" or not. The Save folders are named with eight digits... ah well.

The bad helming was mentioned years ago by someone as a "simulation" of how difficult it is to navigate the boat. I don't know what that has to be so inaccurate, when you can shoot a torpedo with auto-targeting from 3500 yards, and it doesn't wander a whit away from the point of aim... - Again, ah well... it is a game... - and it is still fun, over 13 years later!
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 10-07-20, 08:16 PM   #10
Capt Codetrucker
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

@propbeanie
The sub's location is in there...


[Waypoint]
PointsNb=2
Pt0=14383529.11,1699511.52,-2.97
Pt1=13184944.00,1465757.00,0.00


The script points to "Pt0" and sends it to Stellarium. What I see in my SaveData.map is...


[Waypoint]
PointsNb=1
Pt0=0


...which is not a long enough string of numbers, so the script picks up all the structure which is garbage.
  Reply With Quote
Old 10-08-20, 12:13 AM   #11
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,735
Downloads: 439
Uploads: 2


Default

If you don't have a course set, the game seemingly assumes you are flying by the seat of your pants, and does not track waypoints. I do not know why it would NOT track where you are at the time, but... apparently it doesn't.
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 10-08-20, 03:03 AM   #12
Capt Codetrucker
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Quote:
Originally Posted by propbeanie View Post
If you don't have a course set, the game seemingly assumes you are flying by the seat of your pants, and does not track waypoints. I do not know why it would NOT track where you are at the time, but... apparently it doesn't.

Are you saying you got the same...


[Waypoint]
PointsNb=1
Pt0=0


...if you saved a game without plotting a course? That is what it sounds like you mean, but I don't want to be presumptuous.


I think I will test a few scenarios.
  Reply With Quote
Old 10-08-20, 11:34 AM   #13
Pisces
Silent Hunter
 
Join Date: Dec 2004
Location: AN9771
Posts: 4,892
Downloads: 300
Uploads: 0
Default

Quote:
Originally Posted by propbeanie View Post
The "joke" part is that SH4 saves almost ~everything~ with six decimal places, whether it needs that much "resolution" or not. The Save folders are named with eight digits... ah well.
I see, yes. I don't consider that a big deal. They better keep it simple and just write down the coordinates to the significant digits the float/decimal value can represent. No need for fancy code to cull insignificant digits not really important that could be the cause of more bugs. It's fine, you weren't supposed to see it anyway as a player.

Quote:
The bad helming was mentioned years ago by someone as a "simulation" of how difficult it is to navigate the boat. I don't know what that has to be so inaccurate, when you can shoot a torpedo with auto-targeting from 3500 yards, and it doesn't wander a whit away from the point of aim... - Again, ah well... it is a game... - and it is still fun, over 13 years later!
3500 yards at practically real time is a big difference from careening your boat over 350nm in time compression.
__________________
My site downloads: https://ricojansen.nl/downloads
Pisces is offline   Reply With Quote
Old 10-09-20, 02:40 AM   #14
Capt Codetrucker
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Okay, I can't figure this out. Sometimes SH4 will produce usable "Pt0=" lat/lon and most of the time it doesn't. I have not yet figured out why sometimes and sometimes . I am going to think through different controlled procedures and methodically try them one by one.
  Reply With Quote
Old 10-10-20, 02:52 AM   #15
Capt Codetrucker
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

UPDATE:
  • SH4 does produce last saved lat/lon of the sub. I do not know why this does not work in testing, but in sailing the sub not only can one save the last position, but overwriting a previous save works without a hitch.
  • The script works flawlessly if the script is initiated via a Python icon either as a direct saved icon or as a shortcut. For whatever reason, executing the script from the PyScripter IDE is unreliable. I do not know why.
  • The only item left to narrow down is the actual plotting of the marks on on the SH4 map from the sight reductions from Stellarium. The incongruity of the longitudes is proving to be causing niggles.
We press on!
  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 06:29 AM.


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.