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 building

Author
Message
Mucky Muck Ninja
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location: im not entirely sure
Posted: 8th Nov 2003 19:25
Can someone show me how to build stuff in an RTS game? I finally got the cursor positioning worked out and now I am trying to build stuff. However, im having a lot of trouble doing so.

Thanks for your time

Am I an Idiot...or is everyone else just really smart?
ReD_eYe
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 8th Nov 2003 21:21
you have to place a building object at the point you clicked on you landscape, without more information its kinda hard to explain.


Go on, click on my signature image, you know you want to
Favourite smiley>>>
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Nov 2003 08:47
Hmm, haven't actually done this part yet, but my first guess is to put each building you place into an array. Record the building type so you can determine the properties of that building. Hitpoints, type of construction properties, etc. Like building 1 is a house, building 2 is a barracks, whatever. You'll need to store the grid coordinates of the buildings for future use when you add the pathfinding for your units and what ever collision you might have.
I reccommend you plan out all your building types first before you start to actually code anything.
Mucky Muck Ninja
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location: im not entirely sure
Posted: 9th Nov 2003 18:52
im sorry, thats not really what i meant. I wanted to know how to build units. not place buildings. Like when you press the button and it starts to build, say a infantry unit.

Am I an Idiot...or is everyone else just really smart?
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 9th Nov 2003 22:26
posting example code of what it might look like would help too im trying to build a 2d RTS but i can't even get somthing as simple as the tiles to show up =(

http://www.freewebs.com/ingamers
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 10th Nov 2003 01:00 Edited at: 10th Nov 2003 01:04
******THIS IS ALL A GUESS, but is how i would try to do it*****
im assuming your makeing a stategy game.

inside your loop, make a varable, and when you choose to build set that varable = to like 1000000 (you would need to figure out how long you want it to take) and every time the program goes thru the loop have it minus 1 from the var. and when the var = 1, create the new object at x,y,z

now heres how it would look more in code, the syntax might be a bit differnt, and you might locate my code in a function or a differnt subroutein(sp?)

im sure there could be better, but i think thats how it would work

edit> oppsy, i guess you cant put the bold and italics tags inside of code

Two words, moo.
Metamophic
21
Years of Service
User Offline
Joined: 23rd Aug 2003
Location:
Posted: 10th Nov 2003 01:03
Foonman305, simply load the model, hide it and check if say, enter key is being pressed, and then show the model and position it.

psuedo code:
load object (yourmodel),1
position object 1,(whereeveryouwant)
hide object 1
if returnkey()=1 then show object 1

www.freewebs.com/metamorphicsoft
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 10th Nov 2003 04:13
I think a combination of PoHa!84's code and Metamophic's idea would be best...

try somethign like this:




Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 10th Nov 2003 18:31
when you say PoHa!84 did you mean me? i think you did that in another post as well

Two words, moo.
Mucky Muck Ninja
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location: im not entirely sure
Posted: 11th Nov 2003 04:39
thanks a lot!

Am I an Idiot...or is everyone else just really smart?
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Nov 2003 07:39
Determine what building is selected. Then refer to the building's type to see what options are available and have it display the proper menu of options.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 12th Nov 2003 04:45
Sorry Darwin... It's just that your both so alike i get confused... lol...

Sorry man...

Ill try harder next time...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2025-05-21 16:42:01
Your offset time is: 2025-05-21 16:42:01