Euflorium: The Eufloria Community
Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: pigpenguin on January 02, 2011, 04:19:26 PM
-
So I have been working on my level slowly but getting towards maybe a version i could release and I added a camera move sequence to the begging so I could show what asteroids I am talking about and now i get an error that goes like: Exception of type 'System.OutOfMemoryException' was thrown
Any one know what this is and or how to fix it?
-
Too much stuff in your map, I'd guess. Try simplifying it.
Or I might be wrong.
-
Nope, it's not too much stuff in your map. I've seen that error before, and solved it without reducing anything. It's an error in logic of some kind, I believe.
It's a very tricky one to pin down because it generally doesn't give you the line number where the error is. I think that's because it's more of an error in logic rather than syntax. Not really sure though.
If you can you PM me the code for your level in its entirety, and I'll have a look for you. :>
-
Lack of coroutine.yield?
Not relinquishing control of a loop could have that effect. (And it's a pretty easy mistake to make as a new coder)
-
I've had a look at your code.
You've placed one asteroid at coordinates 50000, 0. That would mean the quad tree would take up approxiamately 2 billion gigabytes of RAM, I think.
50000 is excessive, and is likely the cause of the problem. If you reduce it to, say, 20000, does it work then? 20000 is still really really far. If it's still not far enough, try reducing the global min and max speed of seedlings and reducing the radius of your asteroids. That should make the same distance seem further.
-
Also consider having the bulk of your level at e.g. -25000, then having your far asteroid at 25000, so that the level is centred.
-
2 billion gigs of ram.... well that would explain that and yes when i switch to 20000 it works (to be honest an extra 0 slipped its self in :P) but now the set camera target is barley moving it seems to move and hit an invisible wall... is the camera fixed to what is in your range of view?
-
Yes. Change the coordinates in your camera command to 20000 (or 5000 or whatever the asteroid position is) too. :>
Also, I just remembered... for some reason, Camera coordinates work in the negative. If you want the camera to move to an asteroid at coordinates (1000,1500), you need to tell the camera to zoom to (-1000,-1500) if you want it to focus on the asteroid.
Took me a while to figure that one out. :>
-
Hmmm thats weird with the negatives but even with them set to negative the camera goes to the right bout .2 of an inch and then goes down until it seems centered round the 0...
-
Have you used the GetAsteroid(1):Reveal(1) command to reveal asteroid ID 1 to player 1?
-
Ahhhh there would be my mistake so the camera is bound to what the player can see sweet i will plug that bit in and see how it runs :D
*edit* i threw that in and an out of memory exception was thrown :P
*edit edit* :P got rid of the error now the camera is moving to a spot how ever nothing is there its like its invisible (and i tried the SetVisible(faction,bool) and then it just didnt move :/
-
May Alex fixed the camera reverse thing. Try it with normal coordinates I guess.
-
haha it does the same things with positive coordinates :P
-
Can you post the code here or PM it to me? :>
-
Yes, he did fix negative camera stuff. It was in 2.06 or 2.07 iirc.
-
Hiya sure i will post the code haha sorry school started back up so im gonna be on less
-- Reforistization a map bye pigpenguin --
function LevelSetup()
-- Setting Global Values
Globals.G.Asteroids =(0)
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(1)
SetBackdropColour(13,110,26)
-- Asteroid 0
a = AddAsteroidWithAttribs(0,0, 0.3, 0.3, 0.9)
a.Owner = 1
a. TreeCap = 4
a:SetRadius(550)
a.SendDistance = 2500
a:AddSeedlings(10)
a.Moveable = False
s = a:AddDysonTree()
s:LevelUp()
s:Levelup()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
--Asteroid 1
a = AddAsteroidWithAttribs(50000,0, 0.9, 0.3, 0.3)
a.Owner = 0
a.Treecap = 100
a:SetRadius(1000)
a.SendDistance = 2500
a.Moveable = False
a:Reveal(1)
--Asteroid 2
a = AddAsteroidWithAttribs(2000,0, 0.7, 0.7, 0.4)
a.Owner=2
a:SetRadius(230)
a.SendDistance = 2500
end
function LevelLogic()
-- Your Mission
Timer = GetGameTime() + 3
while GetGameTime() < Timer do
coroutine.yield()
end
Pause()
MessageBox("We have a problem, to the far east is an asteroid.")
WaitDialog()
SetCameraPositionToAsteroidID(1)
MessageBox("This asteroid used to be used for harvesting. However our enemies have destroyed all the trees on it. Go forth and plant six trees to kick start its production. You have ten minutes to kickstart the regrowth or else the fertility of the asteroid will start to die. Good luck seedlings")
WaitDialog()
Unpause()
-- Win and loose dialogs
gamewon = 0
while gamewon == 0 do
coroutine.yield()
end
if gamewon == 1 then
Pause()
MessageBox("Congratulations you have restarted the growth on that planet. One day it will be a rich forest like it once was.")
WaitDialog()
Quit(True)
end
if gamewon == 2 then
Pause()
MessageBox("You have managed to loose one of the most fertile asteroids in the galaxy. Your failure is most dissapointing.")
WaitDialog()
Quit(False)
end
end
-
function LevelSetup()
-- Setting Global Values
Globals.G.Asteroids =(0)
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(1)
Globals.Asteroids.MinSendDistance=60000
Globals.Asteroids.MaxSendDistance=60000
SetBackdropColour(13,110,26)
-- Asteroid 0
a = AddAsteroidWithAttribs(-25000,0, 0.3, 0.3, 0.9)
a.Owner = 1
a. TreeCap = 4
a:SetRadius(550)
a.SendDistance = 2500
a:AddSeedlings(10)
a.Moveable = False
s = a:AddDysonTree()
s:LevelUp()
s:Levelup()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
--Asteroid 1
a = AddAsteroidWithAttribs(25000,0, 0.9, 0.3, 0.3)
a.Owner = 0
a.Treecap = 100
a:SetRadius(1000)
a.SendDistance = 2500
a.Moveable = False
a:Reveal(1)
--Asteroid 2
a = AddAsteroidWithAttribs(-23000,0, 0.7, 0.7, 0.4)
a.Owner=2
a:SetRadius(230)
a.SendDistance = 2500
end
Try this in place of your existing Function LevelSetup().
Note that the game will try to auto-adjust the send distances so that all asteroids are within reach of one another.
If you wish to force them to not be within range, declare the send distances in function LevelLogic() instead.
-
Weird now the camera doesnt move :-\
-
Right, the reason it jumps back to the starting asteroid is because you need to tell the game the player is allowed to look at the asteroid at the start. Otherwise it will try to restrict the view.
To do that, make the asteroid to the far east belong to player 1 when you're creating it in LevelSetup().
Then, as soon as LevelLogic starts, change the owner to player 0.
This code works:
function LevelSetup()
-- Setting Global Values
Globals.G.Asteroids =(0)
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(1)
Globals.Asteroids.MinSendDistance=60000
Globals.Asteroids.MaxSendDistance=60000
SetBackdropColour(13,110,26)
-- Asteroid 0
a = AddAsteroidWithAttribs(-25000,0, 0.3, 0.3, 0.9)
a.Owner = 1
a. TreeCap = 4
a:SetRadius(550)
a.SendDistance = 2500
a:AddSeedlings(10)
a.Moveable = False
s = a:AddDysonTree()
s:LevelUp()
s:Levelup()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
--Asteroid 1 - this is the one to the far east.
a = AddAsteroidWithAttribs(25000,0, 0.9, 0.3, 0.3)
a.Owner = 1
a.Treecap = 100
a:SetRadius(1000)
a.SendDistance = 2500
a.Moveable = False
a:Reveal(1)
--Asteroid 2
a = AddAsteroidWithAttribs(-23000,0, 0.7, 0.7, 0.4)
a.Owner=2
a:SetRadius(230)
a.SendDistance = 2500
end
function LevelLogic()
GetAsteroid(1).owner = 0
-- Your Mission
Timer = GetGameTime() + 3
while GetGameTime() < Timer do
coroutine.yield()
end
Pause()
MessageBox("We have a problem, to the far east is an asteroid.")
WaitDialog()
SetCameraPositionToAsteroidID(1)
MessageBox("This asteroid used to be used for harvesting. However our enemies have destroyed all the trees on it. Go forth and plant six trees to kick start its production. You have ten minutes to kickstart the regrowth or else the fertility of the asteroid will start to die. Good luck seedlings")
WaitDialog()
Unpause()
-- Win and loose dialogs
gamewon = 0
while gamewon == 0 do
coroutine.yield()
end
if gamewon == 1 then
Pause()
MessageBox("Congratulations you have restarted the growth on that planet. One day it will be a rich forest like it once was.")
WaitDialog()
Quit(True)
end
if gamewon == 2 then
Pause()
MessageBox("You have managed to loose one of the most fertile asteroids in the galaxy. Your failure is most dissapointing.")
WaitDialog()
Quit(False)
end
end
-
This map causes Eufloria to use 337 megs of ram, by the way.
That's the hazard of using extremely large coordinates. It's centred now, so that helps a lot.
Somthing to be aware of.. :>
-
haha I will try to control my obsevivly big coordinates ;D
and thanks for the help its awesome :D
-
You're welcome. :>