Author Topic: Bugs thrown up by the gravity engine  (Read 5358 times)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Bugs thrown up by the gravity engine
« on: April 26, 2010, 08:12:37 AM »
First up, I badly need a way to increase the maximum size of the level :/

I am getting problems like asteroids "dying" (going black and unusable/unclickable) when they orbit into certain areas of the level.  I have tried using asteroids as spacers in the beginning of LevelSetup() but I can't find any values that make it work well.  Certain values just cause the game to crash with an "Object reference not set to an instance of an object" message.  Any advice on this would be appreciated.  I can't make an entire solar system if size is this constrained.  I can't shrink the size of the asteroids any further because otherwise seedlings will be unable to plant themselves.


Seedling planting behaviour on moving asteroids is very buggy also.  The seedlings seem to hover in space, and on the next orbit round some of them manage to plant themselves, but others get stuck and float about in space forever.  I have also seen some extremely wacky looking problems like 2000 foot tall trees that follow the asteroid with their growth, endlessly trying to catch up and penetrate it to the core.

Sniped50

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 97
Re: Bugs thrown up by the gravity engine
« Reply #1 on: April 27, 2010, 03:49:47 AM »
When the asteroids 'die', do they happen to drift outside your empire boundaries? With a map I've made, it seems that an asteroid - even if it does have my seedlings on - MUST be within your empire boundary line to be selectable, and therefore, be able to plant trees there. I lost the game because of that.  :(

I also did notice the problems with the seedlings hanging in space, and I've no idea how to fix that. But, 2000 foot tall trees? I've never seen that bug before. How fast are your asteroids going, if they're ceaselessly trying to catch up?

Mihhaelo

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 67
Re: Bugs thrown up by the gravity engine
« Reply #2 on: April 27, 2010, 05:50:48 AM »
Hi i have a few suggestions for you. Sorry for the messy nature of the post, writing isn't one of my strengths. This might not all be 100% accurate either, although it will give you a few ideas you can try.

I have mentioned the mapsize issue in another thread. When the game loads your level up, during the function LevelSetup() it checks to see that neighbouring planets are connected. If it finds any that are not connected, it adjust the SendDistance value of the planet to "connect" it.

The global Globals.G.MaxAsteroidNeighbourDist=() determines the maximum distance between planets the game will allow. The globals Globals.Asteroids.MinSendDistance and Globals.Asteroids.MaxSendDistance do exactly what you think they do. If these globals are not set high enough for the game to make all the planets have at least one neighbour, the game will crash. So you could set these to a rediculously high values like 100'000, if you do that however, you'd have to manually set all the send distance values of each planet in function LevelLogic().

I haven't seen your map, but if you are using stable orbits then this should be very easy (for you at least, i couldn't do it). You'd only need to add a bit of code that lists the planets in order of the radius of their orbit, compares them with each other and sets appropriate SendDistance values.

Just to note, the planets don't need to connect up in function LevelLogic(), it only applies to setup.

I've made a map with a range of -300'000,300'000 on the x and y axis, i'm unsure as to what the maximum possible is.

As for the seedlings not settling down, all ten seedlings must be able to land in the exact same place before a tree will sprout. I had the same issue as you when i doubled the speed of the seedlings when i was experimenting with a faster paced eufloria. I'm assuming the fact that your planets are moving is creating a similar issue. You could try increasing/decreasing the seedlings speed. There are three globals for seedling speed... Globals.Agents.MaximumSpeed=(), Globals.Agents.MinimumSpeed=(), Globals.Agents.SpeedPowerRule=(). The last value works logarithmically, if you plotted the planet "speed" (Energy,strength,speed) value next to the seedlings actual speed on a graph it would be a curve. The last value merely determined how curved the graph would be (i think?!?)

You could also try changing the turn speed of the seedlings, with better turning they may be able to settle easier. Globals.Agents.TurnRate=().

If neither of those two suggestions work to a satisfactory level, you could try slowing down the orbits of the planets.

As for the seedling planting behaviour, the problem is probably similar to above. The roots will only stop growing once they hit a predetermined point, i'd assume if the planet was moving too fast, they'd never hit that point. Globals.Structures.RootSpeed=() Determines the speed at which the roots grow. The default value is 40, the lower the value the slower they grow. I'd suggest you try increasing this value.

With the 2000 foot tall tree's, i imagine it's a similar problem as above. Because the planets are moving, it might be preventing the tree's from hitting a predetermined point, so they just keep growing. Globals.Structures.LevelTime1 to Globals.Structures.LevelTime4 determine how fast a tree grows between each level. By selecting lower figures (to make the tree grow faster), you might fix this problem.

Lastly the planets being unclickable happened on my two levels i made. If you have seedlings on a planet that does not belong to you (no flowers) and the planet is not connected to any other planet you own, then you cannot select that planet. You can get around this with a piece of code that checks all the planets to see if they have flowers. For those without flowers, it checks if you have seedlings there, and then sets the planet as being owned by you. You might consider comparing the players seedlings, to the AI's seedlings on a planet with the code giving ownership of the planet to whomever has more seedlings.

One problem this would cause, is it would allow the player to travel the entire map, without having any flowers, as long as they left one seedling on each planet. To get around this, you could set the SendDistance values of planets to be dependant on flowers being present.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Bugs thrown up by the gravity engine
« Reply #3 on: April 27, 2010, 05:14:37 PM »
Quote
I've made a map with a range of -300'000,300'000 on the x and y axis, i'm unsure as to what the maximum possible is.

This is awesome :>  Thanks for the help, both of you!  I am going to try this tonight.  :D

The other suggestions as well, like for example increasing root-growing speed are also great ideas.. hopefully that will fix the 2000foot tall tree bug, heh :>

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Bugs thrown up by the gravity engine
« Reply #4 on: April 29, 2010, 07:58:54 AM »
I've tried the suggestion for the map size thing...  no luck unfortunately :<


Here is my test code:

(click to show/hide)


I can increase the horizontal dimensions up to 15,000, but I can't seem to vertical dimensions to 15,000 at the same time.  Nothing I tried could get an asteroid with coordinates like (100000,0).

Can you post the code you used to get your large map? :>
« Last Edit: April 29, 2010, 08:03:31 AM by annikk.exe »

Mihhaelo

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 67
Re: Bugs thrown up by the gravity engine
« Reply #5 on: May 01, 2010, 06:43:42 AM »
Hi, i've had a quick look at your code and i found the following...

    Globals.Asteroids.MinSendDistance=3500
    Globals.Asteroids.MaxSendDistance=6000

Both these figures are far too low. Remember when the game sets up the map it needs to make all the planets connect up to at least one other planet. If you have a planet at (-100000,0) and the closest planet to it is (0,0) then obviously, the game cannot connect the two up with a max send distance of 6000, so hence the map will not load. If you wish to use lower SendDistances on your planets than setup will allow you to use, then you must specify them in LevelLogic and not Setup.

Just a note about memory issues... a 100'000x100'000 map doesn't use up a lot of memory (With the map in the spoiler, eufloria uses 180mb, which is only 40mb more than all the other custom maps i had a look at). But the larger you get, it seems to exponentially use up more memory. Also, if you make a planet at (-100'000,0), then it automatically scales the map upto +100'000, so your map will actually by 200'000x200'000. (A 200'000x200'000 map uses 330mb memory)

I just wrote the following piece of code to show you that larger maps are indeed possible.
(click to show/hide)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Bugs thrown up by the gravity engine
« Reply #6 on: May 02, 2010, 02:00:30 AM »
zomg, it works!!

Thanks! :D  This is so awesome.  Right, I'm getting back to work!
« Last Edit: May 02, 2010, 03:50:25 AM by annikk.exe »