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 / check to see where the object is on the *screen*

Author
Message
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 6th Jan 2004 07:39
i have a 3d object as my mouse pointer (object #1), but i want it so if it goes to the edge of the screen, it will move the camera in that direction (ie: if you put the mouse to the right edge of the screen, it will move the camera to the right...like in strategy games)

any ideas?

heres my source, just in case you might need it


Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 6th Jan 2004 08:36 Edited at: 6th Jan 2004 08:37
Here mate, I am making an RTS atm, and I have exactly what you are looking for:



And before the start of my main loop i have:



Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 7th Jan 2004 00:35 Edited at: 7th Jan 2004 00:45
thanx...i didnt know you were making an RTS...funny, so am i maybe i'll actually finish it this time...im actually planning everything out...im just getting the basic engine down, so i can start playing with some AI for that comp.
thanx again JT

i'll be havnign a look at that in a few hrs

JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 7th Jan 2004 02:46
ok, here's is where i hit a predicament:
i could use a mouse point to do this, but i dont know where in the "world" the mouse i. or make my own 3d object and use the mouse pointer, but i dont know where on the "screen" it is....if you get what i mean.

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 7th Jan 2004 05:04
Hmm, I don't quite understand you...

But, for where the object is on screen, you can use the Object Screen X(#) and Object Screen Y(#) commands.
They return whereabouts on the 2D screen the objects are.

PS, good luck on the RTS, the main problem you may come across is handling over 100 units at a time, and the collision.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 7th Jan 2004 06:15
SERIOUS??? dang, that should work! thanks!! that helps a TON!

JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 7th Jan 2004 06:24
yes, it all works how i want it to!! thank you so much JT

Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th Jan 2004 07:24
You could do WC3 style collision. Only 1 unit per grid square on the map. If the character's current square is the same as an enemy's grid location, then they've hit! To keep FPS up, I'm doing a WC style. As in, you can only have a handful of units selected at a time. Where as C&C, you could have thousands.
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 7th Jan 2004 07:35
yup
i was planning on having a limit of about 10
but thats not for a while

and grids...grids are good

i dont plan on mine being really 'powerfull' or anything...

ps: how do you like my Avatar?

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 7th Jan 2004 13:59
Glad to have helped.

Phaelex, that's a good idea, but in my RTS i want everything to be free-moving, so having "Grid squares" won't cut it. But so far I have managed to save a fair few FPS with wise codeing, and minimal unnecesary loops.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Jan 2004 16:41
@Jess, Movement wouldn't have to look grid-like, merely act as waypoints and locations throughout the map. You could just do a distance formula to see if two things have collided.
So, what are your guys' themes of the game? I was gonna aliens and humans on mars, but seeing as how the contest is over, I'm going back to my original plan. Humans and vampyres.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 9th Jan 2004 03:59
"Movement wouldn't have to look grid-like" yeah, i know, that's not what i meant. I want collisions to be poly based, so that nothign is restricted. Thus, you don't get those horrible white spaces in formations when alot of units are bunched up together, because it doesn't require there to be a blank grid.

You just keep moving till a collision.

Theme at the moment is just to make the engine, once that's done... Dunno. lol.

I was thinking of making it a here and now type of RTS ( haven't seen any of them before ) where the units have hand-guns and there wouldn't be any archers, but instead maybe a basic unit ype would throw mini petrol bombs etc etc.

Somethign that would fit in with todays weaponry of the "common" people, ie, not military...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Travis
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: West Aust.
Posted: 9th Jan 2004 04:50
u should make it gang wars ... ppl with hand guns and uzi's and u can have vehicles for drivebys and u can occupie vacent houses ...it would be sweet ...i wish a major game company would make somethin like that
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 9th Jan 2004 05:01
lol, ok, thanks for the idea Travis.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 9th Jan 2004 07:49
i was thinking of the "dominant slave race", it has NOTHING to do with ethnic races at ALL...actually i am going to have 3 or 4 races including: HUmans, trolls, elves, dworfs...still just writing down ideas if they come...i'll get it all together...i dont want to go to deep into what im doing, because im so far from done...just barly started
im starting to design the basic selection and such...and whilst im on the computer im programming my AI for the comp (if its still on....the AI comp that is) if you really want to know my ideas of "training" units, you can ask, im thinking it's fairly original.

Login to post a reply

Server time is: 2025-05-22 09:11:44
Your offset time is: 2025-05-22 09:11:44