Jump to content
tipforeveryone

Script memory usage explaination

Recommended Posts

I notice that the number of Script memory usage is increasing second to second.

Is it ok ? or there are somecode in my game make it increased. More explaination of this please :) Thanks

image.thumb.png.cb141165e725a83e817bfbaba983edf2.png

  • Like 1

Share this post


Link to post

Lua periodically performs a garbage collection step. You can test this by calling collectgarbage() in your main loop. However, you should normally just let Lua do this automatically when enough memory has accumulated.

  • Like 2

Share this post


Link to post

I am too not sure about this...

While I am working on rain simulation with about hundred sprites, each one attached to a box with mass, falling on the ground, collision detection occurs using a pick ray on the ground, to avoid the rain coming through a roof for example.

Well this runs OK for fps, even if it costs a few ones to run, but the ram cost increases like about 1 mb each second...not sure if Is this normal?

I added System:CollectGarbage() in the main loop but not sure if this is the right use of it ? 

Thx for any help.

 

Edit Okay you have to add as Josh said collectgarbage() and not System:CollectGarbage() !

  • Thanks 1

Share this post


Link to post

FYI, the particle system has a built-in collision detection system you can use for rain if you want to.

  • Thanks 1

Share this post


Link to post
8 hours ago, Josh said:

FYI, the particle system has a built-in collision detection system you can use for rain if you want to.

I've been testing the collision of the particles, but something strange happens, in the editor with the realtime render option enabled, the particles do collide, however when you launch the game as such, those particles don't collide.

What am I doing wrong?

Share this post


Link to post

Yes I encountered three problems with an emitter with collision turned on,

1) as yue said there are particles that just do not collide, but this seems to depend on how high and with which speed the particles are falling.

2) to simulate the rain, the particles should disappear after the collision, instead they are bouncing away after colliding, maybe I do something wrong?

3) the emitter collision detection, with many particles to make the rain, over 100 for sure is incompatible with the vegetation collision feature. Each time the rain is coming over colliding trees built with the vegetation tool, the fps are dropping to unplayable values...

Sorry this is actually no rain building thread, just wanting to add this.

  • Like 1

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...