Euflorium: The Eufloria Community
Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: Orion63 on August 17, 2011, 09:24:45 AM
-
Why changing the Moveable variable to false(for around 24 asteroids) would increase the map's load time 72 fold(from 2 seconds to 144) ?
Anyone mind to reproduce this? Just so I can be sure it's not my windows-hating machine?
Also, if you are aware of any fix, or explanation, I will be pleased to ear it ;)
edit:Code example below:(This one is for a unknown reason still WAY faster than the last, but you can still notice quite a delay(2 seconds to 21)):
function LevelSetup()
-- Global Values
Globals.G.Asteroids=(0)
Globals.G.EnemyFactionsMin=(1)
Globals.G.EnemyFactionsMax=(1)
SetBackdropColor(18, 0, 0)
for i = 0, 20 do
a = AddAsteroid(i*100, 0)
a:SetRadius(50)
a.Moveable = false
end
end
function LevelLogic()
while GameRunning() do
coroutine.yield()
end
end
-
Yes, MoveAble = false makes it slower, I guess it'll be better just to make them all and then set their positions in LevelLogic :P
-
Yes, MoveAble = false makes it slower, I guess it'll be better just to make them all and then set their positions in LevelLogic :P
Yeah...Made a MyLevelSetup function, and made it run in LevelLogic.
I would have really liked to know why.
-
Maybe it's not that laggy? IDK...
-
Hi Orion, welcome to the forums :>
That is a very strange problem. I could understand it if setting Moveable to True was causing the lag, but setting it to False should if anything make it _more_ efficient. I will try to replicate that behaviour with your level file today, and see if I can figure something out for you. :> Watch this space !
-
Yes, MoveAble = false makes it slower...[snip]
No, Asteroid.MoveAble = false stops it loading. :P
-
It loads for me, however you're right - it takes a LONG time. Much longer than should really be required for a map that simple.
I think the problem boils down to the fact that you have a bunch of asteroids clustered very very very close together.
Consider these lines:
a = AddAsteroid(i*100, 0)
a:SetRadius(50)
Where i is a value between 0 and 20.
You will therefore end up with 21 asteroids... the first one will be at 0,0. The second will be at 100,0. The third will be at 200,0, and so on.
Each asteroid has a radius of 50. That means it has a diameter of 100. That means all the asteroids are so close together that they are actually touching!
Also, the game seems to want to make the player's asteroid larger than all the others. So what happens is that a bunch of the nearby asteroids are actually inside the player's asteroid.
I think that the closer-togetherness of the asteroids, and the asteroids-inside-asteroids, is what is causing the slowness. I don't know why it happens exactly, but from my experiments it seems that is the common denominator here.
I changed those lines as follows:
a = AddAsteroid(i*700, 0)
a:SetRadius(250)
...and it loads in a snap. :>
Hope this helps you Orion. Let us know how you get on - it's always cool to see new designers joining! :>
-
It won't load with MoveAble = false, because MoveAble is not a property of an Asteroid. Movable, however, is. I was being picky.
-
Me being morr picky: "Movable" is not a variable any asteroid haz, U must use "Moveable" :D
(http://1.bp.blogspot.com/-_bAljnoJIbw/TgQyGGH8TeI/AAAAAAAAAEg/bKBAxjN1GxA/s1600/trollface.jpg)
-
...
Already finished the project actually :P
Now just retouching some things, and gaining courage to write the map topic(boring stuff compared to programming ^^).
Actually, there a thing.
Why the heck, does the game changes the radius of a planet that is owned by you...
Something like this:
copter = AddAsteroid(0, 0)
copter:SetRadius(50)
copter.Owner = 1
Radius 50 in the example above.
copter = AddAsteroid(0, 0)
copter:SetRadius(50)
copter.Owner = 3
Bigger.... Significantly.
-
Me being morr picky: "Movable" is not a variable any asteroid haz, U must use "Moveable" :D
I guess I walked into that, didn't I...
-
Hah, indeed :)
-
Why the heck, does the game changes the radius of a planet that is owned by you...
I know not. However, you can fix it by adjusting the asteroid radius to what it _should_ be, at the start of LevelLogic.