2DWorlds Forums
This game is crashing after the first round in the editor. - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: Bug Reports (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=23)
+--- Thread: This game is crashing after the first round in the editor. (/showthread.php?tid=109)



This game is crashing after the first round in the editor. - Ghosty - 11-26-2012

It's basically a remake of my old Asteroid Dodgers (or Meteor Shower or whatever I called it) from the old site, totally redone from scratch.

I need to work on adding the final touches and some balancing to make it actually survivable, but it should be working just fine.

However, when I load it in the editor and hit play, after it completes the first round, I get a NegativeArrayException.

Code:
java.lang.NegativeArraySizeException
org.jbox2d.dynamics.Island.init(Island.java:118)
org.jbox2d.dynamics.PhysicsWorld.solve(PhysicsWorld.java:669)
org.jbox2d.dynamics.PhysicsWorld.step(PhysicsWorld.java:572)
net.worlds.World.step(World.java:736)
net.worlds.Game.step(Game.java:295)
net.worlds.Main.gameStep(Main.java:657)
net.worlds.MainApplet.run(MainApplet.java:236)
java.lang.Thread.run(Unknown Source)

Any ideas why? I'm going to try to debug it some more later, but if anyone else can help that'd be great.

http://2dworlds.org/game.php?id=31

Here's the script I believe to be the problem:

Code:
function checkWhoSurvived()
local players = game.Players:getChildren()
for q = 1, #players do
players[q].Stats.Played.Value = players[q].Stats.Played.Value + 1
if players[q].Alive.Value == true then
players[q].Stats.Survived.Value = players[q].Stats.Survived.Value + 1
else
players[q].Alive.Value = true
end
end
end

function redoWorld()
local spawn = game.World:getChild("Spawn")
local players = game.Players:getChildren()
for w = 1, #players do
if players[w].Character ~= nil then
players[w].Character.Body.Position = spawn.Position
end
end
game.Terrain:generate()
end

function ticky(top, num)
for z = 1, num do
local players = game.Players:getChildren()
for x = 1, #players do
players[x]:message(tostring(top - z))
end
sleep(1)
end
local players = game.Players:getChildren()
for c = 1, #players do
players[c]:message()
end
end

function cleanup()
local parts = game.World:getChildren()
for y = 1, #parts do
if parts[y]:isA("Circle") and string.sub(parts[y].Name, 1, 6) == "Meteor" then
parts[y]:remove()
end
end
end

while true do
game.World.BGM:stop()
game.World.Meteors.Create.Value = false
cleanup()
redoWorld()
local players = game.Players:getChildren()
for e = 1, #players do
players[e]:message("Beginning new round!")
players[e].Alive.Value = true
end
sleep(4)
for r = 1, #players do
players[r]:message()
end
game.World.BGM:play()
game.World.Meteors.Create.Value = true
ticky(140, 140)
checkWhoSurvived()
end

The game freezes, and then the music begins to play again. So I suspect the problem is somewhere here:


game.World.BGM:play()
game.World.Meteors.Create.Value = true
ticky(140, 140)



EDIT: It is also now crashing with this error at other times as well.


RE: This game is crashing after the first round in the editor. - Ghosty - 12-07-2012

At some point in the past week or two, this bug seems to have been fixed. Thanks, Jacob!


RE: This game is crashing after the first round in the editor. - Ghosty - 12-16-2012

It's back. :/ Same error, and like before, only happens at the end of the first round.