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 02-01-19, 11:27 AM   #46
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,299
Downloads: 130
Uploads: 0


Default

How to code the faces output.
Given there are 10000 faces? Each line must follow the formula below.
The loop will be slow but should work.
This is NOT actual code but gives the information to code the needed loop.

---C1------ C2------ C3---- C4
f 1/101 102/100 103/201 2/202
f 2/202 103/201 104/302 3/303

C1 = +1/+101
C2 = +1/+101
C3 = +1/+101
C4 = +1/+101

Last edited by Jeff-Groves; 02-01-19 at 11:46 AM.
Jeff-Groves is offline   Reply With Quote
Old 02-01-19, 12:09 PM   #47
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,299
Downloads: 130
Uploads: 0


Default

At first look you may think we need a double loop like for the Textures.
Actually a single loop will work for our needs so speed goes up.

Look close at the faces ints and the pattern.
You may think 8 ints are needed.
Jeff-Groves is offline   Reply With Quote
Old 02-01-19, 12:19 PM   #48
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,719
Downloads: 439
Uploads: 2


Default

Quote:
Originally Posted by Jeff-Groves View Post
It's a problem with floats.
From Graeme at SweetScape............

"The error you are seeing is caused because 'float' is not very accurate for doing a lot of computations. We tried your function in C++ and it gives the same issue. 'float' is just not very accurate and if you switch to 'double' it will be better, although double has accuracy issues as well for lots of computations."
...
Thanks for that Jeff
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 02-01-19, 12:31 PM   #49
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,299
Downloads: 130
Uploads: 0


Default

The support from SweetScape is one big reason I pay to stay updated.
Jeff-Groves is offline   Reply With Quote
Old 02-01-19, 12:50 PM   #50
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,299
Downloads: 130
Uploads: 0


Default

Have you figured out the loop needed to output 10000 faces yet?
And the MINIMUM number of ints needed to do it?


If your answer is above 3 ints?

Your wrong!

Last edited by Jeff-Groves; 02-01-19 at 01:01 PM.
Jeff-Groves is offline   Reply With Quote
Old 02-01-19, 02:16 PM   #51
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,719
Downloads: 439
Uploads: 2


Default

Is there a way to do like a "Do Loop Until EOF"?
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 02-01-19, 02:29 PM   #52
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,299
Downloads: 130
Uploads: 0


Default

We only need one looping function to do everything.
I have 3 ints assigned in my loop right now.
2 only control the number of loops I do.
The other is for kicking out the faces information.
I take advantage of the Printf function to do the math.


Here's an example..............

f=(f+1);
Printf("f %u", f);
Printf( "/%u ", f=(f+100) );

Those lines print out 1/101
That's the first part of a face.

Each line of Printf needs to be coded or numbers go real FUBAR!
What I mean by that is that using f on a single line in Printf can corrupt the data.
By using different lines? It preserves the true value of f for further math.
BUT! We can loop the code to print out all 10000 lines easily.

Last edited by Jeff-Groves; 02-01-19 at 02:47 PM.
Jeff-Groves is offline   Reply With Quote
Old 02-01-19, 02:52 PM   #53
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,719
Downloads: 439
Uploads: 2


Default

Nice. I keep confusing "program code" and "scripting"... In other words, I want to write an application in one fell swoop. You're getting the data and its structure, to be used in an app... baby steps. must take baby steps pb...
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 02-01-19, 03:00 PM   #54
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,299
Downloads: 130
Uploads: 0


Default

010 uses a C 'LIKE' code. That means it is not a fully functioning C compliant scripting language.

So it does have it's quirks.
Jeff-Groves is offline   Reply With Quote
Old 02-01-19, 03:26 PM   #55
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,299
Downloads: 130
Uploads: 0


Default

OK. I lied on the ints needed.
You only need 1 int.


I'm going to introduce you to Arrays so you understand why I only need 1 int.

//------------------------------------------------
//--- 010 Editor Script File
// RAW to object file add in
// Adds the Faces
//
//------------------------------------------------
// all the code for Faces below

int f[5];
f[1]=10000;





for (f[2] = 0; f[2] < f[1]; f[2]++)
{

f[3]=(f[3]+1);
Printf("f %u/%u\n ", f[3], f[4]=(f[3]+100));

}





It's a cheat I'll admit. But allows a single Printf function to print the information with no corruption of data.

Last edited by Jeff-Groves; 02-01-19 at 03:47 PM.
Jeff-Groves is offline   Reply With Quote
Old 02-01-19, 05:10 PM   #56
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,719
Downloads: 439
Uploads: 2


Default

Say uh, does 010 count from zero for arrays (actually, anything), like ANSI C?
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 12-23-19, 04:05 PM   #57
s7rikeback
I break things
 
s7rikeback's Avatar
 
Join Date: Jan 2013
Location: Merry Old England
Posts: 771
Downloads: 1105
Uploads: 10


Default Dat files

Hello Jeff,


Would it be possible for 010 to list all T0 / A0 / B0 nodes in each dat, within a folder, like Air or Sea ?


So output could be:
Unit Name T01 / T02 / A01 / B01 / B02 etc.


Without having to open each dat with S3D and count them manually ?


Or a template, so that we could enter our own search functions ?
__________________
s7rikeback is offline   Reply With Quote
Old 01-19-20, 04:14 PM   #58
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,299
Downloads: 130
Uploads: 0


Default

The findinfiles function will do that.
Granted you'd need to add some coding to jump past any T01 dds references.
__________________
I don't do Stupid. So don't ask.
Jeff-Groves is offline   Reply With Quote
Old 03-16-20, 05:02 PM   #59
Kpt. Lehmann
GWX Project Director
 
Kpt. Lehmann's Avatar
 
Join Date: Jul 2005
Location: The Republic of Texas
Posts: 6,875
Downloads: 115
Uploads: 0


Default

01000110 01110010 01100101 01100001 01101011 01101001 01101110 00100111 00100000 01010100 01100101 01100011 01101000 01101110 01101111 01101101 01100001 01100111 01100101 01110011 00100001




__________________

www.thegreywolves.com
All you need is good men. - Heinrich Lehmann-Willenbrock
Kpt. Lehmann is offline   Reply With Quote
Old 03-28-20, 10:48 PM   #60
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,299
Downloads: 130
Uploads: 0


Default

Thanks Kpt. Lehmann
Us Freaking Technomages will carry on.


I saw a post about removing Map Contacts.
In that post it was stated how much work that would be for several hundreds of ships.

So......
Shall I do a script to demonstrate how that can be done?
__________________
I don't do Stupid. So don't ask.
Jeff-Groves 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 03:46 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.