Uberubert
|
  |
| Joined: 07 Dec 2007 |
| Total Posts: 191 |
|
|
| 25 Jan 2008 08:27 PM |
My places "Uberuberts Stupid Adventure" and "Bread Factory Tycoon" both have a problem with crashing after a certain amount of time. I have no idea what causes this. There are a few scripts on the adventure one, and lots of scripts on the bread factory tycoon. I've tried making sure they don't have errors, or try to do stuff that isn't possible (like cloning stuff that doesn't exist etc). Both maps involve lots of block-creation and cloning, so I'm thinking that might be the cause. Maybe the server cant take the pressure of constantly cloning objects...?
When I test the bread factory on my computer, it plays normally until I exit the test. Then I get a crash-error. Some people have reported that they think the crashes are involved with people leaving the place. (And yes, I've made sure scripts don't remove game.Workspace^^, which is the only crash thing I know about)
Anyone have any idea of anything that can cause crashes? I'm just stumped, and have no idea what to look for... :(
(when making wc3 maps, there was constant talk of memory-leaks.. Are these something to look for here? And how do I remove them in that case? How to avoid them) |
|
|
| Report Abuse |
|
|
gtbot
|
  |
 |
| Joined: 17 Aug 2007 |
| Total Posts: 5618 |
|
|
| 26 Jan 2008 05:57 PM |
Removing the Workspace isn't the ONLY way you can crash the game. There are ALOT of ways there can be a crash, but alot of them aren't fixed, has the admins don't think that what happened will happen.
It's possible that when you leave, and a new brick is made (bread), it can crash. |
|
|
| Report Abuse |
|
|
Uberubert
|
  |
| Joined: 07 Dec 2007 |
| Total Posts: 191 |
|
|
| 27 Jan 2008 06:50 AM |
hmm, yeah, maybe a new brick is made while the factory resets or something..
I managed to remove the crash from the "stupid adventure" place. (Atleast it seems I did..). I discovered I had copied a brick with a touch-connect script in it, and used it as scenery. This led to it being like 30+ scripts with a touch-connection to the same brick. I deleted all those scripts, and the game no longer crashes (atleast seemingly..) |
|
|
| Report Abuse |
|
|
Aeacus
|
  |
| Joined: 20 Dec 2007 |
| Total Posts: 1006 |
|
|
| 27 Jan 2008 08:33 AM |
I've never used the "Garbage Cleanup" system in LUA, however I do know that when an object is no longer in use, lua removes it, and puts it in the "garbage"
Since you are using so many bricks that are removed after a short while, a problem with the "Garbage" system may be occuring. Maybe there is a limit, and your bricks are exceeding it?
Here is a brief tutorial on the collection system. I haven't read it yet, so I don't know if it will help, but it's worth a try :)
http://lua-users.org/wiki/GarbageCollectionTutorial |
|
|
| Report Abuse |
|
|
Uberubert
|
  |
| Joined: 07 Dec 2007 |
| Total Posts: 191 |
|
|
| 27 Jan 2008 12:37 PM |
Quote: "About the objects stored within local variables: at the moment the local variable is no longer active the GC may collect the object that was stored there. The actual freeing of the object has nothing to do with function scopes or variable live times. The GC runs at certain times and frees all objects that are no longer accessible by any L"
Does this mean that objectvalues stored in local variables are sometimes not collected when the object is turned into "garbage" ? I may or may not have put an excessive number of objects into local variables for reason not even known to myself ... |
|
|
| Report Abuse |
|
|
Aeacus
|
  |
| Joined: 20 Dec 2007 |
| Total Posts: 1006 |
|
|
| 27 Jan 2008 01:58 PM |
| I think that means that any local variables that are not being accessed at the time of the collection, are removed. So if you had something important in a local variable, however it was not being accessed at the time of the collection, it would be removed, hence possibly ruining other scripts, and freezing the game. |
|
|
| Report Abuse |
|
|
Uberubert
|
  |
| Joined: 07 Dec 2007 |
| Total Posts: 191 |
|
|
| 27 Jan 2008 03:26 PM |
I think I have an idea as to what is going in. At the start of the game, I store alot of object in ObjectValue-objects. Then in some scripts I have it goes something like this: (short pseudocode-ish summary of a script attached to a brick which functions as a button) --------- Listen for touchers and call onTouched function
function ontouched start Declare local variable and store clone of object from ObjectValue in it Give new cloned object a parent to put the object in the game end ontouched function
--------
from what I can understand (I think), when the funtion ends, the local variable is removed, and the garbage collector then removes that value (the new object... oh god, ALL objects in my case (except workspace and other important stuff))...?
How often is the GC run? Like once every 10 seconds? once an hour? whenever it's needed? Or a little now and then? The bread factory crashes randomly from 10 minutes into the game to maybe even 2 hours...
/end Brainramblings |
|
|
| Report Abuse |
|
|
Aeacus
|
  |
| Joined: 20 Dec 2007 |
| Total Posts: 1006 |
|
|
| 27 Jan 2008 04:06 PM |
I'm not positive, but after reading a bit on the topic, it seems as if the garbage is collected whenever the process starts using excess amounts of memory. In this case, most likely when many pieces of bread or water are spawned in a short period.
I looked into it, and I can't find any method to directly change the interval between collections. |
|
|
| Report Abuse |
|
|
Uberubert
|
  |
| Joined: 07 Dec 2007 |
| Total Posts: 191 |
|
|
| 27 Jan 2008 04:59 PM |
I tried removing lots of Local declarations related to object-storing variables now, the game runs just the same still. Still crashes on my comp on exit, but havent tested for disconnects online... (uploaded).
Could simply be that the place hogs too much memory from all those objects I'm saving for spawning etc... Then at some point the memory is full or a limit is reached, and *boom* insta-shutdown... I should probably try to make the place less memory-hogging if I wanna try to remove the crashes...
I dunno.. I'm no expert on this at all, just a wannabe-programmer with a thing for scripting physics + lego games.. (are there ANY better combination? unlimited legos, AND you can blow it up near-realisticly! :D) |
|
|
| Report Abuse |
|
|
WWCFox2
|
  |
| Joined: 11 Mar 2007 |
| Total Posts: 774 |
|
| |
|