3d rts?

Blitz3D Forums/Blitz3D Beginners Area/3d rts?

Pete Carter(Posted 2005) [#1]
Does anyone know of any resources or tutorials on doing an rts in blitz 3d im trying but my camera code sucks and i havent got the mouse selection and movement quite right. if anyone can help that would be great! :O)


octothorpe(Posted 2005) [#2]
While I don't know of any resources or tutorials, I'm sure you can get plenty of advice and examples right here on the forums. You may find you get more/better responses if you ask specific questions on individual topics.

Most real-time strategy games' cameras are simple things - always rotated so that North is up and tilted a bit so that you aren't looking at only the tops of things. They translate about along the X and Y axis when the player holds an arrow key or positions the mouse at the edge of the screen. The camera stays a specific height above the ground at the centre of the screen - to find the height of the terrain at the centre of the screen, use a LinePick straight down from North of the camera (the more the camera is tilted, the further North the centre of the screen will be), to which you would add your camera_floating_height constant.

Unit selection typically involves allowing the player to click on an individual unit or drag a rectangle around several. CameraPick solves both of these problems: finding the unit under the mouse or finding the start and end points for the rectangle on the terrain.


Matty(Posted 2005) [#3]
Rather than using camerapick which can be slow you can use cameraproject and loop through the units which are in the camera's field of view and if the mouse coordinates is near the projectedx(),projectedy() then this can be used.


octothorpe(Posted 2005) [#4]
That's a cunning trick, but it suffers at least one potential drawback: the player may click on the top of a unit and find that the game has selected the unit behind it (because the mouse was closer to the centre of the second unit.)

"Premature optimization is the root of all evil." - Donald Knuth

I haven't found one CameraPick per frame to be very CPU intensive, but your mileage may vary. I'd wait until it becomes an obvious bottleneck before replacing a simple and elegant solution.