question-circle Why is there a limit to the number of datablock/object/etc. being loaded ingame?

  • Posts: 41
  • Thank you received: 13
31 Oct 2026 04:21 #1
Currently, there is a strict limit to the number of datablocks can ever be loaded during one gameplay session (i. e. the session until the player quits the game). I remember that it used to be 1024 datablocks before it was increased to 4096 during an update, however even 4096 datablocks may not be enough for large projects that require thousands, or even tens of thousands of custom datablocks. In addition, even after selecting a different level the datablocks in the previous level will stay loaded, so that the datablock count accumulates for each level loaded, which can also hit the 4096 limit if enough custom code levels were loaded during one gameplay session. Once this happens, the game instantly crashes (the literally annoying "PQ Crashed!"), which does not make any sense.

Same case for the number of objects being able to be loaded per level. I think the limit is way bigger than that, but it may be still less than 10,000 before the update that also increased the datablocks limit. When I was creating a custom level based off of the level 'Outpost' in Stop Deluxe, I noticed that my marble and some other object models disappear after placing thousands of objects (especially decorative trees, rocks, flowers, plants, etc.), so that may be the limit. On a side note, the level that I'm making contains around 1365 objects (hope the hard limit is at least 3000 or so), most of them being static shapes and TSStatics.

So, why is this really the case? Are such game engine limitations a thing in the first place?

Please Log in or Create an account to join the conversation.

  • Go'way
  • Go'way's Avatar
  • Offline
  • Beginner Marbler
  • Beginner Marbler
  • Blender Enthusiast
  • Posts: 62
  • Thank you received: 45
31 Oct 2026 04:44 #2
it sounds like they didn't bother with the effort of making a system for unloading datablocks that are no longer in use when they made Torque, they probably assumed that a single game would only define the datablocks it needed throughout the whole game, and that 1024 was a good upper limit.

the update to PQ simply increased the amount of datablocks the engine allocates, i don't think it introduced any mechanism for removing unused ones, which is understandable since i imagine that's a fair bit more involved than adding a couple zeros to a number.

there is also a second limit of individual objects in a single level, regardless of how many unique datablocks those objects encompass (think, 1000 superspeeds in a single level, that only uses 1 datablock) 

Owen Maitzen 1997-2021
The following user(s) said Thank You: Keppy, SummerArmy

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 13
31 Oct 2026 06:56 #3
I also have no idea why all of such numbers are in powers of 2 (1024 = 2^10, 4096 = 2^12, etc). Is it just a coincidence or really some technical aspects involved with the game's engine?

also, the more objects I have in the level, the laggier the game. I got 40 (iirc) fps while making my level with over 1,300 objects or so. I'm sure that the final version will have like 2,300 or more, so the gameplay footage would be more and more choppy with the number of objects increasing. I should find a way to increase the framerate even with that many object count.

Please Log in or Create an account to join the conversation.

  • RandomityGuy
  • RandomityGuy's Avatar
  • Offline
  • Administrator
  • Administrator
  • This entire place is bruh
  • Posts: 518
  • Thank you received: 216
31 Oct 2026 14:02 - 31 Oct 2026 14:03 #4
The limits are because the game supports multiplayer networking out of the box. Whenever a client joins a host's game, the datablocks that the host has defined get transmitted to the client in a very efficient way, trying to minimize the number of bits used to transmit each data. Each datablock has an id and during the engine's development, they made an assumption that you'd only need a small number of bits to store that id and most real games wouldn't hit that limit (those who did can always recompile the engine to increase the limit). Additionally, there is also a limit for how many objects can be in a scene as well for similar reasons, since these objects need their state to be synchronized across the network, they too have an id that they share on both ends, and have a certain number of maximum bits used to transmit it.
As for unloading datablocks, custom levels should have code that deletes the datablocks that it has defined in its mis file after it has been unloaded.

Github:
github.com/RandomityGuy
Feel free to support me at ko-fi.com/randomityguy
Last edit: 31 Oct 2026 14:03 by RandomityGuy.

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 13
31 Oct 2026 23:44 #5
The Speculation for the datablock/object limits

I think the old limit used to be 1024 datablocks and 65,536 objects. The reason could be that of the allocated 32 bits, 10 are used for datablocks, and 16 are used for objects. The other 6 bits may have some special purposes that were potentially used in other Torque games.


Some other stuff regarding custom code levels and how datablocks are managed

Oh really?! Do I have to manually get rid of the custom datablocks after unloading the mission? I don't think it is really necessary, since a lot of custom code levels (including mine) don't do so. I think it's also the reason why the custom code levels (even just custom frictions) cannot be played while online, since such custom code persists even after playing more levels but before unloading the entire game session. I think removing the datablocks and loading it again every time the level is (un)loaded seems like a hard work for the CPU/RAM (can potentially lead into an Out-Of-Memory BSoD or a game crash to say at least?), instead having the datablocks stay loaded (most custom code levels simply do that) seems to be lighter.

Playing custom code levels SHOULD be allowed though. Colored username might have been possible before the integration with Marbleland (as back then only the official, bonus, and leaderboard custom levels' platinum/gold times were required), but as of now it is no longer possible to obtain (can't even play some of the marbleland levels). Good thing that people who already obtained the colored name won't lose it even when more levels have been uploaded. I was about to say this, but ok, only official levels are required for the colored name... wait aren't custom levels LEVELS nonetheless?

Ok, my levels are beyond the general aspects of PQ now. instead of being just custom levels it nearly feels like an entirely new marble game. This is also probably why each level takes like months to create. I'm also afraid of such custom codes being another vulnerability of security. Will it be able to delete pretty much ANY file in the computer?

Please Log in or Create an account to join the conversation.

  • RandomityGuy
  • RandomityGuy's Avatar
  • Offline
  • Administrator
  • Administrator
  • This entire place is bruh
  • Posts: 518
  • Thank you received: 216
31 Oct 2026 23:57 #6
Yes, the 10 bits for datablocks is right on the mark for the old limit. The old object limit was also 10 bits or 1024. The remaining "bits" are used to stuff other data about the object.
It is recommended to get rid of custom datablocks after unloading the mission but it is a practice that people unfortunately don't follow (not their fault they aren't aware of it). And don't worry about the CPU/RAM usage, you're actually doing it a favor by free-ing more memory so the game crashes even less.

Custom code levels will not be allowed while playing Online because you cannot trust the code to not mess with the leaderboards or leak outside of the said level. Custom levels are not official levels so they are not required for colored username, you just answered it yourself!

Don't even think about putting code to delete a user's files on their computer, such levels will be taken down the moment it gets noticed.

Github:
github.com/RandomityGuy
Feel free to support me at ko-fi.com/randomityguy

Please Log in or Create an account to join the conversation.

  • Go'way
  • Go'way's Avatar
  • Offline
  • Beginner Marbler
  • Beginner Marbler
  • Blender Enthusiast
  • Posts: 62
  • Thank you received: 45
01 Nov 2026 00:38 #7
how extensive is the update level feature on Marbleland? i might want to update my customs that use datablocks since i knew that they don't get unloaded (in fact they spam the console with errors) but i wasnt aware how to remove them before i decided to finish the level

Owen Maitzen 1997-2021

Please Log in or Create an account to join the conversation.

  • RandomityGuy
  • RandomityGuy's Avatar
  • Offline
  • Administrator
  • Administrator
  • This entire place is bruh
  • Posts: 518
  • Thank you received: 216
01 Nov 2026 01:01 #8
It lets you replace the mis file while preserving existing scores. You just need to call the .delete() method on the datablocks to "unload" them.

Github:
github.com/RandomityGuy
Feel free to support me at ko-fi.com/randomityguy

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 13
01 Nov 2026 05:38 #9
Unfortunately, if I want to remove the datablocks after unloding the level I have to insert such code to all of my previous levels. I think nearhic nimefract and beyond all have the same problem. Marbleland still allows people to play old versions of levels even after updating them, that is.

Also, if there is some code to remove the datablocks on level unload, the code itself does take the space of the .mis file and it is possible for the mission file (zip) to exceed the 100MB limit.

Please Log in or Create an account to join the conversation.

  • Posts: 518
  • Thank you received: 288
01 Nov 2026 14:15 #10
WHY do you want to make thousands of datablocks?
WHY would you make a 100 MB .mis file?

And WHY does reverse-engineered PQ allow any level to delete whatever file it wants? On the bright side I guess that means I can delete deprecated files from older versions of my levels . . . ? At that point we may as well make self-updating levels.

Please Log in or Create an account to join the conversation.

  • RandomityGuy
  • RandomityGuy's Avatar
  • Offline
  • Administrator
  • Administrator
  • This entire place is bruh
  • Posts: 518
  • Thank you received: 216
01 Nov 2026 14:25 #11

Please Log in or Create an account to join the conversation.

  • Posts: 518
  • Thank you received: 288
01 Nov 2026 17:17 - 01 Nov 2026 17:18 #12
I understand that, but why is any level still allowed to use it? Is the risk thought to be too low to worry about?
Last edit: 01 Nov 2026 17:18 by Weather.

Please Log in or Create an account to join the conversation.

  • RandomityGuy
  • RandomityGuy's Avatar
  • Offline
  • Administrator
  • Administrator
  • This entire place is bruh
  • Posts: 518
  • Thank you received: 216
01 Nov 2026 17:39 #13
Its an unintended consequence of how torque loads mis files, by just directly exec()-ing them which is just overall bad security at the benefit of custom mis-mod levels. At some point during the PQ development, there were checks added in where it scans the mis file for such malicious code and warns the user of it. It was also added to Marbleland as well but seems like it was removed later on from both PQ and Marbleland because it kept flagging certain mis-mod levels as malicious when they were not, as well as its implementation not being very performant. Also it was easy to bypass the filter anyways because of eval()

Github:
github.com/RandomityGuy
Feel free to support me at ko-fi.com/randomityguy

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 13
10 Nov 2026 10:51 - 10 Nov 2026 10:53 #14
About the benefits and disadventages of removing datablocks once the level has been unloaded

While removing the datablocks from the memory after the level has been unloaded seems a good idea, it may not really be meaningful in terms of avoiding unexpected crashes after loading enough custom code levels.

Suppose there are three custom code levels: "Level A" which removes the datablocks after unloading, "Level B" which also does that, and "Level C" which does not remove the datablocks after unloading.

Let's assume that "Level A"(Cite note 1: 'Level A' can also or only be correct instead, see below) has been unloaded, and "Level B" was loaded and unloaded, and then "Level C" has been loaded thereafter. The datablocks for that "Level A" and "Level B" are now gone, and only the datablocks for "Level C" are currently loaded. But once the same "Level A" has been loaded ("Level C"'s datablocks are still there!), different scenarios can happen depending on the way the game's engine handles the spots that the removed "Level A" and "Level B"'s datablocks were.
  • Scenario 1: Level A's datablocks will be loaded back, but they can't occupy the spaces that the two previous load sessions (now unloaded Level A and Level B) have once occupied. In this case, the now-unloaded datablock spaces will not be able to be retrieved by any of the datablocks loaded in the future (even the reloaded Level A's datablocks, which are identical with the unloaded session but counted as a distinct set of datablocks). The reloaded Level A's datablocks will be loaded into the spaces after the Level C's datablocks. Think of how Gmail addresses cannot be reused by anyone even after the owner(s) remove their Google account. The datablock memory space after reloading Level A would be like: (lowercase letters show the spaces whose datablock got removed but cannot be used again) aaaabbCAAAA
  • Scenario 2: Level A's datablocks are reloaded exactly in the space that the unloaded session of Level A used to occupy: (non-bolded black lowercase show datablocks space that are reserved for reloading the datablocks that once loaded) AAAA -> aaaaBB -> aaaabbC -> AAAAbbC. Loading Level B at this moment would turn this to aaaaBBC. This, however, may not be properly implemented in Torque, as it requires a seperated memory-managing agenda for the reserved spots in the datablock memory.
  • Scenario 3: The spaces for unloaded levels A and B are completely free: any kind of datablock may enter that area. However, since the datablock for Level C hasn't been unloaded, it may still reside in the memory space that Level C took upon loading Level C for the first time. So, loading the levels A, B and C in order would cause the memory space to look like that: ('x' represents the completely free datablock spaces) xxxxxxC. Loading Level B in that case would be BBxxxxC, and loading Level A would be AAAAxxC. However, loading Level D that uses 7 datablocks is a different story: It can be either DDDDDDCD or xxxxxxCDDDDDDD.
  • Scenario 4: The spaces for unloaded levels A and B are simply removed and Level C's datablocks instantly take the spot, which would be just the single letter C in the memory. Think of some books at the bottom of the stack are taken, and the top-most book falls due to gravity. Loading Level A at this point would become CAAAA.
Of these four scenarios, 4 is definitely the best case in terms of memory management. 3 can also be the best assuming that every custom code level removes the datablock after unloading them. 1 and 2... well not so much, as the datablock spaces are wasted regardless of whether they are unloaded or not.

Also, in case of my levels after Nearhic Nimefract, a lot of compilcated custom codes are put into them, so i guess i don't really unload them? Like, if they use global variables they may get reset or messed up when the level has been loaded the second time, which reloads the already-loaded datablocks. Oh and... do global variables take memory space like datablocks or objects?

No generative AI was used at writing this reply. It's always best to just use our human brain.

(Footnote 1: I have no idea whether to use "this" or 'this' set of quotes, i think the former is correct in like 53% of all the landmasses for countries that speaks English, but in some geographic regions the latter may be also, or even exclusively correct)
Last edit: 10 Nov 2026 10:53 by SummerArmy.

Please Log in or Create an account to join the conversation.

  • RandomityGuy
  • RandomityGuy's Avatar
  • Offline
  • Administrator
  • Administrator
  • This entire place is bruh
  • Posts: 518
  • Thank you received: 216
10 Nov 2026 10:57 - 10 Nov 2026 10:59 #15
Unfortunately, it is the worst case scenario, PQ handles it exactly like the Scenario 1 that you described. The memory is freed though, but the ID numbers of the datablocks never get reused, so you end up having various ID numbers that point to objects that do not exist.

Github:
github.com/RandomityGuy
Feel free to support me at ko-fi.com/randomityguy
Last edit: 10 Nov 2026 10:59 by RandomityGuy.

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 13
11 Nov 2026 01:08 #16
So, technically, it is always best to leave the datablocks stay loaded (like how most of the custom code levels do that, or Level C in the example above) without unloading them even after unloading the level. I guess the datablocks don't get new IDs once they are loaded again if they are already loaded. This way, re-loading the same level over and over again will not result in 'PQ Crashed!'.

(still, no idea whether to use 'single quotation' or "double quotation". The former is assumed to be used in approximately 47% of all regions that speak English. The latter is used in the other 53%. I guess I will use the latter as it is used more.)

Please Log in or Create an account to join the conversation.

  • RandomityGuy
  • RandomityGuy's Avatar
  • Offline
  • Administrator
  • Administrator
  • This entire place is bruh
  • Posts: 518
  • Thank you received: 216
11 Nov 2026 09:41 #17
It'll still create new duplicate datablocks if you don't unload them, whenever you load the level

Github:
github.com/RandomityGuy
Feel free to support me at ko-fi.com/randomityguy

Please Log in or Create an account to join the conversation.

Moderators: Doomblah
Time to create page: 0.414 seconds
We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.