On SCNR Spawn Points

Discuss general issues about modding HaloPC. Post ideas for mods here.
User avatar
Altimit01




Connoisseur Snitch! Literarian 500

Posts: 947
Joined: Sun Jun 04, 2006 12:10 pm

On SCNR Spawn Points

Post by Altimit01 »

Reposted from a mac modding site. Yes I realize that SE does most of this stuff already. The main point is to describe how it works.

Ok, so I figured some of ya'll might be interested in this information on how the SCNR handles spawn points. To begin with you'll need a working knowledge of reflexives. Reflexives are a way to allow for flexible sized meta files while still having a definitive structure. Every meta has what's known as the main section. This can be thought of as a header. For reference, let's consider the vehi tag. Inside of the main section are things like speed, AI related items and what vehicle it is. Every vehicle only needs one instance of this data. However vehicles have seats, but they have a different amount of seats per vehicle. The way bungie chose to solve this issue was the reflexive system. Inside of the main section is the "reflexive proper". The first value in a reflexive is what's known as the chunk count. The chunk count is how many instances of the reflexive data there are. To keep with our vehicle reference, this would be how many seats there are in the vehicle. After that is the reflexive offset. It's a 32-bit integer (long) that when you subtract the map magic from it results in the address for the first chunk of the reflexive. In order to determine the address of later chunks, one must know the chunk size which is not listed in the halo map file but can be found with a little experience or by looking into plugin files. Here's a visual of what happens within the file to give you a better idea.

Image

So now that you under reflexives I'll skip to the important part. The SCNR handles spawn points in one of two different ways. The first way is straight forward and what we call simple spawns. In the scenario main section are reflexives for these kind of spawn points. Each chunk is an individual spawn with data for that spawn like x,y,z coordinates, maybe an index for what game types it uses. The second kind of spawn points are what we call palette spawns. These are used to save on space in the mapfile. There are two reflexives involved in palette spawns. What we call <spawn name>_ref reflexives contain only a dependency. Then there's the spawn point reflexive that contains spawn location data and 16-bit integer (short) that indicates which of the _ref chunks to use. Or in other words, which dependency to use. So for vehicles, there would be a vehicle_ref reflexive that for it's chunks might have:

[chunk1: warthog, chunk2: banshee, chunk3: ghost]

Then in the vehicle reflexive there would be x,y,z information and a short for which vehicle to use. So maybe we have:

[chunk1: x=10,y=10,z=0,index=1, chunk2: x=-5,y=15,z=0,index=1, chunk3: x=4,y=-10,z=0.5,index=3, chunk4: x=0,y=0,z=0,index=2]

What this would mean is that at x=10, y=10, z=10 there would be a warthog, at x=-5, y=16, z=0 there would be another warthog, at x=4, y=-10, z=0.5 there would be a ghost and at x=0, y=0, z=0 there would be a banshee.

So with conure's chunk cloner we have the ability to add not only more spawn points of existing vehicles, but in the case of rebuilt maps new vehicles as well without sacrificing scenery spawns. What would be necessary would first be to add a new vehicle_ref chunk with the cloner. Next, we'd have to change the dependency of our new chunk from the original vehicle to one of our imported vehicles. Next, we just have to duplicate a vehicle spawn chunk, change it's index to that of our imported vehicle and move it to where we want it.

Now here's the part where I spam you with all kinds of raw data which when combined with the information above should give an idea as to what goes on inside of the SCNR tag.

Code: Select all

scenario header abridged
reflexive: offset (in decimal)
biped: 552
biped ref: 564
equip: 600
equip ref: 612
MP equip: 900
MP flags: 888
player spawn: 852
scenery: 528
scenery ref: 540
vehicle: 576
vehicle ref: 588
weap: 624
weap ref: 636

Code: Select all

<----player spawn information--->

chunk size = 52 bytes
how many chunks locations = 0x354

0x0 - float - position - x
0x4 - float - position - y
0x8 - float - position - z
0xc - float - facing (in degrees)
0x10 - short - Team index
0x12 - short - BSP index
0x14 - enum16 - type 1 (determines what types player spawns on)
 0 - none
 1 - ctf
 2 - slayer
 3 - oddball
 4 - king of hill
 5 - race
 6 - terminator
 7 - stub
 8 - ignored1
 9 - ignored2
 10 - ignored3
 11 - ignored4
 12 - all games
 13 - all except CTF
 14 - all except CTF & race

0x16 - enum16 - type 2 (determines what types player spawns on)
 0 - none
 1 - ctf
 2 - slayer
 3 - oddball
 4 - king of hill
 5 - race
 6 - terminator
 7 - stub
 8 - ignored1
 9 - ignored2
 10 - ignored3
 11 - ignored4
 12 - all games
 13 - all except CTF
 14 - all except CTF & race

0x18 - enum16 - type 3 (determines what types player spawns on)
 0 - none
 1 - ctf
 2 - slayer
 3 - oddball
 4 - king of hill
 5 - race
 6 - terminator
 7 - stub
 8 - ignored1
 9 - ignored2
 10 - ignored3
 11 - ignored4
 12 - all games
 13 - all except CTF
 14 - all except CTF & race

0x1a - enum16 - type 4 (determines what types player spawns on)
 0 - none
 1 - ctf
 2 - slayer
 3 - oddball
 4 - king of hill
 5 - race
 6 - terminator
 7 - stub
 8 - ignored1
 9 - ignored2
 10 - ignored3
 11 - ignored4
 12 - all games
 13 - all except CTF
 14 - all except CTF & race

</----player spawn information--->

<---scenery--->
chunk size = 72 bytes
count offset = 0x228

type - index - 0x0

name - index - 0x2

not placed - bitmask32 - 0x4
 automatically - 31
 on east - 30
 on normal - 29
 on hard - 28

desired permutation - short - 0x6

position
 x - float - 0x8
 y - float - 0xc
 z - float - 0x10

rotation
 y - float - 0x14
 p - float - 0x18
 r - float - 0x1c
</---scenery--->

<---weapons--->
chunk size = 92 bytes
count offset = 0x228

type - index - 0x0

name - index - 0x2

not placed - bitmask32 - 0x4
 automatically - 31
 on east - 30
 on normal - 29
 on hard - 28

desired permutation - short - 0x6

position
 x - float - 0x8
 y - float - 0xc
 z - float - 0x10

rotation
 y - float - 0x14
 p - float - 0x18
 r - float - 0x1c

rounds left - short - 0x48

rounds louded - short - 0x4a

flags - bitmask32 - 0x4c
 initally at rest(doesnt fall) - 31
 obsolete - 30
 initally at rest(doesnt fall) - 29
</---weapons--->

<---bipeds--->
chunk size = 120 bytes
count offset = 0x228

type - index - 0x0

name - index - 0x2

not placed - bitmask32 - 0x4
 automatically - 31
 on east - 30
 on normal - 29
 on hard - 28

desired permutation - short - 0x6

position
 x - float - 0x8
 y - float - 0xc
 z - float - 0x10

rotation
 y - float - 0x14
 p - float - 0x18
 r - float - 0x1c

body vitality [0, 1] - float - 0x48

flags - bitmask32 - 0x4e (0x4c, if its long bitmask)
 dead - 31
<---bipeds--->

<---vehicles--->
chunk size = 144 bytes (1664 - 1520)
count offset = 0x240

type - index - 0x0

name - index - 0x2

not placed - bitmask32 - 0x4
 automatically - 31
 on east - 30
 on normal - 29
 on hard - 28

desired permutation - short - 0x6

position
 x - float - 0x8
 y - float - 0xc
 z - float - 0x10

rotation
 y - float - 0x14
 p - float - 0x18
 r - float - 0x1c

body vitality [0, 1] - float - 0x48

flags - bitmask32 - 0x4e (0x4c, if its long bitmask)
 dead - 31

multiplayer team index - char - 0x58 (0x59, 0x57 [both are possible if litle edian changes chars odd, i would start with 0x59])

multiplayer spawn flags - bitmask32 - 0x5a
 slayer default - 31
 ctf default - 30
 king default - 29
 oddball default - 28
 unused - 27
 unused - 26
 unused - 25
 unused - 24
 slayer allowed - 23
 ctf allowed - 22
 king allowed - 21
 oddball allowed - 20
 unused - 19
 unused - 18
 unused - 17
 unused - 16

</---vehicles--->
<---netgame flags--->
chunk size = 148 bytes (1668 - 1520)
count offset = 0x378

position
 x = - float - 0x0
 y = - float - 0x4
 z = - float - 0x8

facing - float - 0xc

type - enum16 - 0x10
 ctf - flag - 0
 ctf - vehicle - 1
 oddbal - ball spawn - 2
 race - track - 3
 race - vehicle - 4
 vegas - bank - 5
 teleporter from - 6
 teleporter to - 7
 hill - flag - 8

team index - short - 0x12

weapon group - dependency - 0x14
</---netgame flags--->

<---netgame equipment--->
chunk size = 144 bytes (1664 - 1520)
count offset = 0x384

flags - bitmask32 - 0x0, or 0x2
 levitate - 31

type 0 - enum16 - 0x4
 none - 0
 ctf - 1
 slayer - 2
 oddball - 3
 king of hell - 4
 race - 5
 terminator - 6
 stub - 7
 ignored1 - 8
 ignored2 - 9
 ignored3 - 10
 ignored4 - 11
 all games - 12
 all except ctf - 13
 all except race & ctf - 14


type 1 - enum16 - 0x6
 none - 0
 ctf - 1
 slayer - 2
 oddball - 3
 king of hell - 4
 race - 5
 terminator - 6
 stub - 7
 ignored1 - 8
 ignored2 - 9
 ignored3 - 10
 ignored4 - 11
 all games - 12
 all except ctf - 13
 all except race & ctf - 14


type 2 - enum16 - 0x8
 none - 0
 ctf - 1
 slayer - 2
 oddball - 3
 king of hell - 4
 race - 5
 terminator - 6
 stub - 7
 ignored1 - 8
 ignored2 - 9
 ignored3 - 10
 ignored4 - 11
 all games - 12
 all except ctf - 13
 all except race & ctf - 14


type 3 - enum16 - 0xa
 none - 0
 ctf - 1
 slayer - 2
 oddball - 3
 king of hell - 4
 race - 5
 terminator - 6
 stub - 7
 ignored1 - 8
 ignored2 - 9
 ignored3 - 10
 ignored4 - 11
 all games - 12
 all except ctf - 13
 all except race & ctf - 14

team index - short - 0xc

spawn time (in seconds, 0 = default) - short - 0xe

position
 x - float -0x40
 y - float -0x44
 z - float -0x48

facing - float -0x4c

item collection - dependency -0x50
</---netgame equipment--->
-Thanks to conure for the second set of data
Image
Download Eschaton: Halomods | Filefront | Mediafire
User avatar
swampyevilnut117




Wordewatician 50

Posts: 64
Joined: Thu Dec 06, 2007 1:41 pm
Location: crouched in the corner mumbling to myself

Post by swampyevilnut117 »

Gosh darn you lol... beat me to posting that :(

Lol, I had noticed that ability last night, nice post though very informative.
User avatar
bcnipod





Posts: 3580
Joined: Tue May 15, 2007 8:52 am
Location: 45 Minutes outside Boston
Contact:

Post by bcnipod »

move to.... tutorials mb?
Twitter: Dirk Gently | Major lulz
Mr. Brightside: Worst mod I've seen since 'Nam.
Website
User avatar
swampyevilnut117




Wordewatician 50

Posts: 64
Joined: Thu Dec 06, 2007 1:41 pm
Location: crouched in the corner mumbling to myself

Post by swampyevilnut117 »

I think so since this is kinda more of a tutorial about the SCNR stuff.
User avatar
Andrew_b




Socialist

Posts: 4188
Joined: Sat Feb 24, 2007 4:52 pm
Contact:

Post by Andrew_b »

Made lots of sense. Should be a good explanation for people who want to know.
User avatar
Patrickh




Wordewatician 500

Posts: 1173
Joined: Wed Mar 14, 2007 4:53 pm

Post by Patrickh »

I would so make a program that outlined this, but it looks like you and conure got it covered. Maybe I will for kicks? Well nice work on figuring out all the values within those chunks. :)
Image
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
OwnZ joO




Articulatist 500

Posts: 980
Joined: Thu Nov 10, 2005 4:24 pm

Post by OwnZ joO »

A good explanation of reflexives and how the scnr works.
User avatar
Mr.Brightside
Readers Club





Posts: 823
Joined: Sun Nov 18, 2007 11:25 am
Location: Pensacola, Florida.

Post by Mr.Brightside »

swampyevilnut117 wrote:Gosh darn you lol... beat me to posting that :(
lies
Image
But I still hear the deafening drums of war onward every twisted spoke
User avatar
Pepsi




Snitch! Wordewatician 500

Posts: 2052
Joined: Thu Dec 28, 2006 11:11 pm
Location: Stalking Hamp With A PipeWrench

Post by Pepsi »

^ agrees
User avatar
swampyevilnut117




Wordewatician 50

Posts: 64
Joined: Thu Dec 06, 2007 1:41 pm
Location: crouched in the corner mumbling to myself

Post by swampyevilnut117 »

lies
^ agrees
Why youu guys doubting me... right after I figured out that I could use the Chunk Cloner for that I was about to post andI saw Alt beat me to it

Merged post.

His is just a much detailed version of what I was going to say

sorry bcnipod
Last edited by swampyevilnut117 on Sat Feb 23, 2008 7:32 am, edited 2 times in total.
User avatar
bcnipod





Posts: 3580
Joined: Tue May 15, 2007 8:52 am
Location: 45 Minutes outside Boston
Contact:

Post by bcnipod »

try not to double post.
Twitter: Dirk Gently | Major lulz
Mr. Brightside: Worst mod I've seen since 'Nam.
Website
User avatar
Pepsi




Snitch! Wordewatician 500

Posts: 2052
Joined: Thu Dec 28, 2006 11:11 pm
Location: Stalking Hamp With A PipeWrench

Post by Pepsi »

swampyevilnut117 wrote:
lies
^ agrees
Why youu guys doubting me... right after I figured out that I could use the Chunk Cloner for that I was about to post andI saw Alt beat me to it
lies x2
User avatar
Patrickh




Wordewatician 500

Posts: 1173
Joined: Wed Mar 14, 2007 4:53 pm

Post by Patrickh »

swampyevilnut117 wrote:
lies
^ agrees
Why youu guys doubting me... right after I figured out that I could use the Chunk Cloner for that I was about to post andI saw Alt beat me to it
to prove yourself, just give a detailed explanation on how to locate a chunk count within the meta data. If you can, without outside help, we will believe you.
Image
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
User avatar
DeadHamster




Snitch! Advisor Articulatist 500

Posts: 2289
Joined: Thu Feb 15, 2007 9:38 pm

Post by DeadHamster »

why should he have to prove anything to you. Swampy dont worry about what any of them say, if you actually know what your doing you dont have to prove it to a few kids on the internet. Let them believe what you want.

And to the one's saying he's lying, unless you can back your claims with actual proof that he's lying, you're posts are just as credible as his.


edit: Just to clarify, I was not flaming anybody here. If thats the impression you got then I give you my sincere apologies, I just found those posts a bit annoying


To Altimit, my apologies for continuing this off-topic conversation.
User avatar
Mr.Brightside
Readers Club





Posts: 823
Joined: Sun Nov 18, 2007 11:25 am
Location: Pensacola, Florida.

Post by Mr.Brightside »

DeadHamster wrote:why should he have to prove anything to you. Swampy dont worry about what any of them say, if you actually know what your doing you dont have to prove it to a few kids on the internet. Let them believe what you want.

And to the one's saying he's lying, unless you can back your claims with actual proof that he's lying, you're posts are just as credible as his.


edit: Just to clarify, I was not flaming anybody here. If thats the impression you got then I give you my sincere apologies, I just found those posts a bit annoying


To Altimit, my apologies for continuing this off-topic conversation.
Ahh deadhamster, always being a rebel...

=P

As for the information on spawn points, Phenomenal job altimit.
Image
But I still hear the deafening drums of war onward every twisted spoke
User avatar
DeadHamster




Snitch! Advisor Articulatist 500

Posts: 2289
Joined: Thu Feb 15, 2007 9:38 pm

Post by DeadHamster »

lol brightside.

Just a question Alt, does this go for other things as well? As in, can you use it for more then just vehicles?

And another, Is there any difference in results between using this, and important tags as scenery with sparkedit?[/quote]
User avatar
Patrickh




Wordewatician 500

Posts: 1173
Joined: Wed Mar 14, 2007 4:53 pm

Post by Patrickh »

If you are wondering about this sort of thing for all tags, you can start by looking at both HMT/ent plugins as well as extracted meta's xml files, they outline the basics of whats where. In hmt extracted XML files, they show an XML block for reflexives, which follow this structure:

<Reflexive>
<Location>0x280</Location>
<Translation>0x1A7C</Translation>
<ChunkCount>7</ChunkCount>
</Reflexive>

To help you understand Alt's tut better, I will explain how HMT gathers the info: Location, translation, and chunk count.

The first step is to find the reflexive. We get the tags meta offset from its meta offset value in the index modified by the magic, although most programs can just give it to you (the meta you swap in HMT is this offset in hex)
Now, a tags meta is obviously from meta offset to meta offset + meta size. so that is the area you will search. Since chunk counts are easily confused with other random values, we will search for the first chunk offset. This value, as Alt explained, must be modified by magic, then it will point to a value within the meta range we are searching. So to check if a 32 bit integer (4 bytes) is a chunk offset, we read its value, subtract the magic, then check if its between metaoffset and metaoffset + metasize. If it is, we found it. Now that we know where it is, we can determine the values in the XML block shown earlier.

Location: the offset at which read the 32 bit integer minus meta offset, then converted to hex.

Translation: This is the number of bytes from the pointer to the first chunk. So, to find it, it is the value of the 32 bit integer minus magic minus metaoffset, then converted to hex.

To find the chunk count, you simply go back 4 bytes from where you found the chunk offset, then read that number as a 32 bit integer.

I hope this will help you understand the basic premise of reflexives and their relationship to the XML you've worked with so many times before.
If you have any questions, I'm sure either me, Alt, or conure will gladly lend you a hand. This topic is specifically about the info within the reflexives of the scnr meta, and knowing your way around definately helps. Using the values in the XML and looking at Alts image depicting the structure should help you understand.

Also: please point out any innacuracies/critical typos i wrote so i can fix.
Image
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
User avatar
Philly




Collaborator

Posts: 3607
Joined: Thu Oct 12, 2006 9:08 am

Post by Philly »

Right, what this tutorial means is that we can do things in modding that would have been impossible before, right? I mean, does mean I can put new vehicles and weapons on a campaign map, without overwriting anything? That would be nice. :)
For anybody still wondering where FTD has gone, here it is.
User avatar
Pepsi




Snitch! Wordewatician 500

Posts: 2052
Joined: Thu Dec 28, 2006 11:11 pm
Location: Stalking Hamp With A PipeWrench

Post by Pepsi »

DeadHamster wrote:...you dont have to prove it to a few kids on the internet.
Im older then you so plz watch who you call a "kid". And by some dude trying to shine on Alt's thunder is ghey especially how he hasnt responded yet me or brightside asking for some proof of him to back his claim.

Lemme use some Hamster logic now since he made his reply..
DeadHamster wrote: And to the one's saying he's lying, unless you can back your claims with actual proof that he's lying, you're posts are just as credible as his.
lol, ok then...


"Guess what guys?! I can add bumpmaps to weapons and vehicles now! I can also PMI without doing any rebuilding process! Also, THE MOON IS MADE OF CHEESE!"

Hampster, are these things i said "impossible? Have you been to the moon yourself? Then everything I said is true then correct? Please stop being the super suck-up and show a pair every now and then kay?

Note to Alt:
You own. You know you own. You know this is a huge break through. Kudos dude and +50 respect. You have leveled up! Now you may use your new sword.
User avatar
bcnipod





Posts: 3580
Joined: Tue May 15, 2007 8:52 am
Location: 45 Minutes outside Boston
Contact:

Post by bcnipod »

this is really nice work, i would not be surprised if Bungie tried to pick up Alt and conure sometime.
Twitter: Dirk Gently | Major lulz
Mr. Brightside: Worst mod I've seen since 'Nam.
Website
Post Reply