I spent a good bit of time trying to setup a Mercurial repository server on a Windows 7 Server that uses wamp.
I had to install TortoiseHg and Python 2.6.6 and the latest Mercurial in that order so that Mercurial would add it's libraries to the Python install. All that is important because the library.zip file that comes with TortoiseHg doesn't have the right Python modules you need to make the Mercurial hgweb.cgi work. Also I needed to install mod_wsgi on the wamp server which uses Apache. Lastly, here is my hgweb.cgi
#!c:/Python26/python.exe
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories
import os; os.environ["HGRCPATH"] = "C:\wamp\www\hg"
# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "c:\\wamp\\www\\hg\\hgweb.config"
# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, hgwebdir, wsgicgi
application = hgwebdir(config)
wsgicgi.launch(application)
Sunday, February 20, 2011
Nobody Likes To Fly In Space - They Want To Drive
There are a lot of arguments out there about how much "fun" realistic space physics are and I am a believer that it's annoying to have to deal with so many ways to maneuver and the concept of the ship pointing one direction while flying another with the engines off! So, I'd like to share with you how I decided to implement unrealistic but "fun" spaceship flying. Oh, and back in the day I did participate in the making of a game with realistic space physics.
To start with lets consider that most games use some kind of physics engine and those deal in forces primarily so we need to make each of the engines apply forces to the spaceship. But we can't stop there because that is the realistic way and controlling a for-real spaceship can be so challenging that you don't have much time to deal with anything else like, say, shooting. I mean, just think about all the controls you have to have in your ship to make your ship rotate in any direction and move in any direction! Now, I have considered a game where each spaceship has a pilot and a separate player as the gunner, but lets not get distracted...
The easiest way to fly in space besides autopilot is to make it like driving - something that most people are used to. You see, I want two things when I'm driving:
Handling the first issue is simple after you handle the second issue, just make the back engine the biggest and don't go putting big engines on the sides or front. The second issue is not too difficult either - apply dampening to the spaceship so that it acts more like it is moving through liquid/air than through a vacuum.
By applying the dampening we ruin realistic space physics, but make spaceships easier to control. Now since the ship is really moving through some kind of liquid/air it takes constant force to keep it moving and we now have an excuse for a fuel gauge and as an added bonus, when the spaceship enters the atmosphere or ocean we can use the same controls just fiddle with the amount of dampening.
Last thing I'd like to mention is the issue of 'max speed'. When we have dampening then the 'max speed' of a spaceship makes more sense and we have the excuse for putting spaceships in the game with more powerful engines - where with realistic space games you can fly incredibly fast in a tin can with the help of some gravity, you just can't start or stop fast.
Oh, and collisions should work with our physics plus dampening model too and keep all that space debris from moving off into infinity where nobody could tell that it was once part of a destroyed spaceship.
On a more practical note, here is how I implemented the above physics model in OGE with Bullet.
1. Use btRigidBody::setDampening() to set the dampening on the Bullet rigid body object
2. Use Bullet's internal tick callback to apply constant forces before the dampening is applied:
btRigidBody->applyCentralImpulse(velocity * deltaTime);
btRigidBody->applyTorqueImpulse(angular * deltaTime);
Cassini Division 2004 |
To start with lets consider that most games use some kind of physics engine and those deal in forces primarily so we need to make each of the engines apply forces to the spaceship. But we can't stop there because that is the realistic way and controlling a for-real spaceship can be so challenging that you don't have much time to deal with anything else like, say, shooting. I mean, just think about all the controls you have to have in your ship to make your ship rotate in any direction and move in any direction! Now, I have considered a game where each spaceship has a pilot and a separate player as the gunner, but lets not get distracted...
The easiest way to fly in space besides autopilot is to make it like driving - something that most people are used to. You see, I want two things when I'm driving:
- I usually want to be traveling in the direction my spaceship is pointing
- When I hit the gas I want the spaceship to move, and when I let go I want it to come to a stop.
Handling the first issue is simple after you handle the second issue, just make the back engine the biggest and don't go putting big engines on the sides or front. The second issue is not too difficult either - apply dampening to the spaceship so that it acts more like it is moving through liquid/air than through a vacuum.
By applying the dampening we ruin realistic space physics, but make spaceships easier to control. Now since the ship is really moving through some kind of liquid/air it takes constant force to keep it moving and we now have an excuse for a fuel gauge and as an added bonus, when the spaceship enters the atmosphere or ocean we can use the same controls just fiddle with the amount of dampening.
Last thing I'd like to mention is the issue of 'max speed'. When we have dampening then the 'max speed' of a spaceship makes more sense and we have the excuse for putting spaceships in the game with more powerful engines - where with realistic space games you can fly incredibly fast in a tin can with the help of some gravity, you just can't start or stop fast.
Oh, and collisions should work with our physics plus dampening model too and keep all that space debris from moving off into infinity where nobody could tell that it was once part of a destroyed spaceship.
On a more practical note, here is how I implemented the above physics model in OGE with Bullet.
1. Use btRigidBody::setDampening() to set the dampening on the Bullet rigid body object
2. Use Bullet's internal tick callback to apply constant forces before the dampening is applied:
btRigidBody->applyCentralImpulse(velocity * deltaTime);
btRigidBody->applyTorqueImpulse(angular * deltaTime);
Subscribe to:
Posts (Atom)