View Full Version : How should games battle in space?
aarku
2002.05.09, 09:11 PM
I think there was a great discussion started by Carlos talking about how battles would really be fought in space. But now I'm wondering what the ideal game battle would be. I think most people agreed that if you made space battles realistic, they wouldn't be much of a battle from a gamer's point of view. So what aspects of space should be kept realistic and which should be fantasized? How would you keep the sense of space but add in %110 fun? Here's what my buddy and I came up with when trying to design a space game.
First some basics. The game would be top-down 2d. (think EV) Each ship can rotate in a full circle and thrust forward. They also have retro-thrusters that slow you down about 1/4 as quickly as you can thrust forward. Now this is the first issue: Will keeping it 2d make it less fun or more because it is simplified?
As far as defense goes, each ship has two types of shielding. Concussive (explosives and impacts) and Energy (electromagnetic waves). These shields block a certain percentage of the damage taken from a weapon, up until their damage threshold, in which the percentage drops off quickly. This means that if you get pelted with a little tiny gun, you'll deflect 98% of that damage, but if you get broad sided with a hyper-nuclear-vapor cannon you'll shields will fail and you'll take the full brunt of it. The damage that your shields don't block will be subtracted from your ship's armor. Your armor will not regenerate (except on possibly a couple of weird organic-based craft) and once you reach 0 armor... boom
Weapons. There are two types of weapons: ones that do not have ammunition and ones that do. Group these into primary and secondary, respectively.
Primary weapons will pretty much be only energy weapons. (I don't count energy as ammo.) On a ship, there are places built that can contain interchangeable primary weapons. Some of these ports are turreted to varying degrees, (like ones that only turn 90 degrees... others 355) and all can contain a weapon. So a ship like an x-wing would have four gun ports (one on each wing) in which you can put whatever laser you want inside. (provided your ship can provide the required power.)
Secondary weapons are weapons with ammunition required. These will be separated into launchers and ammunition. A ship has a certain amount of volume put aside for holding secondary weapons. You can put whatever you want in here, as long as it doesn't go over the volume limit. The mass of the weapons will be taken into account when your ship is moving... so that means if you get a heavy weapon, your ship won't be able to accelerate as fast!
Capacitors. A lot of ships will have capacitors to give you that extra *boost* when you're in a squeeze. Your main capacitor will slowly store up energy. At any point, you can siphon off that energy and direct it to one of three things: lasers (primary weapons), shields, and engines. This will boost power to your lasers (increase range, size, and damage), boost shield blocking strength (and threshold), and increase your engine acceleration and maximum speed. These effects will be temporary... and fairly quickly your ship will return back to normal.
There are more things I have ideas for... but these are the main ones. I didn't discuss weapon/ship targeting, ai, collisions, gravity, sounds, light speed/warp speed/warp gates/hyperspace... etc... I think I already said some of the ai/faction/government related stuff in an ai discussion a while ago.
I'm really curious about what this sounds like to others.
-Jon
monteboyd
2002.05.09, 10:35 PM
It sounds like a good simulation, but sounds like it would be difficult to control on your own. If you could have multiplayer where each player controls a certain aspect of the ship then it could rock!
Alternatively, in one player mode the player could elect to control on section at a time and the computer would take over control of the others.
Baldock
2002.05.09, 11:06 PM
speaking of x-wing, you could borrow the energy bank idea. Have 4 energy banks. engine , shield, weapon, spare. Set the charge rates on those. Also allow the banks to have power pulled from them and put in to something else. ie pull power from engines to help with shields, slows you down but keeps you alive.
Also how about a 3d element. Have a 'jump' or 'duck', say an incoming missle is screaming towards your ship, fire a flare / decoy and your ship dives down or pulls up and missle hits flare/decoy.
Originally posted by Baldock
speaking of x-wing, you could borrow the energy bank idea. Have 4 energy banks. engine , shield, weapon, spare. Set the charge rates on those. Also allow the banks to have power pulled from them and put in to something else. ie pull power from engines to help with shields, slows you down but keeps you alive.Now THAT would be sweet! That way you gotta decide, do you want to go down with guns blazing, or attempt to out run them?
Jeff Binder
2002.05.10, 11:35 AM
That sounds cool. How are you planning to structure the game? Will it be a series of missions, more like an adventure, or just a free-for-all type thing?
hokan
2002.05.10, 06:17 PM
Add gravity it'll make movement more interesting, planets can be used to sling shot ships, gravity mines could be used to pull enemy missiles of course, hyperspace (assuming that you can fly/fight there) could have gravity currents - implemented as several points of gravity that fluctuate between different min and max pull values in unpredictable ways.
Note: a gravity mine (if strong enough) could even bend a laser in another direction.
ps: depending on how you implement hyperspace or other forms of faster than light travel, you could invent allmost any kind of strange physics.
DaFalcon
2002.05.10, 07:03 PM
Ooh, I like the idea of gravity mines. If you had "home territory" that you were defending, then you could set up a complex system of gravity mines and have pre-planned "if I shoot at point B, it will pass through point C, D, E and into point A" whereas the enemy would have to learn this through trial an error. It could be argued that the gravity mines would have a limited range effect and that effect could be shielded at greater distances, preventing enemy computers from generating a "map" of the mines. I don't know how this would work in gameplay practice, but it is just an idea :)
aarku
2002.05.10, 07:35 PM
Originally posted by Jeff Binder
That sounds cool. How are you planning to structure the game? Will it be a series of missions, more like an adventure, or just a free-for-all type thing?
The short answer: adventure.
The long answer: There is a detailed scripting system underlying the game. There are many commands that can do anything from load graphics, play sounds, to position ships & restructure factions all from within a command prompt. (Which will be hidden from the end-user... unless they register for full priveledges) Now to go along with this command system is a system of triggers that can be set in the script. So when for instance a certain ship gets destroyed, it calls a script macro to end the mission as a failure. Or for another example, if one of your wing men gets killed, you could have a text box pop up and say: "No!!! I shall revenge Jack's death!" and then have that ship grow extremely aggressive and change ai styles. (possibly from passive defender to berserker)
So when you're at the title screen and create a new game, you select what scenario you want to play, and then what mission within that scenario that is available to you. Since it is really easy to make missions, we plan on making a bunch of scenarios after we release the game with the main one. For instance, we had this idea of a cosmic pizza-boy where you had to deliver pizzas across the galaxy and fight off rival pizza joints... but that's just something that would be possible.
So what's this all sound like?
-Jon
aarku
2002.05.10, 07:41 PM
Originally posted by monteboyd
It sounds like a good simulation, but sounds like it would be difficult to control on your own. If you could have multiplayer where each player controls a certain aspect of the ship then it could rock!
Alternatively, in one player mode the player could elect to control on section at a time and the computer would take over control of the others.
Well, for me the controls are easy... so it's hard to judge. There is a key to thrust, retro-thrust, bank left, bank right, fire primary, fire secondary, six targeting keys, three keys to siphon capacitor energy... one for laser, shields, engines, two for cycling weapons...., one to activate dockables, cloaking device, hmm I think I see your point now.
As far as multiplayer goes, I'd love to implement it, but I have already been back so long on this (4+ years!)... I was thinking of making a multiplayer version using a modified engine and using OpenPlay NetSprocket... but I should probably make this OS X native first....
-Jon
aarku
2002.05.10, 07:48 PM
Originally posted by hokan
Add gravity it'll make movement more interesting, planets can be used to sling shot ships, gravity mines could be used to pull enemy missiles of course, hyperspace (assuming that you can fly/fight there) could have gravity currents - implemented as several points of gravity that fluctuate between different min and max pull values in unpredictable ways.
Note: a gravity mine (if strong enough) could even bend a laser in another direction.
ps: depending on how you implement hyperspace or other forms of faster than light travel, you could invent allmost any kind of strange physics.
I agree, that does sound cool. Instead of hyperspace, we decided to use warp gates. But there are plenty of neat things unimplemented that could be done with that. (What happens when you fire weapons into an open warp gate... hehe) At the present moment I don't have any gravity mines or things like that due to one problem: computation speed. Because when you get a dozen ships in play with a bunch of weapons, the engine has to figure how gravity will effect everything. Otherwise, you have to compute the distance between the gravity mine and everything, which is costly as well... at least so I would assume. What is implemented however are magnetic missiles. They basically do 0 damage, but in the script I wrote their mass to be negative, so when they hit something the collision causes it to go the opposite way! Very annoying to get hit with those buggers
-Jon
DaFalcon
2002.05.10, 08:00 PM
Magnetic missiles ... that sounds very cool. A friend of mine was working on a project that sounds similar (insomuch as it is a space adventure game, anyway!)... they started after the original EV came out. The title of the game was to be Escape Velocity, and it would be "more" realistic than EV, have multip-player and be fun. I doubt if it ever got out of the design stage. And anyway, they came out with that movie Escape Velocity and stole his title! :)
If you want any help with this game; testing or graphics or anything, I'd be glad to pitch in what I can :) And I would really like to see multiplayer support in a game like this, eventually if not in the initial release :-)
PS - I *really* like the idea of pre-scripting factions/fighters in your fleet, because this adds more strategy, tactical planning into a game that would usually take place too quickly to allow you to micro-manage everything like some players would like to. I really really like that :-)
Cookie
2002.05.11, 12:05 AM
Great ideas- I really like the idea of those gravity mines.
You could add on a soccer type game for multiplayer.
Two teams, each team has to knock something (small asteroid? a satellite? the other team members?) into their own team's black hole.
I also like the idea of planets pulling your ship towards them. During an intense battle yoou could slingshot yourself out of the action... very cool stuff!
Originally posted by Cookie
I also like the idea of planets pulling your ship towards them. During an intense battle yoou could slingshot yourself out of the action... very cool stuff! While that would be cool, it would NOT be cool to get slowed down by the planet's gravitational pull while trying to escape from 50 berserking pirates... Could also be kinda annoying when trying to dock/land somewhere other than the planet with the strongest gravitational pull.
Cookie
2002.05.11, 11:53 PM
That's probably true Jabber.
You'd also have to fly around planets, otherwise you might be thrown off in a totally different direction, which would be annoying indeed.
If you were to figure out how to balance out the gravitational pull so that it is not strong enough to be disturbing but big enough to have an impact, it would be really cool. Of course such a delicate balance would be rather hard to find... good luck :D
Jeff Binder
2002.05.12, 03:14 PM
Well, the gravitational pull could be set up to only have an affect when you're reall close to the planet, so you could still do a slingshot type thing, and landing would be easier, but it wouldn't really interfere with interplanetary stuff. You could use it for all kinds of cool things, like if you're fighting by a planet, you can shoot off a rocket so that is goes into orbit and hits the enemy from the other side.
Whether this would actually be fun is something we'll have to wait and see.
hokan
2002.05.12, 06:41 PM
Originally posted by aarku
At the present moment I don't have any gravity mines or things like that due to one problem: computation speed. Because when you get a dozen ships in play with a bunch of weapons, the engine has to figure how gravity will effect everything. Otherwise, you have to compute the distance between the gravity mine and everything, which is costly as well... at least so I would assume.
-Jon
Obviously I don't know what kind of system your intend to run this on but gravity should not need to all that expensive to calculate.
Lets assume the following example (worst case scenario in regards to CPU
load):
- 50 space crafts
- 500 porjectiles (missiles, mines ...)
- a planet and couple of moons (the permanent gravity sources)
- 30 fps (minimum)
This would require use to keep track of (500 + 50) * 30 = 16500 movements per second. If each object movement is defined by one vector, the updateing of the vector during each frame will be:
new_vector = current_vector + course_change_vector + gravity_source_vector_1 +
gravity_source_vector_2 + .... + gravity_source_vector_N
+ Vectors due to tractor beams, collisions and magnetic missiles
N = number of gravity sources
vector addition is a cheap operation (and could pressumably be done with int's i.e. no floating point math required):
v_sum = v1 + v2 => v_sum.x = v1.x + v2.x,
v_sum.y = v1.y + v2.y
vector rotation (to figure out the course_change_vector) is more costly:
course_change_vector = normalized_vector * speed_scalar * rotation_matrix
normalized_vector (i.e. length = 1): v.x = 0, v.y = 1 (pointing north)
speed_scalar: a numerical value that represents the amount of acceleration
rotation_matrix: supply the direction the craft is facing in this matrix
There are several optimisations that can be done:
- gravity pull is = k * 1 / (distance * distance), (k is some constant), this means that gravity
pull falls of rather quickly with distance - so the first optimisation is that gravity pull
can be ignored at a certain distance (depends on the K value - which is basicly the mass of the
planet).
The initial distance check can check distance along the x and y axis instead of calculating the
actual distance ( sqrt(x_diff^2 + y_diff^2) ), this only needs to be done if the first check
succeeds.
- N should be a low number if no gravity mines are used
- Gravity mines are pressumably short range and temporary (thats at least what I assumed when I
mentioned them), so N should remain small.
- Instead of letting each object check if it's affeceted by gravity, it might be more effective
to instead let each gravity source check which objects it might affect this can be done in:
N log M operations if the objects are sorted into a binary tree (on x and y position alternatingly)
M = the number of objects in the world
N = number of gravity sources
This ofcourse requires M log M operations to create the tree in each frame, if everything is resorted i.e. no unmoving objects or if the tree is recreated which in this case might be faster.
- There are also ways to aproximate the effect of distant gravity sources using octree (or in the 2D case quadtrees) where the effect of gravity on each object can be computed in constant time rather than in propotion to the number of N. This on the other hand requiers that new tree is created in
each frame (of movement) and is most likely not efficent when N is a low value.
If N is = 1, on average, then this would only double the number of required vector additions.
Carlos Camacho
2002.05.12, 08:22 PM
This may sound stupid, but when I was thinking of a 2d game and the screen showing a planet and ship, something came to mind. Would you represent the planet with a sprite the size of the ship, like EV or Spaceward Ho??
Or would you change the scale?
aarku
2002.05.13, 04:23 PM
Originally posted by Camacho
This may sound stupid, but when I was thinking of a 2d game and the screen showing a planet and ship, something came to mind. Would you represent the planet with a sprite the size of the ship, like EV or Spaceward Ho??
Or would you change the scale?
Right now you can load up any picture you want as "scenery". So the size is up to the person making the scenario, but I've been making everything fairly small in relation to the ships. The reason is basically speed. (memory to a lesser extent) Right now the game uses software rendering meaning that size matters a lot... it gets pretty weird when the framerate jumps from a smooth 120 fps to 15 when you get near a big planet. I really want large planets... but I don't know how to feasibly do it.
-Jon
aarku
2002.05.14, 09:02 PM
Ok, so lets say a planet had gravity in the game. Your ship would be pulled towards it... but it is 2d. Do you collide with the planet and bounce off (that would be really really strange), or...? Things would get screwed up, because as you reach the center of the planet, the gravity would increase quickly, and eventually you would be trapped. I'm not sure how logistics would work with planet gravity... but gravity mines on the other hand... it'd be easy enough to say what happens when you hit a gravity mine.... boom.
-Jon
aarku
2002.05.14, 09:06 PM
Right now the game has inertialess turning like most space games I've played have. Would it be better to have turning with inertia... so when you thrust counter-clockwise you continue spinning until you thrust clockwise? Obviously this is more realistic, and it's easy enough to implement for player and computer... but any thoughts on playability?
-Jon
Jeff Binder
2002.05.14, 10:38 PM
I could see that being somewhat hard to control... I guess it's assumed that you're navigation system takes care of this for you.
Baldock
2002.05.15, 02:03 AM
what you could have is the following.
ship type 1 has turning speed of 1
ship type 2 has turning speed of 3
while flying ship 1 when I turn to the left the thruster will only fire once. I will then spin left until I press right and it will fire once, stopping the spin. Flying in ship 2 when I turn to the left and hold the the left arrow/joystick/etc it fires thrusters once.. waits for a moment.. fires again.. waits.. and fires again. When I want to spin the other way or slow my spin I turn back the other way.
How does that sound?
hokan
2002.05.15, 02:56 PM
Originally posted by aarku
Ok, so lets say a planet had gravity in the game. Your ship would be pulled towards it... but it is 2d. Do you collide with the planet and bounce off (that would be really really strange), or...?
There are two cases ship-ship and planet-ship collisions, in the planet-ship collision the mass of the planet is so large that the push the hitting ship gives it is unnoticable, the ship on the other hand will litel more than scrap metal due to the speed of impact.
Things would get screwed up, because as you reach the center of the planet, the gravity would increase quickly, and eventually you would be trapped.
Planets, stars and gasgiants can be considered to be solid (due to the amount of friction generated when flying into them - impact energy is = ship mass * ship speed ^2) i.e. a ship should not be able to get inside a planet - add colision detection to determine if ship is coming inside the radius of the planet.
Physics side note: assuming that your inside a planet gravity can be determined by only considering the mass inside the current radius (= planet radius - deapth from surface), so your actualy weightless at the center, if you have a frictionless tunnel trough the center of the planet you would actualy fall back and forth between the end points for ever (ignoring minor details like the planets movement, tunnel entry speed and planet rotation).
ps: a proper gravity force formula should look something like this:
F = G * (m1 * m2)/d^2
x^n = x * x * ... * x (x multiplied n times)
F = force (pull - N, newtons)
G = gravity constant ( 6.672 * 10^-11 N m^2/kg^2)
m1, m2 = mass of object 1 and 2 (kg)
d = distance between object centers (m - meter)
This formula holds true:
F = ma -> F / m = a
Therefore if it is assumed that if m1 is a ship and m2 is a planet and A is the acceleration of the ship, the following holds:
A = G * (m1 * m2)/d^2 * m1 = G * m2/d^2
As a ship mass is basicly = 0, compared to a planet, so it's ok to assume that only the ship is moving. This means that the speed incearse for the ship between each period dt (e.g. a rendering frame) can be considered to be SpeedIncrease = K * planetMass/distance^2 (K, planetMass and distance can be any unit of measurement you want depending the actual
game scale and how noticable you want the gravity effects to be).
hokan
2002.05.16, 09:16 PM
Originally posted by hokan
There are two cases ship-ship and planet-ship collisions, in the planet-ship collision the mass of the planet is so large that the push the hitting ship gives it is unnoticable, the ship on the other hand will litel more than scrap metal due to the speed of impact.
The reason the ship doesn't bounce, is because it isn't structuraly solid enough to remain in one piece at impact, instead some of the impact energy will be expanded to rip the ship appart and some will bounce parts of the ship back (some of the impact energy is absorbed by the planet) - this is the reason that crash debris gets scattered, some small pieces may even reach escape velocity and i.e .end up in space again.
Some mars rocks have ended up on earth due to meteor impacts on mars, flining some martian rock into space, that eventualy end up dropping onto the earth (due to earth gravitational pull).
Escape velocity = the speed that allows a object to get into space from a planet surface under the following conditions:
- the object doesn't accelerat, it is simply launched at a certain speed
- the planet will never be able (independent of time period the observer waits) to pull the object back to the planet surface (with gravity)
Escape velocity depends on gravity pull of the planet, Earths escape velocity is = 11 km/s (39600 km per hour).
David
2002.05.16, 09:26 PM
Make the ships have engines which automatically neutralise gravity (if you have it turned on) So for example if you were trying to dock on a space station or something then your engines would automatically compensate for the gravity which would just mean that you go a little slower in other directions (because its putting some energy into compensation) but it would be easier to control direction.
Although I guess that wouldnt be too much of an issue since you'd be in orbit :)
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.