Announcement: Be excellent to each other.


Caravel Forum : Other Boards : Crystal Shard Games : Object Limit in SubTerra (And other technical details)
New Topic New Poll Post Reply
Poster Message
Danjen02
Level: Roachling
Avatar
Rank Points: 11
Registered: 11-08-2007
IP: Logged
icon Object Limit in SubTerra (0)  
I was randomly mucking around in the editor the other and noticed that levels appear to be 127x127 at maximum size and not 128x128 (for 16,384 versus 16,129 tiles). Is there a particular reason for that?

I also noticed the game seems to have an object limit of 2,000 objects (again, not 2,048) for some reason. I suppose you had to cap it back in 2003 to some sane limit for technical reasons, but I noticed that interesting things can happen (for example, suppressing explosions) if there are too many active objects. (EDIT: With further poking, it looks like it might just be a graphical limit. Filling the level with rocks seems to stop them from falling, but again the first 2,000 are drawn. However, if the player isn't within the first 2,000 objects, the level won't even start)

I saw in one of the bug fixes in the in-game patch notes that objects are able to mark tiles as they move into them. In the case of two rocks that want to roll into the same tile, it seems like the rightmost rock is given priority. Why is that? I would think that the left rock would have priority because it would be processed first, then mark the tile and move into it; does the right rock overwrite the marking, or does the "roll left" have a higher priority?

Also, is there a technical reason for Skelwings and Cryobirds to explode so fast, or is that just "what they do"? It's not instantaneous, but it seems that the explosion speed propagates at about 1 frame apart, instead of the healthy delay that other normal explosions happen at.

Also also, I happened to take a peek at level data, and saw that it looks like it has a checksum and hashed stuff going on behind the scenes. :whistle

____________________________
2nd place winner of Subterra's 2009 level design contest, and proud Ultimate ranked player

[Last edited by Danjen02 at 05-18-2017 07:47 PM]
05-18-2017 at 09:54 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Danjen02
Level: Roachling
Avatar
Rank Points: 11
Registered: 11-08-2007
IP: Logged

File: expl.SUB (498 bytes)
Downloaded 0 times.
License: Public Domain
icon Re: Object Limit in SubTerra (0)  
Here's something else that I found kind of fun.

If my counting was accurate, there are 635 Cyrobirds along the bottom path, and 22 Slimes on the top path. They are synchronized so that they both reach the end at the same time (since lasers seem to only exist for a few frames). Any other configuration resulted in the top, then bottom firing a split second later, or vice versa. (For example, you can't move the flowstone up and add a bird there, but then also move the ruby down to compensate; this results in the timing being wrong. I think this has to do with the order that objects are processed (which I assume is from left to right, in descending rows))

So with the ratio of 635:22, it's about 29 frames faster than a regular explosion (plus or minus a frame, depending on what the game engine does (eg, it might rest for a frame on creation or what not))

____________________________
2nd place winner of Subterra's 2009 level design contest, and proud Ultimate ranked player
05-18-2017 at 10:16 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Radiant
Level: Moderator
Avatar
Rank Points: 133
Registered: 02-05-2003
IP: Logged
icon Re: Object Limit in SubTerra (0)  
Hi Danjen, nice to see you!

The level is sized 128x128 (because left-shifts are faster than multiplication), however the 128th tile is locked as an impassible wall. This means that for movement I only need to check the next tile, I don't need to check for running off the map. The object limit is indeed for performance reasons; I think it started at 1000 and then I doubled it after making a level that hit the cap. It counts mobile objects only, and is not a graphical limit; objects beyond 2000 simply won't spawn, and if there is no player spawned, the level will abort.

And yes, for each tile the game keeps track of what object is there, so I can find it quickly without having to iterate over 2000 objects every time. For example, if a rock lands on anything, it'll send a 'thud' signal to the item below without even checking what it is. Then when the signalled item is handled, it'll react accordingly. Objects cannot override one another (because that would make it impossible to signal the first object). Finally, things explode at different speeds in order to spread out tough calculations so they don't all occur on the same frame.


____________________________
= Radiant =
05-18-2017 at 11:33 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts Quote Reply
Danjen02
Level: Roachling
Avatar
Rank Points: 11
Registered: 11-08-2007
IP: Logged
icon Re: Object Limit in SubTerra (0)  
Hi :)

I only ask about the "overriding" (which you said doesn't happen) because of some cases I can't figure out.

Specifically, two rocks both trying to roll into the same tile, and a rock above a balloon, both trying to enter the same tile. In both cases, the bottom/right object wins. My assumption was that the top/left objects are processed first (0..n), and that they would then mark the appropriate tile, leaving the bottom/right object to wait, but it seems to occur the exact opposite way.



____________________________
2nd place winner of Subterra's 2009 level design contest, and proud Ultimate ranked player
05-19-2017 at 12:37 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Radiant
Level: Moderator
Avatar
Rank Points: 133
Registered: 02-05-2003
IP: Logged
icon Re: Object Limit in SubTerra (0)  
Precisely. So this shows that your assumption is incorrect and items are actually handled last-to-first. The main reason for this is that newly-spawned objects are handled the next clock tick instead of immediately.

____________________________
= Radiant =
05-19-2017 at 11:09 AM
View Profile Send Private Message to User Visit Homepage Show all user's posts Quote Reply
Radiant
Level: Moderator
Avatar
Rank Points: 133
Registered: 02-05-2003
IP: Logged
icon Re: Object Limit in SubTerra (0)  
I'm sure you've seen our Greenlight by now? If you are in contact with any other old fans, please spread the word!

https://steamcommunity.com/sharedfiles/filedetails/?id=864103923

____________________________
= Radiant =
05-19-2017 at 04:20 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts Quote Reply
Danjen02
Level: Roachling
Avatar
Rank Points: 11
Registered: 11-08-2007
IP: Logged

File: cloner bug.SUB (354 bytes)
Downloaded 1 times.
License: Public Domain
icon Re: Object Limit in SubTerra (0)  
Ah yes, I do believe I already wishlisted it or upvoted it or whatever Greenlight wants me to do. I don't think I talk to anyone else from here, though.

I did find something neat that confirms what you said (not that I doubt you, of course).
If you have a rock pit set up like this, B will end up in the pit (because its processed in the order of [n..0]):
A   B   A
╗   ╔   ╗ B ╔
╚═══╝   ╚═══╝

But! If an object obstructs the middle and is cleared away, then A will end up in the pit. Again, this is because the right rock gets processed first, can't do anything and remains stationary. The middle object updates, and goes away (whether its a switched wall, the player, or dirt, whatever); finally the leftmost rock will see the space is cleared and then roll into place.
A ? B       B
╗   ╔   ╗ A ╔
╚═══╝   ╚═══╝

If you chain cloners which face down or right, and press a clone all button, you can clone the entire row at once.
It doesn't work for left or upward facing ones, which appear one new object at a time (because of the "seek right" behavior that certain buttons and portals exhibit)
A >   >   >   >   >   >
A > A > A > A > A > A > A

  <   <   <   <   <   < B
  <   <   <   <   < B < B

And speaking of cloners, certain cloned objects which are normally unmovable can be actually moved if cloned onto a motion field. In particular, dirt. Because walls aren't "objects" and don't count towards the object limit, does this mean that freshly-cloned objects are a dummy object that looks like something else while in transit? The dirt behaves normally once stopped, and transforms the tile appropriately.

One last thing I found that is an actual bug(!). If you clone a steel wall into a laser beam, the laser is blocked - but it's because it's hitting an invisible object and the laser disintegration animation is constantly looped (this is why I thought about dummy objects, above).

I attached a level file, if you'd like. What I did was hit the clone button, then press the button to toggle the laser. This ends up creating an invincible tile. Turning the laser back on will not remove it, nor will an explosion. It behaves just fine once the cloner is destroyed, though. (is this a case of bad tile marking?)

____________________________
2nd place winner of Subterra's 2009 level design contest, and proud Ultimate ranked player

[Last edited by Danjen02 at 05-19-2017 11:48 PM]
05-19-2017 at 11:44 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Danjen02
Level: Roachling
Avatar
Rank Points: 11
Registered: 11-08-2007
IP: Logged
icon Re: Object Limit in SubTerra (0)  
Are you using some of compression on the level files? I reckon that if there are 240 objects in the editor, and the maximum size is 128x128, with 8 bits per tile, then a fully sized level should be about 16kb if I'm not mistaken, yet they come in at around 2kb in size.

Another thing I'm curious about is how savedisks work. I assume that the replays are based on a tinestamp vs input change; would loading from a savedisk save the exact gamestate, or does it silently replay the level until it reaches the frame the disk was taken?

____________________________
2nd place winner of Subterra's 2009 level design contest, and proud Ultimate ranked player
06-15-2017 at 09:01 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Radiant
Level: Moderator
Avatar
Rank Points: 133
Registered: 02-05-2003
IP: Logged
icon Re: Object Limit in SubTerra (0)  
Thanks for the bug report, I'll fix that before the Steam release.

Yes, level files are compressed. This is mainly because the demo can get rather lengthy. And yes, restarting from a save disk replays the entire level. This uses the same system as demo recording, and can be used to test the integrity of level files against engine changes. It's a testament to coding optimization that the engine can replay a large level in about half a second, on computers of over a decade ago :)

____________________________
= Radiant =
06-19-2017 at 05:52 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Other Boards : Crystal Shard Games : Object Limit in SubTerra (And other technical details)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.