dim3 Forum

Full Version: RTS camera
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is somewhat an extension of "RTS movement", but how would you do character selection and stuff, where you have to move the camera, select a character, etc.. Should I just have a Player object with no model and a chase camera, that "takes over" the characters like vehicles? And is there some way to select and command multiple characters at a time?
Hey I'm trying to creat an RTS as well. I'm sorta doing what you described.
The player is modeless and flies. It has one weapon, which can fire a 'select' and 'clear' ammo. Both are invisible and instant-fast.
Due to the fact that controlling a lot of units would be difficult otherwise, I have all units organized into 'squads' of 5. Each squad has a contactless, invisible, 'leader' that the members follow. Each of these is assigned a number, as well as a 'target' object. The leader follows the target. This is hidden at first. When any member of a a squad is hit with a 'select' , its selected, turns on a mesh with a green selected circle around it. Then, whenever a 'select' hits a wall or floor, it sends a message to the 'target' to become visible and teleport to that location. Shooting another squad with a 'select' will hide the first squads 'target' and select the other one. Shooting a 'clear' anywhere will automatically unselect all squads. When a squad is unselected its in 'shoot all enemies near' mode. The squads are based off the old civil war soldier script. I'm still working on combining squads, waypoints, patrolling... etc.
Sad As for path finding I'm not really sure. Mine is outside, so it will require less pathfinding then your indoor one. I'm thinking of a system of four nodes in a square around all obstacles (canyon, building) where when a squad gets close enough, it will automatically walk to the opposite one.
That's a good idea, thanks a million. But if I understand you correctly, you can only select one unit(or in your case squad) at a time?
Well thats the way I'm doing it. You can have more (the following explanation is theoretical). My rts system is rather imperfect, what with the target objects and all, and I found squads an easier way to start.

You'd have to have a maximum cap on the number selected. One data has the current number of units selected. Then you have a set of datas (say, 10) that would contain the ids of the units selected. These datas would be changed in the select or deselect function of the individual units. Then, in the select projectile, in the hit function, if it hits (selects) a unit, it finds the first id data that was empty, and change it. If it hit the map (target) it gets the num of units data, and replays the send message to unit for [num of units data] times (with the different squad ids substituted in obviously).
The clear projectile could simply change all the num of units datas to 0, along with its previous functions.
Now I just thought of that on the spot, not sure if it'll work right. Good luck.
Reference URL's