Author Topic: Quantum Reality  (Read 2004 times)

0 Members and 1 Guest are viewing this topic.

For the last few months I've been writing a space sim graphics and physics engine.  The physics part is done.  So's the fragmentable-ships subset of this.  Now I just gotta figure the graphics part.

I've chosen DirectX 9 for the graphics.  I looked at both OpenGL and DirectX, and concluded that DirectX would be simpler (partly because my physics engine uses DirectX's geometry functions for matrices and vectors).  In accordance with the First Commandment of Microsoft, 'Thou shalt only use our data formats', I've hit upon a problem.

For the fragmentable-mesh code, I require that each ship be made up of several seperate meshes.  Moreover, I have to be able to export these from 3DS MAX to an ASCII file then run my own converter to get them into the custom format that I require.  Problem: DirectX prefers .x files for meshes.  So do I have to load the mesh vertices into the Mesh object's Vertex Buffer directly?  And what do I do about the Index Buffer, whatever that is?  Finally, how do I set a Mesh object's texture?  The object I'm using has the ID3DXMesh interface.

Don't get me wrong: I quite like the interface system used by DirectX 9 (it's a damn sight easier than OGL's primitives-based procedural system), but sometimes it's a ***** to make it do what you want.

As an aside, I'm building support for Beam Cannons into this engine, despite the fact that the game I intend to make does not actually use them.  So I might do a FreeSpace conversion with Beams that really do cut up ships, and really good collision effects.
'And anyway, I agree - no sig images means more post, less pictures. It's annoying to sit through 40 different sigs telling about how cool, deadly, or assassin like a person is.' --Unknown Target

"You know what they say about the simplest solution."
"Bill Gates avoids it at every possible opportunity?"
-- Nuke and Colonol Drekker

 

Offline Stryke 9

  • Village Person
    Reset count: 4
  • 211
Buh... duh? Coool.

 

Offline Sandwich

  • Got Screen?
  • 213
    • Skype
    • Steam
    • Twitter
    • Brainzipper
You might want to ask this in the SCP forum - some of the coders there don't really frequent the other parts of the board.
SERIOUSLY...! | {The Sandvich Bar} - Rhino-FS2 Tutorial | CapShip Turret Upgrade | The Complete FS2 Ship List | System Background Package

"...The quintessential quality of our age is that of dreams coming true. Just think of it. For centuries we have dreamt of flying; recently we made that come true: we have always hankered for speed; now we have speeds greater than we can stand: we wanted to speak to far parts of the Earth; we can: we wanted to explore the sea bottom; we have: and so  on, and so on: and, too, we wanted the power to smash our enemies utterly; we have it. If we had truly wanted peace, we should have had that as well. But true peace has never been one of the genuine dreams - we have got little further than preaching against war in order to appease our consciences. The truly wishful dreams, the many-minded dreams are now irresistible - they become facts." - 'The Outward Urge' by John Wyndham

"The very essence of tolerance rests on the fact that we have to be intolerant of intolerance. Stretching right back to Kant, through the Frankfurt School and up to today, liberalism means that we can do anything we like as long as we don't hurt others. This means that if we are tolerant of others' intolerance - especially when that intolerance is a call for genocide - then all we are doing is allowing that intolerance to flourish, and allowing the violence that will spring from that intolerance to continue unabated." - Bren Carlill

 

Offline Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
meaning your engine or game would come with a 3dsmax to whatever? now that's interesting :)
SCREW CANON!

 
The first idea behind this engine was to make the physics realistic.  Lasers are like in Mechwarrior: instant-travel beam weapons.  I've figured out a simple algorithm for denting ship hulls too, from collisions and the like.  The average fighter will have about 15 hull sections of various sorts, but the sections will have a low polycount and there won't be very many fighters.

The game is 'Contact: Terran Defence' and it's set in 2023.  I'll only post the storyline if people want me to, because I normally talk about my projects for extended periods of time and I really shouldn't.  But the game uses technology not too far distant from what we have now.  The premise is: 'How would we fight a war in space in 2020?'.  Ship controls were going to be a bit like the Apollo module controls; joystick controls angular acceleration rather than angular velocity.  But that'll be hell to fly, so I dropped it.  The same goes for accurate engine physics, because the first time you lose an engine the ship would become unflyable.  The principle of fixed velocity without force WILL be used, though.  You have two thrust directions: forwards and backwards.  Face where you want to accelerate and press the key.  You accelerate.  When you release the key you keep going in the same direction until you accelerate in another direction.  That way, you can face in a direction other than the direction you are moving in.

Also, there's no such thing as absolute velocity.  Velocities of other objects will be given relative to your own ship.

OK, now the background is typed up (might as well have typed the story to; feel free to flame about my long pointless posts), back to the programming stuff.


I solved the problem myself eventually.  I do indeed have to load the vertex buffer myself, and the index buffer is only used for the DrawIndexedPrimitive method.  Textures is still a headache, but I think I'm using an unskinned mesh object at the moment, which could be half the problem.  Attribute tables are confusing; I've abandoned them.

Yes, there will be complete modding tools with this game (which will be Open Source, in contravention of Microsoft's Third Commandment, 'Thou shalt not associate with Open Source projects').  The engine and the game are pretty much inseperable, so it'll be some time before I consider writing another style of game using this engine.  Making ships for this game will be time consuming, because of the numerous hull sections.  But I'm sure it won't be quite as bad as FS2's turrets, subsystems and progressive detail runaround in 3DS MAX.
'And anyway, I agree - no sig images means more post, less pictures. It's annoying to sit through 40 different sigs telling about how cool, deadly, or assassin like a person is.' --Unknown Target

"You know what they say about the simplest solution."
"Bill Gates avoids it at every possible opportunity?"
-- Nuke and Colonol Drekker

 

Offline Rictor

  • Murdered by Brazilian Psychopath
  • 29
I think that its a great idea. There is another guy working on his own space sim engine, he posts here sometimes. The nick is YU_Skywalker and the engine can be found here. Perhaps you could hook up with him to bring your resources together. He already has some pretty amazing (for an indie game) stuff in there, and if there were several people working on it it could only improve.

Though I think that its very comendable that you're making an engine on your own, I also think that its kind of inefficient. Instead of having 1 or 2 kickass, AAA quality engines, the space-sim community seems to be doing many more, lower quality projects. This is nothing personal against you, since I haven't even seen your engine, its just my sentiments in general. For example, with Starshatter, one of the few things that (in my mind) is stopping it from becoming the rallying call to the space-sim community is the complicated control interface. If some of the programmers who are working on independent projects were to come together, this, and many other things, could be worked out, to create an engine which is both advnaced enough to compete with commercial games and easy enough to be used by the varous mod communities to create their own games. Starshatter is already sporting some amazing graphics (seem my thread about a Shatshatter Babylon 5 mod a few pages back) and particle effects. With a few more finishing touches, it could really help bring about a resurgence of space-sim games, pioneered by the modders. The same thing goes for Vega Strike and many other engines which I can't remember at the moment.

Ofcourse, I always support any attempts to develop the genre, be they individual projects or large teams. I just think that greater results could be achieved if various programmers were to pool their resources. In any case, good luck on your project, and I'll be keeping an eye out for updates and future devlopments.

 

Offline Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
sounds a lot like my Outerspace petproject ( tho mine happens about a dozen years later ).
I'd have some comments tho ( ok, I'll just spit my own ideas from my own project, please forgive me about that ):

-controls: ala Descent, but with momentum: aka if you push the forward button, your ship will accelerate, if you stop pushing it, the ship will saty at it's current speed. I believe that's the same as you. But there's also up/down and left/right strafe ( coz  there's nothing more fun than circling around a ship to fight it, IMHO, and it gives a lot of manoeuvring possibilities ). To stop the momentum, you have to go the other way ( much like the old Asteroid game, in fact, but with all directions ). You have afterburners in every direction ( gameplay wise I thought that pushing twice the key fast would ignit the AB ), allowing ships to have very sudden moves, rather than just going plain faster more quickly ( even tho it would of course do that ). Direction is handled with the mouse ( ala descent or ala freelancer depending on peoples taste, the choice would be possible in the option menu, and joysticks for those who absolutly hate mouse+keyboard interfaces for a spacesim ). The thing is that it feaures "realistic" controls, but still easy to use, w/o hundreds of keys, etc. They used it for a FPS after all...

-weapons: same for me when it goes to lasers, tho in my case, they will stay "on" untill you release the trigger, or it overheats ( no energy control in Outerspace, I believe such ships have enough power output.
I have a thing for machineguns, but I guess that need no explanations
missiles: I think the tech does not allow all those superaccurate homing missiles ( momentum in space for small super fast thinguies to track other very fast thinguies, that doesn't work too much for me ), so I went with the "all dumbfire" way ( save for "torpedoes", which can correct their course more or less as they're used on very long range ). So the interest is in warheads rather than missile hability itself ( think Crimson Skies if you know it, it's a perfect depiction of how dumbfires can be both fun and interesting to play )
"blob"  weapons, aka lasers in most space sims: well, they have to be there, coz people just love them. Those things emulate some kind of plasma-based weapons in OS, or fusion guns ( fusion guns: they fire large chunks of overheated... materials or gaz of some sort ).
shields: I never really liked shields, that's too advanced for terrans in my opinion ( :p ). I keep that for possible alien species with cool, fuzzy tech, I suppose.

well voila, just thought I'd share a piece of my own personnal brainstorming about my "dream spacesim". I hope you don't mind :)
SCREW CANON!

 
Not at all.  Always good to get some ideas from other community members.

And what the hell, I'll post the storyline (cue cries of 'Nooooooo!!!!'):

Contact: Terran Defence
-----------------------

It's 2023, and humanity is not alone in the Universe.  From a distant world comes a fleet of alien vessels.  Their purpose was unknown.  Their identity was unknown. Their home planet is still unknown.

First detected on the outer reaches of our Solar System by SETI, they were designated SETI-Alpha by NASA.  We sought to make contact with them.

A robot probe was sent out to rendezvous with them out near Saturn.  It was taken on board by the largest vessel but no response was received.  A manned vessel, a Light Cruiser called Aurora, met with them near the Asteroid belt but was ignored.

Now they have reached Mars.  Recon photos show that they are setting up a base on the Red Planet.  Additionally, some of their larger vessels are moving towards Earth.

When the Aurora was attacked and destroyed an hour ago we realised their identity and purpose.

They are our conquerors.





Basically, these aliens are on a fleet of generation ships (no subspace travel in this game) which have been sent out by their race to prevent the expansion of dangerous species, eg. humans.  They have monitored our world from long range, and decided that we are close enough to conquering space to become a threat, so they're gonna shut down our space programme.  Needless to say, because of Earth's dwindling resources this poses a grave threat to our very existence.

The alien vessels will all have massive metal radiation shields on their front ends, for protection when travelling at about .8 of lightspeed.  This means that the front is effectively invulnerable, but also undefended.  Result: most battles will be broadside instead of head-on.

Terran space tech consists of spaceplanes and shuttles initially, all launched from Earth until Freedom Station is modified as a supply and staging post.  Armaments start out as machine guns and thrust-vectored missiles (coz fins don't work in space).  Terrans are the first to deploy laser and mass driver weapons, but the aliens catch on quickly.  They adapt almost as fast as we do.  When they start using plasma weapons against us, we develop shields.  BUT these shields only work vs. energy weapons, and drain a fair amount of power, so if you're not up against plasma, ion, or laser weapons leave them at home.

Earth has very few capital ships.  Aurora was the first one, meant more as a supply vessel than a military vessel (there's a minor arms/space race going on between America and China at the beginning).  Most battles will involve fighters and space stations rather than capital ships.  Finally, the levels will be HUGE!  There will sometimes be several battles going on at different places, and you can use your autopilot to get between areas quickly.  Or, just fly it yourself.  A bit like WingCom Privateer in that respect.


Latest update on programming front:  D3D Meshes are a pain in the ass.  Attribute tables are starting to piss me right off, so I'm going to use triangle strips and lists for hull sections.  Advantages of this are: less memory usage, easier to build ship models.
Disadvantages: one texture per hull section, royal pain in the ass to write the file converter.

But at least the engine displays a DirectX screen now rather than just setting up all physics objects, deleting all objects, and quitting.  Now let's see if I can make it draw a cube...
'And anyway, I agree - no sig images means more post, less pictures. It's annoying to sit through 40 different sigs telling about how cool, deadly, or assassin like a person is.' --Unknown Target

"You know what they say about the simplest solution."
"Bill Gates avoids it at every possible opportunity?"
-- Nuke and Colonol Drekker

 

Offline Sandwich

  • Got Screen?
  • 213
    • Skype
    • Steam
    • Twitter
    • Brainzipper
Quote
Originally posted by Descenterace
...{storyline was here}...


Have you just read a book called "The Killing Star" by Charles Pellegrino and George Zebrowski? :wtf:
SERIOUSLY...! | {The Sandvich Bar} - Rhino-FS2 Tutorial | CapShip Turret Upgrade | The Complete FS2 Ship List | System Background Package

"...The quintessential quality of our age is that of dreams coming true. Just think of it. For centuries we have dreamt of flying; recently we made that come true: we have always hankered for speed; now we have speeds greater than we can stand: we wanted to speak to far parts of the Earth; we can: we wanted to explore the sea bottom; we have: and so  on, and so on: and, too, we wanted the power to smash our enemies utterly; we have it. If we had truly wanted peace, we should have had that as well. But true peace has never been one of the genuine dreams - we have got little further than preaching against war in order to appease our consciences. The truly wishful dreams, the many-minded dreams are now irresistible - they become facts." - 'The Outward Urge' by John Wyndham

"The very essence of tolerance rests on the fact that we have to be intolerant of intolerance. Stretching right back to Kant, through the Frankfurt School and up to today, liberalism means that we can do anything we like as long as we don't hurt others. This means that if we are tolerant of others' intolerance - especially when that intolerance is a call for genocide - then all we are doing is allowing that intolerance to flourish, and allowing the violence that will spring from that intolerance to continue unabated." - Bren Carlill

 

Offline Ace

  • Truth of Babel
  • 212
    • http://www.lordofrigel.com
Quote
Originally posted by Descenterace
Story was here.


Alright, what is the motivation of the aliens? Why do they need to conquer? If they have the technology to travel between stars in this manner, then why do they need to seize planets? ;)
« Last Edit: August 21, 2003, 08:10:42 pm by 72 »
Ace
Self-plagiarism is style.
-Alfred Hitchcock

 

Offline mikhael

  • Back to skool
  • 211
  • Fnord!
    • http://www.google.com/search?q=404error.com
Quote
Originally posted by Descenterace
... So do I have to load the mesh vertices into the Mesh object's Vertex Buffer directly?  

Yes, but you already figured that out.

Quote

Don't get me wrong: I quite like the interface system used by DirectX 9 (it's a damn sight easier than OGL's primitives-based procedural system), but sometimes it's a ***** to make it do what you want.

I'm really not sure what you're saying here. What do you mean by 'primitives based procedural system'? I do sincerely hope you're not thinking of building things from primitives in the GL surface! vert-by-vert/poly-by-poly is very much the way to go there!

So if you're already loading your vertices directly into a vertex buffer, why not use OpenGL? Multiplatform, supported on pretty much every system, and most importantly, its not tied to a Microsoft license (who could make DirectX pay to play any time they want).

Personally, I do the OpenGL route so I can test my model previewer on multiple platforms at once. Between OpenGL and SDL, you can dodge the Microsoft leash entirely.
[I am not really here. This post is entirely a figment of your imagination.]

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Well, besides OGl, is there an alternative to DX?
Freelance Modeler | Amateur Artist

 

Offline Ace

  • Truth of Babel
  • 212
    • http://www.lordofrigel.com
Quote
Originally posted by Raa Tor'h
Well, besides OGl, is there an alternative to DX?


There's always Glide :)
Ace
Self-plagiarism is style.
-Alfred Hitchcock

 
OGL's hundreds of functions are confusing to say the least. DX9 encapsulates functions for dealing with vertices within the data structure itself.  Also, my physics engine uses DX9 extensions for geometry maths.

Never read that book, btw.

The aliens don't intend to capture our world.  They just intend to destroy our ability to explore space so we can't pose a threat to them or any other race in the future.
Now I come to think of it, that's a bit like the Shivans.  There are no species to threaten us in our infancy because this race has prevented their expansion into space.

OK, the engine displays stuff.  Movement is fine.  Rotation is being a nuisance, because the object (a cube) disappears after rotating through about 1.5 rads.  I paused the program and looked at the 'facing' matrix: problem was the matrix was zeroed!  Dunno why.  Every frame, the physics engine multiplies the 'rotation' matrix by the 'facing' matrix then by the time since last frame in order to get... the... current... facing...

DAMN...

OK, i'm going back to quaternions for storing rotation.  Note to self: sin(a / time) != sin(a) / time...:rolleyes:
'And anyway, I agree - no sig images means more post, less pictures. It's annoying to sit through 40 different sigs telling about how cool, deadly, or assassin like a person is.' --Unknown Target

"You know what they say about the simplest solution."
"Bill Gates avoids it at every possible opportunity?"
-- Nuke and Colonol Drekker

 

Offline mikhael

  • Back to skool
  • 211
  • Fnord!
    • http://www.google.com/search?q=404error.com
Quote
Originally posted by Descenterace
OGL's hundreds of functions are confusing to say the least. DX9 encapsulates functions for dealing with vertices within the data structure itself.  Also, my physics engine uses DX9 extensions for geometry maths.


I get it. You like the OO aspect of DirectX. A bit of research would reveal that there are OO bindings for OpenGL as well. They're just not the default.
[I am not really here. This post is entirely a figment of your imagination.]

 

Offline Stryke 9

  • Village Person
    Reset count: 4
  • 211
Why are aliens always supposed to be stupid??? I know they come halfway across the galaxy to stick **** up rednecks' assholes and steal cow rectums, which doesn't bode well for intelligent life in the galaxy, but do they never get a break?

  

Offline Sandwich

  • Got Screen?
  • 213
    • Skype
    • Steam
    • Twitter
    • Brainzipper
Quote
Originally posted by Stryke 9
Why are aliens always supposed to be stupid??? I know they come halfway across the galaxy to stick **** up rednecks' assholes and steal cow rectums, which doesn't bode well for intelligent life in the galaxy, but do they never get a break?


Amen.
SERIOUSLY...! | {The Sandvich Bar} - Rhino-FS2 Tutorial | CapShip Turret Upgrade | The Complete FS2 Ship List | System Background Package

"...The quintessential quality of our age is that of dreams coming true. Just think of it. For centuries we have dreamt of flying; recently we made that come true: we have always hankered for speed; now we have speeds greater than we can stand: we wanted to speak to far parts of the Earth; we can: we wanted to explore the sea bottom; we have: and so  on, and so on: and, too, we wanted the power to smash our enemies utterly; we have it. If we had truly wanted peace, we should have had that as well. But true peace has never been one of the genuine dreams - we have got little further than preaching against war in order to appease our consciences. The truly wishful dreams, the many-minded dreams are now irresistible - they become facts." - 'The Outward Urge' by John Wyndham

"The very essence of tolerance rests on the fact that we have to be intolerant of intolerance. Stretching right back to Kant, through the Frankfurt School and up to today, liberalism means that we can do anything we like as long as we don't hurt others. This means that if we are tolerant of others' intolerance - especially when that intolerance is a call for genocide - then all we are doing is allowing that intolerance to flourish, and allowing the violence that will spring from that intolerance to continue unabated." - Bren Carlill