### Author Topic: Questions on distance and speed, and their units of measurement  (Read 1820 times)

0 Members and 1 Guest are viewing this topic.

#### Little Asi

• Guest
##### Questions on distance and speed, and their units of measurement
« on: June 19, 2009, 11:42:47 PM »
I feel like fooling around with a GUI for level editing. I know at least one person has already made a level editor, I'm just doing this for the personal satisfaction, and don't particularly plan to ever finish it.

That being said, I have a few questions that hopefully somebody from the community or dev team can answer:

1. What exactly are the units of measurement for distance and speed (e.g. pixels for distance, pixels per second for speed?)

2. Are all of the units used for distance settings the same for all the separate entities on which you can set them? For example, is the unit the same for MINRADIUS on asteroids as it is for MINASTEROIDSEPARATION the game settings?

3. Is the distance from an asteroid (for the EXTRAVIEW and MINASTEROIDSEPARATION, for example) counted from the center of the circle or the perimeter?

4. What's the size of the default viewport?

5. What is the formula for determining an asteroids size? I know it's based on the various parameters, but I don't know exactly how they interact.

Thanks for the great game guys, keep up the good work.

#### Alex

• Ent
• Thank You
• -Given: 3
• Posts: 1,035
##### Re: Questions on distance and speed, and their units of measurement
« Reply #1 on: June 20, 2009, 09:04:55 PM »
1. The units in the game are arbitrary.

2. Yes, all of the distances are in the same unit.

3. Sometimes from the centre, sometimes from the surface    for minasteroidseparation i just discovered it's from the centre, which is bad... should fix that. I think it ought to be from the surface in general.

4. In game units? According to the debugger it's {Width = 2111.99976 Height = 1188.0}. I should think we'll make it so that the camera can be scripted though, so that Rudolf and other level designers can place the camera in a sensible place at the start of a level or at key points or whatever.

5. The asteroid's size is calculated from the following code:
Code: [Select]
`            float radiusAmount = (a.Energy) * Globals.Asteroids.SizeFromEnergy + a.Strength * Globals.Asteroids.SizeFromStrength + a.Speed * Globals.Asteroids.SizeFromSpeed;            float radiusBand = (Globals.Asteroids.MaxRadius - Globals.Asteroids.MinRadius);            radiusAmount /= radiusBand; // this should give us 0->1            Utils.Clamp(ref radiusAmount, 0, 1);            float radius = Globals.Asteroids.MinRadius + (float)Math.Pow(radiusAmount, Globals.Asteroids.RadiusPowerRule) * radiusBand;            if (radius > Globals.Asteroids.MaxRadius) radius = Globals.Asteroids.MaxRadius;`
So we have the min size and add on a power rule for a value between 0 and 1 that is the ratio of the size from each attribute to the range in size of asteroids in the level. Confused? So were we!

Glad you're enjoying the game, don't work too hard making an editor yet as it might be easier for you to do it later. At the moment we're using XML for level data but later it will be possible to use Lua.

#### Little Asi

• Guest
##### Re: Questions on distance and speed, and their units of measurement
« Reply #2 on: June 23, 2009, 04:40:06 AM »
Thanks, this should help a lot.