### Author Topic: Moveable = false is slow, really slow...  (Read 1089 times)

0 Members and 1 Guest are viewing this topic.

#### Orion63

• Sapling
• Thank You
• -Given: 0
• Posts: 73
• We are the Knights who say... NI!
##### Moveable = false is slow, really slow...
« on: August 17, 2011, 01: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)):

Code: [Select]
`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 endendfunction LevelLogic()while GameRunning() do coroutine.yield()endend`
« Last Edit: August 17, 2011, 02:38:35 AM by Orion63 »

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Moveable = false is slow, really slow...
« Reply #1 on: August 17, 2011, 05:10:52 AM »
Yes, MoveAble = false makes it slower, I guess it'll be better just to make them all and then set their positions in LevelLogic

#### Orion63

• Sapling
• Thank You
• -Given: 0
• Posts: 73
• We are the Knights who say... NI!
##### Re: Moveable = false is slow, really slow...
« Reply #2 on: August 17, 2011, 05:37:25 AM »
Yes, MoveAble = false makes it slower, I guess it'll be better just to make them all and then set their positions in LevelLogic

I would have really liked to know why.

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Moveable = false is slow, really slow...
« Reply #3 on: August 17, 2011, 06:18:44 AM »
Maybe it's not that laggy? IDK...

#### annikk.exe

• Achiever
• Ent
• Thank You
• -Given: 0
• Posts: 1,794
##### Re: Moveable = false is slow, really slow...
« Reply #4 on: August 17, 2011, 08:02:13 AM »
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 !

#### Pilchard123

• Tester
• Old Oak
• Thank You
• -Given: 0
• Posts: 899
• Eufloria: Yes
##### Re: Moveable = false is slow, really slow...
« Reply #5 on: August 17, 2011, 08:13:28 AM »
Yes, MoveAble = false makes it slower...[snip]

#### annikk.exe

• Achiever
• Ent
• Thank You
• -Given: 0
• Posts: 1,794
##### Re: Moveable = false is slow, really slow...
« Reply #6 on: August 17, 2011, 04:32:13 PM »
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:

Code: [Select]
` 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:
Code: [Select]
` 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! :>

#### Pilchard123

• Tester
• Old Oak
• Thank You
• -Given: 0
• Posts: 899
• Eufloria: Yes
##### Re: Moveable = false is slow, really slow...
« Reply #7 on: August 17, 2011, 04:42:54 PM »
It won't load with MoveAble = false, because MoveAble is not a property of an Asteroid. Movable, however, is. I was being picky.

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Moveable = false is slow, really slow...
« Reply #8 on: August 17, 2011, 04:48:56 PM »
Me being morr picky: "Movable" is not a variable any asteroid haz, U must use "Moveable"

#### Orion63

• Sapling
• Thank You
• -Given: 0
• Posts: 73
• We are the Knights who say... NI!
##### Re: Moveable = false is slow, really slow...
« Reply #9 on: August 17, 2011, 05:12:16 PM »
...

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:

Code: [Select]
`copter = AddAsteroid(0, 0) copter:SetRadius(50) copter.Owner = 1`
Radius 50 in the example above.

Code: [Select]
`copter = AddAsteroid(0, 0) copter:SetRadius(50) copter.Owner = 3`
Bigger.... Significantly.
« Last Edit: August 17, 2011, 05:17:42 PM by Orion63 »

#### Pilchard123

• Tester
• Old Oak
• Thank You
• -Given: 0
• Posts: 899
• Eufloria: Yes
##### Re: Moveable = false is slow, really slow...
« Reply #10 on: August 17, 2011, 05:25:56 PM »
Me being morr picky: "Movable" is not a variable any asteroid haz, U must use "Moveable"

I guess I walked into that, didn't I...

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Moveable = false is slow, really slow...
« Reply #11 on: August 17, 2011, 05:31:56 PM »
Hah, indeed

• Achiever
• Ent
• Thank You
• -Given: 0