Announcement: Be excellent to each other.


Caravel Forum : Other Boards : Crystal Shard Games : SubTerra: Bugs, object limits ((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 SubTerra: Bugs, object limits (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

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place

[Last edited by Danjen02 at 10-25-2017 03:19 AM]
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 1 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))

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place
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: 134
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.



____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place
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: 134
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: 134
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?)

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place

[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?

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place
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: 134
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
Danjen02
Level: Roachling
Avatar
Rank Points: 11
Registered: 11-08-2007
IP: Logged
icon Re: Object Limit in SubTerra (0)  
How did you determine when and which objects (eg gems, flowstone) get to sparkle?

I made a level full of flowstone, and it seems like the sparkles appear at random; is there any logic to it? (rocks and gems appearing flipped over seems to be the only other time randomness is used).

The only thing I can tell for certain is that if you play it on the lowest speed and scroll around, sparkles will appear if you scroll them back onto screen, so there must be a finite limit and they are saved in memory somewhere

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place
10-19-2017 at 05:50 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Radiant
Level: Moderator
Avatar
Rank Points: 134
Registered: 02-05-2003
IP: Logged
icon Re: Object Limit in SubTerra (0)  
No, it's random. But sparkles are not objects (they use a separate structure) so they do not affect gameplay. Turning an object upside-down doesn't affect gameplay either.

____________________________
= Radiant =
10-19-2017 at 04:16 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: rocks.png (5 KB)
Downloaded 1 times.
License: Public Domain
icon Re: SubTerra: Bugs, object limits (0)  
Here's another bug

If any monster attempts to eat a rock in a trap from below, it will just kind of freeze up. Releasing the rock from the trap will immediately destroy them. Therefore, it's probably caused by the monster entering a "dead" state but not actually being destroyed by the rock, because the rock is inactive.

The monster is still harmful to players, and the rock can still be pushed out of the trap without a problem. Also, if a dragon approaches the rock/trap from any other direction, it will correctly eat it.

(And of course, moving under a trap and releasing the object inside it will still destroy the player)

===

Another issue: SubTerra tends to eat up CPU if it loses focus on Windows 7 Home Premium (x64). OS probably doesn't matter, though.

And a small miswording on the object behavior master list; it says that a dragon eating a bomb will be destroyed by it, while it can escape from a mine. True in most cases, but if the bomb is eg at the end of a corridor, he will bump it and turn around, and safely escape.

===

And finally, a small question:
Do most objects explode at different rates? This is the most pronounced with Cryobirds and Skelwings, but it seems that most objects are a few ticks faster or slower. I've been testing this on the slowest speed and pausing every few frames and some do finish a bit quicker.

Also, it appears that rocks can roll off of the "Explosives" object for a few ticks, while they do not do so for Bombs - does the 1x1 explosion "core" that gets created have different semantics in these cases?

===

EDIT: Oh god, I forgot all about Don't Try This At Home! (2002), and Cell Block (2003)

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place

[Last edited by Danjen02 at 10-27-2017 08:52 AM]
10-25-2017 at 03:24 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
icon Re: SubTerra: Bugs, object limits (0)  
Bug: Custom level scores get weird with extreme values

Points are hard-capped at 9,999 and are applied to the level correctly, but the end of level cosmetic display can be a little wacky when extreme values are given. In particular:

- Completing a level with 999 seconds left with a point value of 99 should award 98,901 points, but it displays a truncated 8,901 rather than a capped 9,999

- Special Bonus is applied three times (once for hard exit, once for beating the timer, and once for the hard gem quota). However, any values in excess of 3,333 will result in a large value and behave in a similar way as above.

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place
11-18-2017 at 06:52 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
icon Re: SubTerra: Bugs, object limits (0)  
BUG: When Drakes, Slimes, Spiders, and Cryobirds are beside an un-set selector tile and move away, the tile is activated and changed, without them ever actually stepping on it. They will, of course, change tiles they step over, but this particular situation seems odd.

Also, poltergeists, seekers, skelwings and movers will not trigger them, but I suppose that's known/intentional.

(I would have posted a quick level to illustrate this, but for some reason, I can't physically locate my level files in the ST folder... It's in Program Files (x86)/SubTerra/, but for some reason I can't see my user profile folder in Data, nor any levels I've created - but they show up just fine in game. :-O)

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place
11-28-2017 at 03:51 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
icon Re: SubTerra: Bugs, object limits (0)  
Possible bug:
If you have an exit tile and clone it, but collect the last gem as the cloned object is rolling out, the original exit will open, but the cloned exit will never open - it will stay closed forever.

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place
11-29-2017 at 09:39 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Radiant
Level: Moderator
Avatar
Rank Points: 134
Registered: 02-05-2003
IP: Logged
icon Re: SubTerra: Bugs, object limits (0)  
quote:
Danjen02 wrote: (I would have posted a quick level to illustrate this, but for some reason, I can't physically locate my level files in the ST folder... It's in Program Files (x86)/SubTerra/, but for some reason I can't see my user profile folder in Data, nor any levels I've created - but they show up just fine in game. :-O)


Windows 7 and up have a multilayer virtual file system. It's probably in some place like /Users/Danjen/AppData/Local/VirtualStore/Program Files/Subterra

Thanks for the info, I'll be checking these when I get back to coding Draconis.

____________________________
= Radiant =
12-04-2017 at 12:57 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: SubTerra: Bugs, object limits (0)  
Can confirm, it was in %appdata%/Local/VirtualStore/...
Weird! I know about appdata and such, but didn't know about that sort of thing.

===

If you hold shift in the editor and wiggle the mouse a bit (eg, maybe you were trying to shift-click to select a tile type), it gets kinda sluggish and laggy until you release shift

Also, if you run the game in windowed mode, the dithered/checkboard overlay used to darken certain menu backgrounds (specifically F2) only seems to stretch half way.

Also, if you hit the X to close the application entirely from this screen, the program still displays on screen, disappears from the taskbar, but still appears as a process until you kill it. Win7 professional, not sure what causes that (though I imagine you do some low level graphics stuff with the game, no?)

===

Two nonbugs, but interesting

- If you quit the editor, it will say that leaving will destroy your changes. If you go back into it from the main menu, it will still be there. If the game itself starts, eg by demo mode or playing a level, it will remove the level at that point.

- The player moves VERY SLIGHTLY faster than the camera. I suspect the position only updates when you're halfway through a movement into another tile, and the camera is one frame slower than this depending on when things get updated. You can test this by making a level full of ice and stepping down, and you should overtake the camera edge, or get very close to it by the time you bounce back.

____________________________
SubTerra
- Ultimate rank
- 2009 level design contest, 2nd place

[Last edited by Danjen02 at 12-08-2017 01:21 AM]
12-06-2017 at 12:12 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Other Boards : Crystal Shard Games : SubTerra: Bugs, object limits ((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.