Ok, point taken. I am encouraged to keep going.
Here's a link to the beta reader.
http://www.twcenter.net/forums/downl...o=file&id=1578
The two files in the zip are animationlibrary.py and settlementutilities.py.
animationlibrary.py is almost the same as the one distributed for the
animation utilites except I put a trap in the function getstring to jump
back out if it gets a requested number of characters more than 1000.
This usually means I'm reading the wrong int and it puts Python into a loop
where it beeps every time it reads the bell code, very annoying to have
happen at work!
settlementutilities.py is the one to double-click on. Just put
north_european_village_a.world and north_european_town_a.world
in the same directory with the two Python files. Currently the .txt
file doesn't have the actual mesh data output to it. If you want this
just search for WRITEDATAFLAG and set it to True. The output file
will be very large!!! You can cut and paste the vertices and tris
to make an obj file. The u and v coordinates are also converted from
RGB encoding into floats if you want them too.
Now for numerology, I'll start. The village has 31 "complexes" containing
a total of 98 "structures" or self contained meshes. The town has 30
complexes with a total of 123 structures.
Villages have a block of data at the top (after the 40 entries block of
which 31 have a positive sequence number that should correspond to the
complexes) that has 867 entries. This number shows up again near the
bottom for another block of data.
For towns the number is 1228.
Question 1: What do these entries correspond to?
For no good reason I kept a running total of the number of triangle groups
defined in all the structures. For villages this number is 1274. Guess what,
there are two blocks of data right at the end (after a block with 867 entries)
that have 1274 entries. For towns this number is 2017 with the same
correspondence. So, of course,
Question 2: What do these entries do or is this a coincidence?
There is a block of data preceded by this comment by me:
# ------------------------------------------
# Beginning of hard coded 17 floats but
# variable ints with 5 byte signatures
# ------------------------------------------
It has 156 entries for villages and 173 entries for towns, BUT, nowhere
can I find that number to read in order to tell me how to read this data.
Right now it is just hard-coded in. This is very unusual for granny strings;
they always tell you how to read themselves so I'm a bit perplexed on this
one. The entries are 17 floats followed by what I read as 5 bytes being
a signature, then followed by a variable number of ints which, by trial and
error, I have made up rules for until I was able to read both cases, village
and town. One entry looks like this:
Code:
+1.00000 +0.00000 +0.00000 -0.11595 +0.00000 +1.00000 +0.00000 -4.10875 +0.00000 +0.00000 +1.00000 -4.22434 +0.00000 +0.00000 +0.00000 +1.00000 +1.00000 sig: 1 0 0 2 0 , ints: 0 0 0 0 68 3 0 0 0 0 155 0 0 0 13 4 0 0 220 0 0 0 2 0 0 0 0 0 0 0 3 0 0 0 54 0 0 0
If I rearrange the first 16 floats into a 4x4 matrix I get
Code:
+1.00000 +0.00000 +0.00000 -0.11595
+0.00000 +1.00000 +0.00000 -4.10875
+0.00000 +0.00000 +1.00000 -4.22434
+0.00000 +0.00000 +0.00000 +1.00000
+1.00000 sig: 1 0 0 2 0 , ints: 0 0 0 0 68 3 0 0 0 0 155 0 0 0 13 4 0 0 220 0 0 0 2 0 0 0 0 0 0 0 3 0 0 0 54 0 0 0
In homogeneous coordinates this is a translation with no rotation.
All of the entries seem to be translation only.
Question 3: Why 156 and 173 and how can I figure out when I'm done reading
this data block?
This is probably enough for now. If anyone gets a chance to run the program
and look at the grannies and data blocks please post back ideas.
Edit: Aargh! Found a write out bug for villages. After all the complexes are read
there are three strings for .worldTerrain etc. After that my code wrote out
57 0 1 2 [4307] 0
57 0 1 2 [4307] 0 0
57 0 1 2 [4307] 0 0 0
57 0 1 2 [4307] 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
56 0 1 0 [4308] 57 0 [4307] 0 0 255 255 255 255 0 0
That's not what is in the file just this
57 0 1 2 [4307] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
56 0 1 0 [4308] 57 0 [4307] 0 0 255 255 255 255 0 0
I think my editor auto-indented the write statement to be inside the loop
instead of after it, the Perils of Python.
Bookmarks