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 > SH4 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 08-07-07, 08:45 PM   #61
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

As promised, and prior to the upcoming release, I wrote up a brief explanation of the mechanism I coded into S3D for property data type detection. This is actually the primary reason why the application will still be alpha. I need help from the community to make the parser foolproof. As my modding skills are absolute zero, I can't guarantee detection is accurate, and this is where you (should) step in. Read up on this if you are interested.

Warning: skip if you don't have some technical background...

PS: this doc is focused on the next release, some things I discuss are not in the current public alpha...!!!


A word on automatic property data type detection
Auto detection of property data types is not foolproof. Remember this. There are even scenarios possible when (especially regarding string types, more on this later), where a property may be detected as one type today, and as another the next (because you changed it's value). This is why I recommend 'predefining' as much properties as possible (the ones you change!!!). I have not done this yet, because I'm not 100% sure about certain data types, because there's so many of them, and because I'm lazy You can help out by providing feedback on each value that gives problems, so I can predefine more data types over time.

So how does it work:
  • First, S3D checks the xml config file with predefined data types. If a property is predefined, it is used, and autodetection is skipped. You'll see this in the editor by the label 'predefined'.
  • Next, S3D checks if the property is possibly a string. My criteria (although it is not perfect, but it's the best I can do for now, without affecting performance) is:
    • Every byte (except the last) must be greater than or equal to 32. If only one byte is less than 32 (non-printable control characters) then it is not considered a string. Silent Hunter uses the Windows-1252 encoding: http://en.wikipedia.org/wiki/Windows-1252
    • The last byte must be 0 (the null terminating character).
  • Next, S3D checks the data size of the property:
    • 1 byte = 'byte' type. This can also be a 'bool' type (true or false, 0 or 1) but in that case you have to predefine it.
    • 2 bytes = 'ushort' type. This can also be a 'short' but in that case you have to predefine it.
    • 4 bytes = 'float' type. This can also be an 'int' or 'uint' but in that case you have to predefine it.
    • 8 bytes = 'ulong' type (often they are id's). This can also be a 'long', 'double', or 'vector2' but in that case you have to predefine it.
    • 12 bytes = vector3.
  • If all else fails, S3D assumes the property is a collection. It could however also be an 'array', a 'stringCollection', or another available type. Sometimes, one of the above autodetection rules can even be incorrect (for example, 12 bytes could also be a stringCollection!!!). We can never know for sure using this technique. This is when a data type must explicitly be defined in the xml config file, to either overrule wrong detection or overrule the final default 'collection' type.
So why do strings in particular pose a problem? Well, say you have a string of arbitrary length. Say, you decide to clear the value to no string (empty). In the file structure, an empty string is written back as a single byte, the null terminating char, or '0'. Once the file is read again, and if the property is not predefined as a string, my auto detection rules will fail to identify it as a string again, it will in fact see it as a byte value this time (see the rules above again). There are more similar scenario's possible and should be avoided at all cost.

The biggest benefit of this mechanism is that S3D is able to open most files without problems, for reading even though not 100% accurate. I recommend that you never modify autodetected property values though, just because of the problems described above. Before modifying, analyse each property you want to change for it's datatype. Is it correct? What should it be if not? Next, ask me or try yourself to add definitions for them. Try to stay away from global definitions as much as possible, unless absolutely sure (they may cause other files to read incorrectly!). Once they work, change the values as per your wish, and feedback the definitions back to the community, and also me so I can include them in next updates. You are then helping out to improve S3D's property parser and editor. Over the months to come, the parser should rely less and less on autodetection, and only use definitions, resulting in less parse mistakes in the long run...

PS: a how-to on property data type definitions is described in the xml config file 'propertydefinitions.xml' in the installation folder.


Hope this clears up a few things. I guess it will raise questions too though, so ask away if you have any...

Bed time now.
skwasjer is offline   Reply With Quote
Old 08-07-07, 09:22 PM   #62
Go4It
Engineer
 
Join Date: Apr 2007
Location: South of Buffalo N.Y. USA
Posts: 209
Downloads: 0
Uploads: 0
Default

Here's another DL for MS Net 2.0 @ 22 mb stand alone, not a distribution pack but with the file one needs:

http://www.microsoft.com/downloads/d...displaylang=en
Go4It is offline   Reply With Quote
Old 08-09-07, 07:57 PM   #63
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

New version available...

New key features:
  • properties are editable.
  • all SH3/SH4 files tested using test scripts. No more parse errors on stock/patched files.
  • and many other improvements (see changelog)
As its still alpha, be carefull releasing mods for now! Also, tweak files (MiniTweaker) made for original game files are NOT compatible with files saved using S3D.

Please see my first post for more updated details, requirements, etc.

Let me know how it works!!! Have fun...


Excerpt from updated first post:
=========



Download/version

Warning: Always uninstall previous versions using Control Panel. If for some reason installed files get mixed up, S3D can crash or worse, behave unexpectedly.

Current version is 0.2. Still alpha, but much more stable. If you don't like it to be alpha, go bughunting...

Click to download

Do NOT distribute the download through other sites. You can provide a direct link though.

Changelog

View here or in the \Help folder of the installation dir.
skwasjer is offline   Reply With Quote
Old 08-09-07, 08:59 PM   #64
Fearless
Ace of the Deep
 
Join Date: Feb 2007
Location: Adelaide, Australia
Posts: 1,046
Downloads: 340
Uploads: 1
Default

Awesome All i got to do now is have the nerve to try it out
__________________
Fearless

System Specs: AMD Ryzen 7 5800X 8 Core 16 Thread CPU, 3.8GHz Base Clock, 4.7GHz Boost, 105W TDP, 32MB L3 cache | MSI GeForce RTX3060Ti 8Gb Graphics | Corsair Vengeance RGB Pro 32Gb (2x16Gb) 3200 MHz CL16 DDR4 Ram | Samsung 970 Evo Plus NVMe SSD 1TB | Seagate Barracuda 2.5in 2TB HDD | AOC QHD 165 Hz FreeSync HDR curved 31.5in Monitor | ASUS ROG Strix LC 240 ARGB AIO Liquid CPU Cooler White Edition | ASUS ROG Strix Gold 750W Modular Power Supply | Corsair iCUE 5000X RGB Tempered Glass Mid Tower Case White.
Fearless is offline   Reply With Quote
Old 08-09-07, 09:14 PM   #65
THE_MASK
Ace of the deep .
 
THE_MASK's Avatar
 
Join Date: Jan 2006
Posts: 9,225
Downloads: 901
Uploads: 73


Default

The most awesome mod ever , thanks. I must be your control person because if i can use it then anyone can LOL .
THE_MASK is offline   Reply With Quote
Old 08-10-07, 06:57 AM   #66
Bando
Commodore
 
Join Date: May 2007
Location: Where you don't see me
Posts: 607
Downloads: 23
Uploads: 0
Default

Thanks a lot Skwasjer
__________________
Regards,

Bando
Bando is offline   Reply With Quote
Old 08-10-07, 07:45 AM   #67
WilhelmTell
Engineer
 
Join Date: Oct 2006
Location: Berlin, Germany, Europe
Posts: 205
Downloads: 38
Uploads: 0
Default

Properties can be saved now! Yeeehaa!
Great job, skwasjer!

Tell
WilhelmTell is offline   Reply With Quote
Old 08-10-07, 08:21 AM   #68
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

:p

Hope it works ok... I don't test changed values myself . To be safe (for releasing a mod) you must test the files very strictly in the game, and you would best WinDiff source and target files too, or use a similar tool (http://en.wikipedia.org/wiki/Compari...mparison_tools)
skwasjer is offline   Reply With Quote
Old 08-10-07, 03:24 PM   #69
jaketoox
Gunner
 
Join Date: Jul 2007
Location: Finland
Posts: 93
Downloads: 5
Uploads: 0
Default works

Works for me..changed something in my cameras.dat and it worked fine...one thing would be cool...if yor prog would make backup of the current file before modifying it..
It would help people like me to NOT SCREWING UP everythig when you forget to make backup of the file...not happened for me yet, but it is VERY possible...

anyway..nice program...

jaketoox

__________________________________________________ _

When a girl is under 21, she's protected by law. When she's over 65, she's protected by nature. Anywhere in between, she's fair game. (Lt.Cmdr.Matt T. Sherman:Operation Petticoat)
jaketoox is offline   Reply With Quote
Old 08-11-07, 02:07 AM   #70
Go4It
Engineer
 
Join Date: Apr 2007
Location: South of Buffalo N.Y. USA
Posts: 209
Downloads: 0
Uploads: 0
Default

Will net 3.0 work???

If so: Microsoft .NET Framework Redistributable (NFR) 32 + 64 bit

http://go.microsoft.com/fwlink/?linkid=70849 for Windows XP SP2/2003 SP1/Vista x64 (64-bit) [90.1 MB].
http://go.microsoft.com/fwlink/?linkid=70848 for Windows XP SP2/2003 SP1/Vista [50.3 MB].
Go4It is offline   Reply With Quote
Old 08-11-07, 05:28 AM   #71
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

Yes.
skwasjer is offline   Reply With Quote
Old 08-11-07, 03:09 PM   #72
Don_Vipre
Swabbie
 
Join Date: Oct 2006
Posts: 6
Downloads: 0
Uploads: 0
Very nice TOOL!!!!!!!!!!!!!!!!



Don_Vipre
Don_Vipre is offline   Reply With Quote
Old 08-11-07, 04:32 PM   #73
Digital_Trucker
Silent Hunter
 
Join Date: Jul 2007
Location: The Peach State
Posts: 4,171
Downloads: 141
Uploads: 10
Default Many thanks

muchos gracias, Viele Dank, merci beaucoup, molti ringraziamenti, Vele bedanken, muito obrigado, большое спасибо, mange takker, 本当にありがとう

for this wonderful tool! It just made child's play of combining three camera mods into one camera.dat (a feat I would not have even wanted to tackle without it).
Digital_Trucker is offline   Reply With Quote
Old 08-12-07, 06:06 AM   #74
CaptainCox
Sea Lord
 
Join Date: Feb 2007
Location: A Swede in Frankfurt am Main
Posts: 1,897
Downloads: 4
Uploads: 0
Default

Cheers for the update and all the hard work on this!.
Gonna check out the new features pronto.
__________________
CaptainCox is offline   Reply With Quote
Old 08-12-07, 06:14 AM   #75
ReallyDedPoet
Canadian Wolf
 
ReallyDedPoet's Avatar
 
Join Date: Jul 2006
Location: The one and only East Coast
Posts: 10,773
Downloads: 946
Uploads: 5


Default

Just saw the update for this, nice work on continuing to develop this


RDP
__________________

Back in the Day



ReallyDedPoet is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 05:07 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.