0 registered members (),
1,119
guests, and 0
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: RTS Project
[Re: MasterQ32]
#351451
12/25/10 02:23
12/25/10 02:23
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
Thanks for the link Richi007, I'll be sure to look into that! Ok, now I have yet another question! In my game I want to allow the player to select multiple units through a selection box. I currently use "mouse_dir3d" to c_trace into the 3D world from the camera position and issue orders, select units, etc. However, when the user creates a selection box and lets go of the mouse button, the game needs to "trace through" all of the pixels in the selection box to see if a unit resides there. Basically the loop looks like this:
for( x=box_start.x; x<box_end.x; x++ )
for( y=box_start.y; y<box_end.y; y++ )
{
// do some tracing!
}
My problem is that while mouse_dir3d handles all of the calculations that determine the direction vector for tracing, those calculations aren't made available for me to modify and apply to any pixel on the screen (rather than the one the pointer currently resides on). So how can I "trace into" a pixel on the screen without moving the mouse and using mouse_dir3d?
Last edited by Redeemer; 12/25/10 02:26.
|
|
|
Re: RTS Project
[Re: MasterQ32]
#351454
12/25/10 03:07
12/25/10 03:07
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
Thanks for the swift reply Richi007! That function will save me a lot of time and effort. Actually, by the time you had posted your reply, I had almost come up with my own algorithm. It was almost perfect, but there was a severe error in my calculations that was causing mouse clicks on the lower right side of the screen to affect things on the upper left side of the screen, and vice-versa for every other direction I chose. Oh well, that's just talk. Thanks again, man.
|
|
|
Re: RTS Project
[Re: Saturnus]
#351473
12/25/10 15:51
12/25/10 15:51
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
Geez, should've thought about vec_to_screen! Man, it's been way too long since I've used Gamestudio. Thanks man. I'll try applying that method to my own game. EDIT: Yep, works like a charm. Thanks again, Saturnus.
|
|
|
Re: RTS Project
[Re: muffel]
#351501
12/25/10 22:41
12/25/10 22:41
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
@EpsiloN: Unfortunately I don't have Photoshop and there's no way I'm going to try downloading it on my connection, so that won't work. :\ Besides, I think I'll be ok without having slopes. It makes the game that much easier to program, since I don't have to deal with path finding between multiple floors. I'll keep the mountains and dips in my terrain, though, to provide obstacles for ground units. Of course I can also make air units that can move over these obstacles without problems. On that same note, unit selection and ordering is working, so now I want to add path finding. I've played around with the scripts MrGuest referenced to me, but I noticed that both their speed and accuracy drops dramatically when there are a lot of nodes in a level. So I was wondering, what do most game developers do to solve this problem? I'm guessing they precompute the various paths available to the AI before the game even starts, but how is that accomplished?
|
|
|
|