Eufloria > Eufloria Classic Mods

Moving asteroids...

(1/4) > >>

annikk.exe:
This functionality exists now.  Anyone going to code a level that uses it? :>
I am still knee-deep in my AI map and I've been sidetracked for the last 2-3 days with Minecraft...  so if someone wants to pip me to the first moving-roid map, now would be the time :>

Incidentally, my plans are no less than to build a functioning gravity system..

Rudolf:

--- Quote from: annikk.exe on March 22, 2010, 04:37:26 PM ---
Incidentally, my plans are no less than to build a functioning gravity system..

--- End quote ---

0_0

annikk.exe:
No really!  It's not that hard...

First you check each asteroid once per game cycle, and perform calculations based on its size and distance of all the other asteroids in the map, and their sizes, and that will give you all the forces acting upon that asteroid.

Then you create variables for the angle the asteroid is travelling and its current momentum.

By calculating what effect the net gravitational forces are having on the asteroid, you can calculate (for each game cycle) the changes to its angle and momentum, and then move it in that direction by however much the momentum value dictates.


That's the engine of the gravity system.  To create an actual solar system, you would need to create all the asteroids in LevelSetup() and give them just the right initial angle and momentum to cause them to orbit whatever body they are nearest.

By coding it with a proper gravity engine and not just a bunch of fixed asteroids with given properties, the whole thing will be highly adaptable and re-usable, and I will be able to create some really stunning features like asteroids that fly off their orbit into space, binary star systems, etc.  By adding an asteroid density variable into the gravity engine I could also potentially create black holes...

Alex:
As a bit of fore-warning, asteroids won't move out of the world space, which is divided up into a quad tree. The tree's size depends on what exists in the level post-setup, so you might need to create some asteroids initially way out in the wilderness just to encourage the game to make a big world for you.

annikk.exe:
Alex, thanks for the information - I will keep that in mind!

(hmm.. what is a quad tree..?)

What is the maximum size of the game area, by the way?  Seems to be +/- 20,000 or so on each axis?

Navigation

[0] Message Index

[#] Next page

Go to full version