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 / RTS camera system

Author
Message
Soroki
19
Years of Service
User Offline
Joined: 26th Jan 2006
Location: United States
Posted: 28th Aug 2006 21:12 Edited at: 28th Aug 2006 21:14
I noticed most RTS stuff on here is for DBPro. I would like to know if anyone has a code for a DBC RTS camera system where you can pan the camera using the l and r mouse buttons and if you can zoom in and out. It would be helpful. I would search the codebase but my Internet access is too limited.

oh wait. I forgot the mouse push scrolling when it touches the edge of the screen.

If we're here to help others, what exactly are the others here for?
slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 29th Aug 2006 08:08
mouse scrolling part is easy for example:



reapeat for rest

the other ones require tinkering with the cameras position but not 2 hard

my smiles love me =-)=-)=-)(-=(-=(-=
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 29th Aug 2006 17:18
if mousex() > screen width()

Is this line possible?

I think it should be something like
if mousex() => screen width()
or
if mousex() > screen width() - 5
etc.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Soroki
19
Years of Service
User Offline
Joined: 26th Jan 2006
Location: United States
Posted: 29th Aug 2006 19:10 Edited at: 29th Aug 2006 20:32
I feel like a moron... that code is so simple, yet I couldn't make it! Thanks alot for the code. I didn't know that screen width()was even a command. I am still a novice coder and I have alot to learn. If you come up with a pan camera code, please post. I actually understood that code after reading it though. That seems to be a plus.

If we're here to help others, what exactly are the others here for?
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 29th Aug 2006 19:58 Edited at: 29th Aug 2006 20:00
Pan Camera? That's simple. Have a look at the CURVEVALUE and CURVEANGLE commands. You can use these to "curve" the camera's position and angle from one point to another. I made a function out of it. If you don't understand functions then you can read this:Function Tutorial
Anyway, here is the function:



And here's an example. Press space to randomly pan the camera.:



EDIT: OOOOOPS THAT WILL ONLY WORK IN DBPRO!!!!!!!!!!!!!

I now realize you probably meant the other kind of camera panning So I will demonstrate that for you in a bit. It's MUCH simpler than this.

Soroki
19
Years of Service
User Offline
Joined: 26th Jan 2006
Location: United States
Posted: 29th Aug 2006 20:31
Thanks, and thanks for the function tutorial link. Functions are pretty annoying when they get more complicated.

If we're here to help others, what exactly are the others here for?
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 29th Aug 2006 22:21
You'll understand them. Anyway, here's that PAN CAMERA example. I tihnk it's the right kind...



This one works in DBC too

Soroki
19
Years of Service
User Offline
Joined: 26th Jan 2006
Location: United States
Posted: 30th Aug 2006 20:33 Edited at: 30th Aug 2006 20:36
Hey slicer, I decided to code the scrolling part myself. I got this much and it works perfectly.



It works just fine, but the part where I have to scroll left and right gets annoying. I had to go to sleep so I couldn't try to figure that out. Anyone got some help?

Sixty Squares, thanks for that snippet. I should stop bugging you guys about RTS stuff in a day or so. I just needed cameras and how to build stuff. I can find a pathfinding code somewhere I'm sure.

EDIT: oh nevermind on the L and R scrolling. It's on Sixty Squares' snippet. Cool. Thanks all.

EDIT(again): forgot to say that the screen width() command does not work for me for some reason. My max screen width is 640. I just put the scrolling to where it would scroll when the mousey() hit the top of the screen. It is kind of annoying, having to test it out all night, but it worked.

If we're here to help others, what exactly are the others here for?
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 31st Aug 2006 04:33
That's fine, long as it works. As for the snippet, you're welcome Don't forget about those camera bounds I put in, else you're going to be able to scroll your way off of the map.

Soroki
19
Years of Service
User Offline
Joined: 26th Jan 2006
Location: United States
Posted: 31st Aug 2006 21:15
Alright.Thanks alot dude. I have been playing RTS games since Age of Empires 2, and I have always wanted to make one. This is a good start. If I need anymore help, I won't hesitate to ask. Thanks all at DB for helping me. I bet it gets annoying, but it's not like you have to respond, so .

If we're here to help others, what exactly are the others here for?
Uncle Sam
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 13th Sep 2006 06:51
Position a camera above the terrain, point it down and move it.

Uncle Sam
Nvidia Geforce 7600 GS 256MB PCIEx, 2.66 GHZ Pentium 4 proccessor, 768MB RAM
Need particles? Click here!
Soroki
19
Years of Service
User Offline
Joined: 26th Jan 2006
Location: United States
Posted: 13th Sep 2006 22:04
????What are you saying?

Downfall:Arena by A Squared Software is currently in development. Features full online or AI multiplayer maps, with 35 online maps and 15 AI maps. Demo release date will be somtime in October.
Uncle Sam
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 14th Sep 2006 07:50 Edited at: 14th Sep 2006 07:50
Exactly what I just said.

Position = to situate an item, person, etc. in a position in the 3d world provided.

a = a word you put between other words when you feel like it.

camera = the 3d imaginary device used to view a game

above = a higher elevation than something else

the = (see "a")

terrain = terrain, nothing to it

, = a useful character

point = aim and shoot...sort of

it = Megaton Cat...jk

down = opposite of up

and = (see "a" again)

move = get off the couch

it = (see "it")

Understand now? Hope that helped.

Quote: "Trying to get money for FPS Creator"


Why?

Uncle Sam
Nvidia Geforce 7600 GS 256MB PCIEx, 2.66 GHZ Pentium 4 proccessor, 768MB RAM
Need particles? Click here!
Soroki
19
Years of Service
User Offline
Joined: 26th Jan 2006
Location: United States
Posted: 18th Sep 2006 21:13
dont be an a$$

Downfall:Arena by A Squared Software is currently in development. Features full online or AI multiplayer maps, with 35 online maps and 15 AI maps. Demo release date will be somtime in October.
Uncle Sam
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 19th Sep 2006 07:09
Well excuse me for being thrifty.

Uncle Sam
Nvidia Geforce 7600 GS 256MB PCIEx, 2.66 GHZ Pentium 4 proccessor, 768MB RAM
Need particles? Click here!
Soroki
19
Years of Service
User Offline
Joined: 26th Jan 2006
Location: United States
Posted: 19th Sep 2006 20:38
I speak perfect english and happen to be from the US, so when I asked you what you meant by your post, it was meant to sound as though I didn't understand why you posted after all my questions had been answered. I didn't need your own version of the dictionary to understand what you said. As for FPSC, I really enjoyed the demo and I have enough money for it, so I am going to get it.

Downfall:Arena by A Squared Software is currently in development. Features full online or AI multiplayer maps, with 35 online maps and 15 AI maps. Demo release date will be somtime in October.

Login to post a reply

Server time is: 2025-05-25 22:01:09
Your offset time is: 2025-05-25 22:01:09