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 / Few RTS questions

Author
Message
zeeenza
18
Years of Service
User Offline
Joined: 2nd Jul 2006
Location:
Posted: 5th Sep 2007 04:50 Edited at: 5th Sep 2007 06:09
I started my first RTS project in DBP yesterday and have a few questions. First, I've made a media-free version of it to post here.



First of all, is there a way to make the unit(s) turn before moving in a direction instead of just instantly pointing in that direction?

Secondly, currently if you move multiple units at the same time, they stack on top of each other when they reach the target, thus making them hard to individually select. Can someone suggest a way to make them avoid each other. This may be hard to do because, as a solution to the fact that the units rarely reach their target down to the exact coordinate thus move back and forth in their target area, I made them stop within 1 coordinate of their target.

Thirdly, how do I make you can also select a unit simply by clicking on it? Right now, the only way is to drag a box over the unit(s) you want to select.

Finally, I'd appreciate any suggestions of a better way to write this code.

Thanks

Windows Vista Home Premium :: Intel Core 2 Duo - 2.2Ghz :: 2GB System RAM :: nVidia GeForce 8600M GS - 511MB VRAM
Jeff032
17
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 5th Sep 2007 16:16
The pick object command combined with mouseX() and mouseY() is what you would want to use to select individual units.

-Jeff

Space Game WIP
HeavyAmp
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location: Castle in the Sky!
Posted: 7th Sep 2007 03:22
To get the objects to turn then move in the new direction is easy.
Find the angle the object needs to move in to get to its direction using atanfull() then give the object a turning speed and get it to turn from its current angle to the angle it needs to move in. Once its angle has finally reached the angle it needs to move in then start moving it.

You probably want to check which is the quickest way to turn to reach the desired angle also.

Better to be dead, than to live your life afraid.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 8th Sep 2007 00:19 Edited at: 8th Sep 2007 00:23
Quote: "
...if you move multiple units at the same time, they stack on top of each other when they reach the target...
"


use 1 of the units as reference and find x/z offset data for the other units.

with that, you can either a) assign individual targets for each unit or, b) move the reference unit and update the others based on the offsets.

your terrains + AI will help you decide which is better.

Virtual Nomad
AMD XP 1800+ (~1.6 Ghz) / 1.5 GB RAM
ATI Radeon 8700LE 128 MB / Windows XP
Dark Dragon
17
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 8th Sep 2007 00:53
cant say much as i dont use dbpro but if it still has it, use object screen x and y,with mousex and mousey.
Jeff032
17
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 13th Sep 2007 16:30
Quote: "use object screen x and y,with mousex and mousey"


Don't use object screen x and y with mousex and mousey, that will cause only one pixel on the whole screen to actually select an unit.

Quote: "The pick object command combined with mouseX() and mouseY() is what you would want to use to select individual units."


-Jeff

Space Game WIP

Login to post a reply

Server time is: 2024-11-26 09:51:24
Your offset time is: 2024-11-26 09:51:24