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.

DarkBASIC Discussion / 3d rts mouseclick

Author
Message
Red general
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: United Kingdom
Posted: 5th Mar 2003 21:53
I have a problem. I am making an RTS game, but even though I can select the units, and make them all move into co-ordinateds 0,0,0, I have not been able to work out any method to work out a 3D co-ordinate for them from the 2D mouse co-ordinate, and then make the selected units move to that part

Any help welcome
THANKS
RED GENERAL
My computer melts regulary - perhaps it likes being fondue
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 6th Mar 2003 00:56
The easiest way to do an RTS mouse is to have a 3d object which moves by the mousemove commands, but doesn't correspond to the 2d mouse coordinates at all (or at least, not exactly). If you have a fixed view, you can probably get the mouse object to move realistically with the mouse, since with a perspective view the mouse would move less in screen coordinate terms the further away it is.

For an RTS I started, I had an almost top down view. This allowed me to just have an object (plain) which moved with mousemovex, and depending on the x and y distance from the current camera position, it would scroll the screen. To get 2D coordinates for the GUI, I just got the object screen x() and y() for the mouse object, and positioned a mouse cursor sprite at that point. It was almost indistinguishable from mouse movement, but only just. This allowed me to have 3D selection and 2D button clicking using the same object.

Once I was but the learner,
now, I am the Master.
Red general
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: United Kingdom
Posted: 6th Mar 2003 16:56
THANKS Darthster

RED GENERAL

My computer melts regulary - perhaps it likes being fondue
Red general
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: United Kingdom
Posted: 9th Mar 2003 14:38
Had a little problem with getting the plain to exactly move with the mouse, so this time the mouse moves with the plain (plain position is increased/decreased by mousemove, and the mouse is always positioned over the plain). Works fine, but it is a little juddery

Also so far tired to have some large sprites for the gui, but this really slows it down. next I will try it with plains and click on it using the same system as before with the units.

More news coming soon, (also a possible website)

Finally I think that the RTS should be called Dark CHI

RED GENERAL

[/i][i][i][/i]

My computer melts regulary - perhaps it likes being fondue
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 9th Mar 2003 21:49
You don't need to use the actual mouse coordinates at all, you can move the object with mousemove, and then hold the screenx and screeny of that object in separate variables, and use those variables as the mouse coordinates instead of the actual ones.

Once I was but the learner,
now, I am the Master.
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 10th Mar 2003 01:29
don't use sprites if you want to make a good game; when you've got too much of them it will become way to slow

its faster when you use the paste image command

when you'll have such images that move across the screen you'll have to paste the background again, and then paste the other images at new positions

Login to post a reply

Server time is: 2025-05-15 23:16:11
Your offset time is: 2025-05-15 23:16:11