Author Topic: Gravity Engine - dev blog  (Read 11466 times)

0 Members and 1 Guest are viewing this topic.

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 13
  • Posts: 1,035
Re: Gravity Engine - dev blog
« Reply #45 on: May 03, 2010, 10:34:36 PM »
That's the volume of the laser sound. The first sound we used sounded more like a drum than the lasery sound we have now.

I'll look into this, chaps. Have no fear.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Gravity Engine - dev blog
« Reply #46 on: May 04, 2010, 01:19:22 AM »
Sweet :>  Thanks Alex!  ::heroworship::

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Gravity Engine - dev blog
« Reply #47 on: May 04, 2010, 10:07:29 AM »
So at the moment I am working on a new version of the Sol map, this time with much wider spacing.  Mercury, Venus, Earth, Luna, and Mars are all in stable orbits, as is Jupiter.  I am currently working to balance Io and Europa in orbit around jupiter...  4 moons is going to be a big challenge to get right.


The list of stuff I want to do with gravity engine:


1.  First up, finish Sol - as a (hopefully) stunning example map.  This will likely use the AI from Infected Empire; the metric-based system for determining actions would work very well in this type of map.

2.  Write up a really nice template file of the gravity engine, this will be released for others to make their own gravity maps.

3.  I have another idea for a nifty gravity-based map that I'd like to try..

4.  I have plans to add asteroid collision detection in the future.  Rather than bounce off each other, I am tempted to make them "merge" into a single, larger asteroid - rather like 2 drops of raining winding their way down a car windscreen, touching, and then "popping" together as the surface tension between them collapses.

This would then be used in a map where the initial conditions consist of hundreds of tiny asteroids moving in random directions.  These tiny asteroids collide with one another, combining to form larger asteroids that fall into a natural orbit around one another.

This would be a really fun way to procedurally generate levels.  It wouldn't always produce a level that is playable, but from working with gravity for a little while now it's actually not that unusual for objects to naturally find a stable eliptical orbit..  I have already covered all the initial mathematics to describe how the collision detection and merging systems would work.

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 13
  • Posts: 1,035
Re: Gravity Engine - dev blog
« Reply #48 on: May 04, 2010, 02:36:11 PM »
Haha I wonder if one day we'll be able to recreate Osmos in Eufloria :D

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Gravity Engine - dev blog
« Reply #49 on: May 04, 2010, 03:44:56 PM »
That would definitely be possible, using very similar code as outlined above.. :>

AWS

  • Achiever
  • Arboreal Being
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 274
Re: Gravity Engine - dev blog
« Reply #50 on: May 04, 2010, 11:00:55 PM »
wouldnt the best solution, without writing brand new script, to be to slow down the rotation of the roids to the point where all the seeds will plant themselves? this seems the most obivous solution to me. but then, i have no idea how it all really works. i just know that if the planets are going too fast for the seeds to plant, slow it down until they do.
no?! :o

Bonobo

  • Achiever
  • Old Oak
  • ****
  • Thank You
  • -Given: 79
  • -Receive: 8
  • Posts: 630
  • Was born, still alive.
    • German Mac Mailing Lists
  • Eufloria: Yes
Re: Gravity Engine - dev blog
« Reply #51 on: May 04, 2010, 11:56:10 PM »
You may know it, but if you don't, then the information might be of use:

These days I tend to increase game speed with that dev mode tip youze gave me in that other thread ...

And today I played some older standard levels ... with speed +3 or +4. Wondered why my flowers wouldn't plant even though I'd given them orders. Then I slowed down the game till it had normal speed, and voila, the flowers finally planted. Planting trees with seedlings doesn't seem to be affected by this.
Google+
Do you play Go? (aka iGo aka Baduk aka Weiqi)

Harsha

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
Re: Gravity Engine - dev blog
« Reply #52 on: May 06, 2010, 03:00:20 PM »
wouldnt the best solution, without writing brand new script, to be to slow down the rotation of the roids to the point where all the seeds will plant themselves? this seems the most obivous solution to me. but then, i have no idea how it all really works. i just know that if the planets are going too fast for the seeds to plant, slow it down until they do.
no?! :o

or instead of this, is it possible only to increase the speed of the seedlings that are planting (but not other seeds and the roids) so that dey can catch up??  ;)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Gravity Engine - dev blog
« Reply #53 on: May 06, 2010, 03:38:46 PM »
Setting + / - game speed in Developer does not affect the gravity engine at all, unless you are already artificially limiting it.
The final release will have a rate limiter applied, meaning a maximum of 100 recalculations per second.  However, + / - will still do nothing or almost nothing.

In any case, surely the map ought to be playable without the use of developer mode.  :>


With regards to slowing the asteroids down so seeds can plant themselves.
I found that in order to get this to work, the asteroids need to slow down to such a degree that it's barely possible to tell they are moving at all, much less work out if they are in a stable orbit or not.  In my view this approach results in a shortfall of awesomeness.



Sorry to shoot you all down.  :<  Thankyou for the suggestions though, please keep them coming!

Sniped50

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 97
  • Don't ask. About anything.
Re: Gravity Engine - dev blog
« Reply #54 on: May 06, 2010, 05:42:36 PM »
I have plans to add asteroid collision detection in the future.  Rather than bounce off each other, I am tempted to make them "merge" into a single, larger asteroid - rather like 2 drops of raining winding their way down a car windscreen, touching, and then "popping" together as the surface tension between them collapses.

This would then be used in a map where the initial conditions consist of hundreds of tiny asteroids moving in random directions.  These tiny asteroids collide with one another, combining to form larger asteroids that fall into a natural orbit around one another.
That would be so AWESOME! It would definitely come up with intriguing new maps to play.  ;D

But, if you do have the mathematics required to make it work, it would still need a LOT of trial-and-error to create a proper, playable map. Here are some of the various problems I've thought of:

1: What will the stats of the resulting asteroid be when 2 smaller ones collide?
2: What will the behaviour of any seedlings/trees be when the roid they're on collides with another?
3: What will happen when an asteroid is flung out of the system (which is extremely likely to occur)?
4: What will happen when roids that belong to different EMPIRES collide and merge?
5: What if you place too many asteroids, and the gravity engine can't cope with hundreds of asteroids colliding and recolliding, and constantly changing size and distances to other asteroids?

In any case, if you can sort out these 'small' problems, I'd love to play any map you come up with. I hope it works!  :)
"Sometimes, the simplest solutions work the best."
- Mythbusters

"But the complex solutions look prettier."
- Me

AWS

  • Achiever
  • Arboreal Being
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 274
Re: Gravity Engine - dev blog
« Reply #55 on: May 06, 2010, 09:12:01 PM »
  In my view this approach results in a shortfall of awesomeness.

a decline in awesomness is not desired! awesomeness is necessary, carry on...
 8)

Harsha

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
Re: Gravity Engine - dev blog
« Reply #56 on: May 07, 2010, 09:32:28 AM »

With regards to slowing the asteroids down so seeds can plant themselves.
I found that in order to get this to work, the asteroids need to slow down to such a degree that it's barely possible to tell they are moving at all, much less work out if they are in a stable orbit or not.  In my view this approach results in a shortfall of awesomeness.


What about increasing the speed of the seedlings which are being planted??  :-\

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Gravity Engine - dev blog
« Reply #57 on: May 07, 2010, 09:51:28 AM »
That would be so AWESOME! It would definitely come up with intriguing new maps to play.  ;D

But, if you do have the mathematics required to make it work, it would still need a LOT of trial-and-error to create a proper, playable map. Here are some of the various problems I've thought of:

I'm glad you asked!


Quote
1: What will the stats of the resulting asteroid be when 2 smaller ones collide?

I've been playing around with different ideas for this.  Here's my current one.

When two asteroids collide, the game treats the smaller one as having "disappeared" (in reality its radius is set to zero, any trees and seeds on it are removed, the owner becomes 0, and a flag is set such that the gravity engine no longer calculates it.  The larger asteroid then takes on a proportional amount of the smaller asteroid's energy, strength, and speed.

Lets take an example and look at the change in the energy stat when an asteroid half the size of the target pops and transfers its area and stats.

Applied Difference in Energy = Energy Difference / Mass Proportion / (number of asteroids in the collision, this number is always 2)

Energy Difference = smaller asteroid energy - larger asteroid energy

The smaller asteroid has an energy of 0.6
The larger asteroid has an energy of 0.8
The difference is - 0.2


Mass Proportion = (larger asteroid mass * larger asteroid density) / (smaller asteroid area * smaller asteroid density)

Large: 600 area, 2 density
Small: 400 area, 1.5 density

The larger asteroid has a mass (ie area * density) of 1200
The smaller asteroid has a mass of 600
1200 / 600 = 2


Applied Difference in Energy = Energy Difference / Mass Difference / 2
Applied Difference in Energy = -0.2 / 2 / 2
Applied Difference in Energy = -0.1 / 2
Applied Difference in Energy = -0.05

New Energy = Large Asteroid's Energy + Applied Difference in Energy
New Energy = 0.8 + (-0.05)
New Energy = 0.75



Quote
2: What will the behaviour of any seedlings/trees be when the roid they're on collides with another?

Trees and seedlings on the smaller asteroid are removed.  I'm going to wait and see what the gameplay is like before I decide anything more for this..



Quote
3: What will happen when an asteroid is flung out of the system (which is extremely likely to occur)?

When asteroids fly out the system, the asteroids themselves stop at the edge of the level's quad tree.  Basically they go a certain distance then just sort of stop.  :P  The game will not allow you to move them at all if it is outside the quad tree.  This results in all sorts of strange behaviour which I won't go into for now.

Despite this, the gravity engine is keeping its own variables and it still knows where the asteroid "ought" to have been.  It continues to plot the "virtual" course of the asteroid, and if after a time that virtual course should happen to take it back onto the allowed game area, the asteroid will "jump" to wherever this position is and start falling inwards at whatever pace and direction indicated by the gravity engine at that time.

During the time the asteroid is off the allowed play area, the seedlings seem to go flying off at lightspeed and the asteroid temporarily "dies", appearing to turn black and cease production of any seedlings.


This is the functionality that exists by default in Eufloria.  The question is, how can I make it so that asteroids flying off the screen always return to the middle within a decent time frame?  My hope is that they will always be drawn back to the middle after a reasonable amount of time has elapsed, and if they only come back and forth once every 20 minutes, well... then you have a comet.

If asteroids seem to fly off permanently, I might grudgingly introduce some kind of artificial mechanism to slow them down and nudge them back towards the game area.  Another possibility is to just remove these asteroids from the game entirely, and this would introduce a level of strategy in deciding which asteroids to colonise - by judging which asteroids look least likely to go flying off into space, carrying your seedlings and trees with it.



Quote
4: What will happen when roids that belong to different EMPIRES collide and merge?

The larger asteroid's owner has a costless victory.
The smaller asteroid's owner loses an asteroid.  :P


Quote
5: What if you place too many asteroids, and the gravity engine can't cope with hundreds of asteroids colliding and recolliding, and constantly changing size and distances to other asteroids?

The gravity engine calculates each collide and combine event, and each movement event, in a specific order each pass it does.  It would follow its normal order regardless of how many events are taking place.  The order in which things happen is predetermined, the gravity engine won't get confused simply because it is working with a larger data structure.  I am pretty sure it will be fine.. :>
« Last Edit: May 07, 2010, 10:03:50 AM by annikk.exe »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Gravity Engine - dev blog
« Reply #58 on: May 07, 2010, 10:07:40 AM »
What about increasing the speed of the seedlings which are being planted??  :-\

Unfortunately seedlings seem to be lazy about moving to the planting location, regardless of their speed.  I've had it all the way up at 5000 or so, and it made no appreciable difference.  Seedlings seem to have a special "plant mode" that they enter, where they fly about in a lazy sort of fashion.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Gravity Engine - dev blog
« Reply #59 on: May 10, 2010, 10:46:15 AM »
Still hoping Alex is going to save the day..  the whole Solar System idea is a bit scuppered otherwise :/  let alone a big bang level.

In the mean time I might make something a bit simpler, with less moving bodies, that works within the (pretty serious) limits imposed by being unable to plant trees on an asteroid that is moving.  I sense that people are getting a bit tired of waiting for something playable to arrive so I will get something put together this week.  This new level will go live at the weekend.  :: throws hat over wall ::