Author Topic: Possible Bug?  (Read 5118 times)

Mihhaelo

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 67
Possible Bug?
« on: July 13, 2010, 10:03:07 AM »
The game always ends up crashing after about 30 seconds with the code at the bottom. Changing the Owner of the Asteroid to the computer player prevents the bug (With no tree's or tree-slots). Any idea's of how to prevent the bug? The map i'm working on requires enemy seedlings to be spawned onto player asteroids.

(click to show/hide)

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Possible Bug?
« Reply #1 on: July 13, 2010, 05:04:58 PM »
need to move the coroutine.yield() to the end of the while loop, like this: (I think)

Quote
Code: [Select]
function LevelLogic()
     while GameRunning() do
          Timer = GetGameTime()                 
          if LoopTime < Timer then
               GetAsteroid(0):AddSeedlings(1,2,1,1,1)
               LoopTime = LoopTime + 1
          end
     coroutine.yield()
     end
end

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Possible Bug?
« Reply #2 on: July 13, 2010, 05:32:20 PM »
Pilchard is correct.  :>

Mihhaelo

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 67
Re: Possible Bug?
« Reply #3 on: July 13, 2010, 08:51:26 PM »
Naw, still doesn't work, it's still doing what it done last night. Thanks for the suggestion though.

The map runs for about 30 seconds and then crashes. I think the AI code might be trying to make the seedlings do something they can't actually do?

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Possible Bug?
« Reply #4 on: July 13, 2010, 09:32:05 PM »
I think I know the problem...just checking if I'm right.

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Possible Bug?
« Reply #5 on: July 13, 2010, 09:47:44 PM »
Could you post the whole level code, or PM me with it? I won't leak it, I promise! I think I've worked it out, but need to see the whole level to be certain.

Mihhaelo

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 67
Re: Possible Bug?
« Reply #6 on: July 13, 2010, 10:36:09 PM »
That's the whole of the example level i made to show the bug.
(click to show/hide)

Mihhaelo

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 67
Re: Possible Bug?
« Reply #7 on: July 13, 2010, 10:44:23 PM »
You can also induce the bug, by planting a tree onto a planet that does not belong to you. You can use the following code to explore that.

(click to show/hide)

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 14
  • Posts: 1,035
Re: Possible Bug?
« Reply #8 on: July 13, 2010, 10:58:15 PM »
Thanks for this, I've fixed a bug in the army code when the enemy AI tries to organise an army on one of its zero owned asteroids.

I will look into the new one you just posted. edit: Ah it's probably the same thing - after your tree takes over the asteroid the enemy has no asteroids left but still tries to set up an army onto one.

BTW your example above is great for getting one of the new achievements :)

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Possible Bug?
« Reply #9 on: July 13, 2010, 11:23:02 PM »
(click to show/hide)

Won't work. There isn't even a second empire, so that may be the problem.

EDIT: The second one gives me no trouble at all. Are you sure it causes the bug?
« Last Edit: July 13, 2010, 11:27:24 PM by Pilchard123 »

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 14
  • Posts: 1,035
Re: Possible Bug?
« Reply #10 on: July 13, 2010, 11:30:26 PM »
Working fine here. Seems solved.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Possible Bug?
« Reply #11 on: July 14, 2010, 06:09:30 PM »
I always put my coroutine.yield() right before the "end" statement that closes off the While loop.
Would suggest that as a best practice, rather than slipping it in haphazardly somewhere inside the loop.