Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / 3D Space Simulator Radar and Quarternion problems

Author
Message
=C=
21
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 9th Jun 2003 19:53
I created this thread in order to assist myself and others who design 3d Space Sim games and use the ‘Airplane in space’ approach.

My main problems and I am sure of other developers too, are:

1 - Euler Angles and their shortcomings to Pitch Roll and Yaw angles movement. Using Quaternion style rotation method solves this.

2 - Designing an Accurate Radar system, one that will give a basic functionality of plotting the 3d Environment objects on a small scale in relation to the Player’s position.

Question:
I understand that dark basic supports the Quaternion method but how?
Is it readily available by using the Pitch and Roll commands?

There are plenty resources on the web that describes how Quaternion maths work but hopefully DB developers were kind enough to encapsulate this in the main commands of the language.

About Radar systems:
A bit of a research on the web has revealed to me that there are plenty approaches for designing a radar system.

One is the 3d to 2d representation, a bit like Elite used to have as a scanner. Blips are plotted on a screen space centered and around a point representing the player.
I have used this approach and got a fair way with it, never actually managing to make it constant and accurate. The more I Fly around the space area the more the objects seem to loose their position in my radar… I will include my ‘work so far’ in a demo ASAP.

Another method is to use the distance between player and target, and them point at the target and plot the blip on a 3D system. I haven’t done any code around this idea but when I do I will stick it here.

But for the time being, anyone who has the same problems or anyone who has any answers, codes, methods or even applied knowledge to these two problems is more than welcome to post here in this thread.

Please keep the thread specific to 3D Space Flight Simulators and Angles, Radars and maybe even Compasses.

My email is checked daily so feel free to contact for this subject!
anthrakas@hotmail.com
-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy
Muddleglum
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: New Zealand
Posted: 12th Jun 2003 03:44 Edited at: 13th Jun 2003 01:47
mmm .. i don't believe there is any accessible use of quarternions in DB .. or even that they are used internally. ( expert comment from others ??)
There is a possibility they were used with DB classic to obtain the object angles x,y,z when an object was subject to free flight commands. "swift" was the ( american?) forum man responsible but he has moved to blitz 3d i think.
This method may have continued with Pro .. though comment still indicates confusion about the full state of Pro free flight function, and angles returned.
( no, I don't have pro. and won't till all free flight bugs are gone)

Just a couple of thoughts ..

The free flight commands alone will provide a reasonably accurate IMITATION of plane style flight. I say imitation because space is an odd case. A plane flies and angles as it does because of the fixed gravitational direction.

Quick edit for clarity here..
I first roll, or pitch or turn the DB axes of the plane object directly but then modify angle reactions based on the direction of gravity.
When i quickly experimented with space 'flying' one made the roll etc. changes first but had to leave out the later reactions .. making axis changes proportional only to the current degree of roll input s being applied. Once control input was stopped reaction was 'faded' away - as if there was air in space to oppose the angular change and slow it. ( In theory a space craft would continue to rotate indefinitely . Very un-plane like.)

So that when you have completed your 'turn' the gravity can now be assumed to be straight down in relation the crafts new orientation. It is a slightly odd flight path to observe from a fixed viewpoint but it is the only way to have the apparent turn appear the same to the pilot however the craft is currently angled in space.
Inertia and momentum effect on control input/ object reaction did help with realism.

A radar map ..
Relatively simple when there is a horizontal plane for reference, very tricky when there is not!
Simply 'pointing' at an object for example, is based on the standard DB world horizontal plane. The z angle is zeroed, then the pointing is done with x,y.
You could cheat and work out some sort of space and planets etc, that does use a horizontal plane ??

Otherwise you would have to refer every radar object to the current plane roll and pitch angle .. which can be anything with free flight.

the only thing that springs to mind ( without quarternions- which definitely don't spring to this mind !!!) - is that you could work out RELATIVE direction from the object screen coords and object range together.
The screen coords are automatically giving you the above/ below, left / right of the current direction.
you would need to check the object being 'in front / behind' the current direction of the craft as the screen coords duplicate ahead/ behind.
then translate that into a radar screen of mini 3d objects .

WAIT ON!
hey hey !!
why not use the 'objects on radar ' coords, and manipulate then by simple division to mini scale and have a mini 3d world of the larger world, (coords displaced) centered in front of / below the pilot .
So simple!! the pilot craft angle would make it all appear in correct relation. No trig. etc.
I must have seen that method somewhere in the forum ?

well well.

good luck . muddleglum
=C=
21
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 12th Jun 2003 12:12
Thanks Muddleglum, I am goign to read your responce a couple more times when the boss is out because you give a few ideas in rapid fire mode, for this I am greatfull.

About the quaternions, and this is a quick one, i only assumed they use them in free flight because i've read it in an interview with the dude that made spacewrath, a 3d space shooter. He said he was happy when DB implemented Q's in it's free flight mode.

Now about the Radar, the scanner, the sensor, or whatever people call it (I call it Fred) the ideas behind designing one are fundamentally simple. But when it comes to implement it, oh boy...

I only just starting to understand the 3d world properties, only being involved with 3D programming for the last month or so...

I will describe my radar: A sphere with limbs, of mini spheres. It is created just before my pilot object and screen (pos 0, -4, 10) and is locked there. ghost on etc.

There is a loop that adds limbs (spheres) as many as my visual objects are. then there is a function called refreshRadar. This calculates the xyz of each visual object and scales it down and positions it in relation to the player_centered system.

This makes a fab visual object that behaves like a radar, untill you start moving. After a bit of Roll Yaw and Pitch you realise that the relative position of the radar blibs are fine but the orientation the radar suggests is out of sync with the orientation of the pilot ship... and you get lost quite quickly.

Oh well back to the old drawing board. What I am doing now is getting my follow camera and player object to move and behave in sync, I think it is not that bad at the mo but I have to make sure and be confident. This things you need to build them from the bottom up.

Anyways, when I get to a point that i am happy with what I have I will post a very simplified demo, something that will help others learn more than provide a complete solution.

I mean if we wanted to play a space game we would buy one (one with a lovely radar screen) of the shelf, the whole idea is to make one and learn how... Right?

-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy
Muddleglum
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: New Zealand
Posted: 13th Jun 2003 09:28
quote -- 'the whole idea is to make one and learn how... Right?'

absolutely .
Anyway.sounds like you are on the right track already with your refresh radar .which sounds a bit like what i was suggesting above.

I will assume that the probelm is ( to restate it ) that this mini world has the radar objects in the right relation to each other, but they are not in the right relation to the orientation of the ship.

IF this is so ... IF.. the problem is most likely that locking to the screen will hold th eobject in the same orientation as the craft ( or camera view in fact) You don't say if you are trying to calculate some rotation to apply to this radar object but it shouldn't be needed if you can just make it stay at the 0,0,0, original orientation.
That was why i suggested sperate objects reduced and located around a constant point in front of the pilot.
You should be able to do this with your mini world.
Have an extra dummy object ( hidden) and postion it each loop, at the coords of the pilot craft.
use 'set orientation ' to make dummy object align with the craft then 'move' it forward say 4 units or whatever to bring it into the position where you want your mini world.
You can also pitch it down a bit first before the move if you want it lower in the view,
the just postion your mini world radar at the x,y,z coords of th e dummy object.
It should retain the original orientation and hence appear right in relation to the pilot . .... IF i understood the problem correctly!!


There is another way to postion th e mini world using a mesh permanently attached as a limb to th e craft object and offset with offset limb comamnd.. It's world coords ( limb position x etc) will - as long as the parent object is not 'hidden' - give the postion for the radar object.
I am out of time ..

muddleglum
Muddleglum
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: New Zealand
Posted: 13th Jun 2003 09:32
curses... haste .. haste th e reason i gave the particular methods above is that they will workd when -and if -you use full free flight rotation to travel at any angle in space .. i saw your other code in the forum , and you could use simple roations with it. but the above has more potential.

Argh must go.
=C=
21
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 13th Jun 2003 14:51
I understand exactly what you are saying. (bit deangerous to say that!) You are right about the radar problem I have.

offseting tiny limbs (blips I call them) on the different between player object and target object xyz coords is ok but it is half the work done.

What I want is a point and move method, but with limbs alas is not readyly available.

So I have a blip, i point it to the target, i move it in a mini scale towards the pointing direction and presto, 'where it was' is where I am, 'where it is' is where the relative position of the target is.

I'm currently flirting with the idea to design my flier with enough limbs that hold positions around my camera. I can set my radar, internal external camera and two side limbs, for guns for example.

The question is, for a player object with 'enough' limbs is it costly enough to avoid implimenting it, as a short cut, for positioning objects around the player/camera position?

You suggest:
> Have an extra dummy object ( hidden) and postion it each loop, at the coords of the pilot craft.
use 'set orientation ' to make dummy object align with the craft then 'move' it forward say 4 units or whatever to bring it into the position where you want your mini world.<

and I respond. AHA! Ofcourse, this way it does all the hard work for me. I had a bit of a problem calculating the new xyz for the radar center. all this time I was trying to get the players xyz and subtract small values to position it infront of me, the calculate the angles and new position with that. I was doing it the maths way, failing realy due to lack of maths experience. I skipped too many math classes back in the 80s I did lot's of english tho! )

I was wondering. I have a limb radar sphere (tm) and is locked on place. but is not moving. i wonder what effect will it have if it is moving and is unlocked. maybe the set radar to player orientation is more succesfull, i dont see how but maybe...

I will use the free particles radar (tm) method you suggest up there, failing the limb radar sphere (tm) experimentations. I would like to see if I can devise a way of rotating it that give accurate positions.

This weekend I will try to make a wrap. you will know I succeded because I will post the result as a simple code demo here. Unless you advise otherwise.

UF Long Respond!

-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy
=C=
21
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 14th Jun 2003 00:47
Muddleglum

I was geared up for a weekend of radar making.

I got home at 17:00 from work, had did the supermarket, had a BBQ in the back garden and then after I cleared up a bit decided to sit and work on the ideas and mainly the specific direction you gave me.

To recap, I have had the idea of point and move calculated on distance between radar and target. I had a writers block when it came to the 'static' point in space where my radar lives. You solved this problem for me.

It is 21:35 and I have a working radar that is sexy indeed! x-d

As I said I will devote some time to make a script to post on this forum. But I am a very lazy guy when it comes to this so guys, If you are in a hurry, do email me or leave a post and I will oblidge to help you like Muddlegum helped me.

Regards!

=C=

-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 16th Jun 2003 19:20
First, =C=, I like the picture. Battle of the Planets, yes?

Fearless orphans ... etc. etc.

Also, if you are seeking inspiration why not download the source code for Elite: The New Kind? Christian Pinder's master website has been taken down after a complaint from David Braben but you can still find copies of the compiled version and the source code by conducting a google search.

The code is in C so its fairly easy to understand.

=C=
21
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 18th Jun 2003 01:27
Oh the good old Elite, It started all you know.

It is a masterpiece. A work of art... A clasic. I still play it you know.

And I still watch BOTP, I am stuck in a time warp back in the 80s one might say!

I do have the code, i used it to make my first radar efforts, using plots, or as they call them Lolipops in 2D. It is the best design of a radar when it works!

Still I am using a 3D method now and it works like a charm.

Anyway I always love to take any chance and praise ELITE...

-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy

Login to post a reply

Server time is: 2024-11-24 18:45:27
Your offset time is: 2024-11-24 18:45:27