Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
New Region/Map Stuff

 
Post new topic   Reply to topic Printable version
 View previous topic  help? Post :: Post All In One "Map/Settings/Lvz/Modu...  View next topic  
Author Message
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Mon Aug 09, 2004 11:42 am    Post subject: New Region/Map Stuff Reply to topic Reply with quote

Code: Show/Hide

3.2.2. "REGN" chunks

these chunks define regions. to recap, a region is a set of tiles,
usually but not always contiguous, with certain properties. asss
understands regions and can implement some advanced features using them.
currently continuum doesn't understand regions, but it would be nice if
it did, and we'll be able to do even cooler things when it does.

there's a lot of stuff that you might want to say about a region, so to
support all the varied uses, and also future uses, we'll use the chunk
model again: each region gets its own set of "subchunks" describing its
function. to avoid confusion, all sub-chunk types that go inside the
"REGN" superchunk start with "r". the data of the big "REGN" chunk is
simply a series of subchunks.

here are some defined sub-chunk types:

"rNAM" - a descriptive name for the region
"rTIL" - tile data, the definition of the region
"rBSE" - whether the region represents a base in a flag game
"rNAW" - no antiwarp
"rNWP" - no weapons
"rNFL" - no flag drops
"rAWP" - auto-warp
"rPYC" - code to be executed when a player enters or leaves this region


Does it make sense, at this point, to put region stuff into the player downloaded maps? It makes the downloads longer on an already slower ASSS download.

Code: Show/Hide

3.2.2.2. "rTIL" chunks

this is stored as a sequence of 4-byte values that hold tile
coordinates. every chunk should have exactly one of these.

struct tile {
    unsigned x : 12;   // range 0-1023, upper two bits should be 0
    unsigned y : 12;
    unsigned tile : 8; // unused for this purpose
};


So, a region of 100x100 would need 10,000 rTIL entries, no?

I have a map where a single region takes up more than half the map (156 region v1 rectangles). That's more than 524,288 rTIL entries. That would probably double the map size.

Code: Show/Hide

3.2.2.4. "rNAW" chunks

this is a 0-byte chunk. if present, antiwarp should be disabled for
ships in this region. currently, this disabling happens on the server,
and players whose antiwarp is being disabled aren't necessarily aware of
it. it would be nice if in the future continuum understood this feature
so that it could inform the player that antiwarp is unavailable in this
location.


Shouldn't all these region properties really have their own region?

Oh, and the antiwarp module I posted turns the player's antiwarp off in the client. While not as nice as something built straight into Continuum, it certainly lets the player know that his antiwarp isn't getting out.

Code: Show/Hide

3.2.2.5. "rNWP" chunks

this is a 0-byte chunk. if present, all weapons are non-functional in
this region. the same notes apply to this feature as to the no antiwarp
feature.


Again, I would think it's own region would make for easier processing.

Code: Show/Hide

3.2.2.6. "rNFL" chunks

this is a 0-byte chunk. if present, any flags dropped in this region are
respawned as neutral flags in the center of the map (or wherever the
settings indicate they should be spawned).


No flag regions aren't needed by the client, so having it's very own region makes even more sense here.

Code: Show/Hide

3.2.2.7. "rAWP" chunks

this chunk, if present, turns on the auto-warping feature. any player
entering this region will be immediately warped to the specified
destination.

the data for this chunk specifies the destination, in this format:

struct autowarp_destination {
    i16 x;           // the destination x coordinate. 0-1023, or -1 for
                     // the player's current x coordinate.
    i16 y;           // the destination y coordinate. 0-1023, or -1 for
                     // the player's current y coordinate.
    char arena[16];  // the destination arena name. null if the warp
                     // does not cross arenas.
};

as a simple space optimization, if the warp does not cross arenas, you
can leave out the 16 bytes of arena name, so that the whole chunk data
is 4 bytes long.


I would add a warp type. That way custom modules can use this without breaking things. And perhaps a destination rectangle rather than a destination point. Some warp types could use only the x1,y1 of the rect as a point. Perhaps a callback in ASSS to notify the custom warp handlers.

Code: Show/Hide

3.2.2.8. "rPYC" chunks

this chunk lets you embed code in level files. the exact semantics of
this data haven't yet been determined, but it'll probably go something
like this:

this chunk should contain ascii data representing some python code. the
code will be executed when the map is loaded, and it may define several
functions: a function named "enter", if it exists, will be call each
time a player enters this region. it will be called with one argument,
which is the player who entered the region. a function named "exit"
works similarly, except of course it gets called when someone leaves.


I assume that this is server side. Again, this has to be downloaded by the player. It might also pose security problems (though I don't know how).



That all being said, I do like the other new map stuff.

My suggestion is to make a map format that the server seperates out. It keeps one half, and sends the other half to the client. This keeps everything together like you want, but doesn't unnessicarily increase downloading times. This could be as simple as a .zip file with a .elvl and a .rgn2 in it.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Mon Aug 09, 2004 2:11 pm    Post subject: Reply to topic Reply with quote

I don't really care what you do, as long as you do not modify the structure of the LVL, to a specific server software. (and continue calling it a LVL file)
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Tue Aug 10, 2004 12:50 am    Post subject: Re: New Region/Map Stuff Reply to topic Reply with quote

Dr Brain wrote:

Does it make sense, at this point, to put region stuff into the player downloaded maps? It makes the downloads longer on an already slower ASSS download.


i figured this would come up. i have four arguments for putting this sort of information in the downloaded maps: first, i want cont to eventually support this stuff, including regions, and when that happens, this stuff will have to go to to the client. second, it's dangerous to have the .lvl file on the server not be the same as the one sent to the client. someone will upload a lvl from their zone directory, thinking that everything in it will be preserved, but it'll lose the region information that was in it on the server. third, it simplifies the server to not have to do too much processing on the file before sending it to the client. fourth, this data isn't intended to be very big. i think 10k would be the high end, and don't forget that the whole lvl is compressed with zlib to download it.

Dr Brain wrote:

So, a region of 100x100 would need 10,000 rTIL entries, no?


um. first, that section should be a little clearer: there's one rTIL chunk, which contains an array of tile entries. so a 100x100 region would take 40k. second, i wasn't thinking too hard about the region representation yet, and i went with something simple. you've convinved me that a tile list just won't work, so i'm going to think of something more space-efficient.

Dr Brain wrote:

Shouldn't all these region properties really have their own region?


i have no idea what you mean by this (and the next few comments that say the same thing about other chunk types). region properties are just flags that you can turn on or off per region. in general, i would expect only one to be used for any particular region. e.g., it makes no sense to have both no-weapons and autowarp enabled for the same region.

Dr Brain wrote:

Oh, and the antiwarp module I posted turns the player's antiwarp off in the client. While not as nice as something built straight into Continuum, it certainly lets the player know that his antiwarp isn't getting out.


does it turn it back on when they leave? as i said, none of this is implemented, so the exact semantics of the no-antiwarp flag are still up in the air. this particular flag is best handled by the client, of course.

Dr Brain wrote:

I would add a warp type. That way custom modules can use this without breaking things. And perhaps a destination rectangle rather than a destination point. Some warp types could use only the x1,y1 of the rect as a point. Perhaps a callback in ASSS to notify the custom warp handlers.


i'm sort of trying to maintain the same philosphy that i've been using for built-in features in the rest of the server, which is: simple features that are easy to code get built in to the core stuff. if you want fancy options, you're best off doing it yourself. so my opinion on this issue is: if you want fancier warping than is provided, define your own chunk type and write your own code to do it (all region information will be exposed internally through the mapdata module).

Dr Brain wrote:

I assume that this is server side. Again, this has to be downloaded by the player. It might also pose security problems (though I don't know how).


yes, this code will be run on the server. i'd love to have a python vm embedded in the client so you could easily add functionality to the client-side, but that's a long way off.

the whole embedded code thing was just a crazy idea i had while i was writing the draft. i'm sure there are many issues to be worked out before it can be useful.

Dr Brain wrote:

That all being said, I do like the other new map stuff.


cool, thanks for the feedback.

one last comment: if asss download times are slow, then we should try to fix the problem directly, not indirectly by trying to keep lvl files smaller.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Aug 10, 2004 1:12 am    Post subject: Reply to topic Reply with quote

I meant that it's simpler to have one noanti region than to have a noanti flag in several regions.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Tue Aug 10, 2004 2:00 am    Post subject: Reply to topic Reply with quote

oh, i see what you mean. effectively, that's like having the noanti (etc.) flag forced on in one specifically-named region, and off in all the others. i think having separate flags makes things more flexible. e.g., a map maker could set up a bunch of noanti regions, and turn on and off different combinations of them easily, rather than editing the region tiles themselves. or you could play with the noanti flag at runtime to grow and shrink the noanti area depending on player count. or something like that.

anyway, the flags are only 8 bytes per region they're on in, probably compressed down to 5. the only good reason i can think of to have a dedicated noanti region is efficiency, but i don't think that'll be a big deal.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Tue Aug 10, 2004 3:04 am    Post subject: Reply to topic Reply with quote

ok, i wrote up something should be much more efficient for reasonable regions. the spec is updated. the modified section is:

Code: Show/Hide

3.2.2.2. "rTIL" chunks

this subchunk describes the tiles that make up the region. it's stored
in a compact rle-ish representation.

conceptually, a region is some subset of the 1024x1024 tiles in the map.
to encode a region, encode it row by row, left to right, top to bottom.

for each row, split it into runs of empty tiles and present tiles. for
each run, output one of these bit sequences:

    000nnnnn          - n+1 (1-32) empty tiles in a row
    001000nn nnnnnnnn - n+1 (1-1024) empty tiles in a row
    010nnnnn          - n+1 (1-32) present tiles in a row
    011000nn nnnnnnnn - n+1 (1-1024) present tiles in a row

for the two-byte sequences, the bits in the second byte are the low
bits, and the two bits at the end of the first byte are the high bits.

for example, if you have a run of 10 present tiles, you'd output the
byte 01001001, or 73 decimal. if you have a run of 300 empty tiles,
you'd output 00100001 00101011, or 33 43.

for each row, you must output a sequence of runs that sum to exactly
1024 tiles. anything else (missing tiles at the end of a row, or a run
that extends past the end of the line) is an error.

there are two exceptions to the above rule: first, rows that contain no
tiles at all can (optionally) be encoded specially:

    100nnnnn          - n+1 (1-32) rows of all empty
    101000nn nnnnnnnn - n+1 (1-1024) rows of all empty

second, if the same pattern of tiles appears in more than one
consecutive row, you can use these special codes to save more space:

    110nnnnn          - repeat last row n+1 (1-32) times
    111000nn nnnnnnnn - repeat last row n+1 (1-1024) times

the rTIL chunk must describe exactly 1024 rows. this might require only
two bytes (163 255 for the totally empty region), or it might require
much more.

note: several bit patterns don't correspond to any of the above codings.
that's deliberate. don't use them.


comments?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Tue Aug 10, 2004 5:03 pm    Post subject: Reply to topic Reply with quote

Individual tile positions to some kind of bit list? I think that's taking it a bit too far. What about a list of rectangle structures (like MS' RECT) or something vaguely similar? It would even be more effecient than the bit thing if your region was somewhat rectangular.

Or maybe even define a bunch of different shapes (or at least a circle as well) with their own different structs.

Sorry if this is somehow newbish in a way I don't see... I haven't had too much experience with asss myself. Yeah, that was a double meaning.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Tue Aug 10, 2004 11:43 pm    Post subject: Reply to topic Reply with quote

Cyan~Fire wrote:
Individual tile positions to some kind of bit list? I think that's taking it a bit too far. What about a list of rectangle structures (like MS' RECT) or something vaguely similar? It would even be more effecient than the bit thing if your region was somewhat rectangular.


what do you care what the file format looks like? you're not writing code to read or write it.

i already tried rectangle lists. that was my first attempt. they suck for various reasons, for example, turning an arbitrary set of tiles into an optimal rect list is a really hard problem. i'm fairly confident an rle-style format will be much easier to deal with in code.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Wed Aug 11, 2004 12:59 am    Post subject: Reply to topic Reply with quote

Cyan~Fire wrote:
I haven't had too much experience with asss myself. Yeah, that was a double meaning.

I'm sure Smithy101 can help you with that problem, well, only in one of the contexts.

Sorry, couldn't resist. sa_tongue.gif
Back to top
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Wed Aug 11, 2004 9:04 am    Post subject: Reply to topic Reply with quote

In being an ass or getting some?
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Aug 12, 2004 4:52 pm    Post subject: Re: New Region/Map Stuff Reply to topic Reply with quote

OK, I've been away from the scene for a while due to the nations telco being pretty naff so I haven't read the docs yet, but here is something I saw while skimming through this thread:

Dr Brain wrote:
I would add a warp type. That way custom modules can use this without breaking things. And perhaps a destination rectangle rather than a destination point.
You can hack this by making the first byte of the arenaname null, then adding your own stuff in the remaining 15 chars. Also with the rectangle, would it scale if the source and destination were of different sizes? I think just a relative warp x/y is ok (like what's in the sample autowarp module), although maybe confusing.

Edit: Ok I just deleted one of my posts after reading on a bit, maybe I will make a mac exclusive editor.
Quote:
the format of a "TSET" chunk is a windows format bitmap, _without_ the
bitmapfileheader stuff (because it's function is taken care of by the
chunk header). that is, it starts with a bitmapinfoheader, which is
followed directly by the color table, which is followed directly by the
bitmap data. the bitmap data should be in 8-bit format with no
compression.
Why not an arbitrary colour depth? If you include the bitmapfileheader then it is possible to use other formats for the tileset such as png, that would save disk space (for when elvl works with no initial tileset).

Also what is the pupose of ETST? Currently you can omit the tileset and put tiles.bm2 in a lvz.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Fri Aug 13, 2004 12:30 am    Post subject: Reply to topic Reply with quote

the idea of the chunk types is that data for different modules and different purposes won't get confused. you're encouraged to create chunk types besides the predefined ones. so rAWP chunks would be for the built-in antiwarper to use, if you want extra data in chunks that have something to do with warping, it would be another type. that's much easier than doing some weird hack with the arena name field.

forgive my ignorance regarding lvz stuff: using tiles.bm2, is it possible to have different tilesets for different maps in a single zone? and is it possible to share one tileset between a bunch of different maps in the same zone?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:41
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Fri Aug 13, 2004 1:23 am    Post subject: Reply to topic Reply with quote

Grelminar wrote:
forgive my ignorance regarding lvz stuff: using tiles.bm2, is it possible to have different tilesets for different maps in a single zone? and is it possible to share one tileset between a bunch of different maps in the same zone?

Yes to both.
Back to top
View users profile Send private message Add User to Ignore List Send email
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Fri Aug 13, 2004 2:23 am    Post subject: Reply to topic Reply with quote

well, then i guess that does eliminate the need for a tileset filename in the lvl. i'll remove that stuff from the spec.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
-Smong-
Guest


Offline

PostPosted: Fri Aug 13, 2004 12:25 pm    Post subject: Reply to topic Reply with quote

When creating custom chunks, how are we supposed to know that the name/id we choose doesn't conflict with someone elses? The persist module has the same problem.
Back to top
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Thu Dec 30, 2004 10:17 pm    Post subject: Reply to topic Reply with quote

Do region subchunks have the same chunk-header as regular chunks? Furthermore, must region subchunks also be padded up to 4 byte boundries?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Fri Dec 31, 2004 2:40 am    Post subject: Reply to topic Reply with quote

Yes, and yes. My code uses the same function to parse the whole metadata section and to parse region subchunks, and I suggest you do too.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 22 page(s) served in previous 5 minutes.

phpBB Created this page in 0.439853 seconds : 41 queries executed (90.2%): GZIP compression disabled