City Battle Drones
2018
#C++ #OpenGL #GLSL #Xcode #Graphics
City Battle Drones is a single-player PC shooter developed using OpenGL and C++.
The player controls a drone flying through an urban city and must battle an AI controlled drone.
All mesh construction, texture-mapping, graphics, and collision are handled within the program.
There are three view ports.
The largest is a third person view, the second is a first-person view with a spotlight, and the third is a map that indicates the position and orientation of both the player and enemy drone.
The missiles shot by the drones have homing capabilities, and will destroy their target on impact.
The player can move in 6 directions, and the camera can be zoomed in or out, to change the third-person viewing distance.
City Builder Editor Tool
This is an OpenGL C++ program that allows the user to create buildings and streets and manipulate their form using scaling and extrusions. The city in ‘City Battle Drones’ uses exported mesh data designed with this tool.
View it here on GitHub.
The program is split into three viewports:
World Viewport: on the left, which is the view of the city
Base Viewport: on the top right, which shows the base of the currently active building, if there is one, whose xz cross-sectional shape can be modified by pulling and dragging on the control points. They can only be dragged diagonally from the centre of the base.
Spline Viewport: on the bottom right, which shows the poly line representing the vertical side of the currently active building, if there is one.
By dragging the control points left/right, the user can alter the scale of each floor, thus changing the vertical profile of the building. This creates smooth, curvy looking buildings.
Edit Modes
The user can construct either streets or buildings with this program. In Street Edit Mode, the user can generate, modify, and place new streets. In Building Edit Mode, the user can generate, modify, and place new buildings. Press the 'e' key to toggle between the two modes.
Building Creation
In Building Edit Mode:
Pressing the 'g' key creates a default building. It will be the active building since it's the one the user is currently editing.
The active building has a redder/pink colour tone, while all other buildings and roads have a blue/grey colour tone.
If 'g' is pressed again, a new building is generated and the "current active building' changes to it.
The 'active building' can:
Be scaled in the x direction
Be scaled in the z direction
Be scaled in the y direction
Be rotated around the y-axis
Be moved forward/backward, left/right with respect to the direction the camera is facing
Have the number of sides changed dynamically, the default is 4, minimum is 3
Have its base shape be changed using the control points in the top right viewport
Have its floors scaled by a spline function using the control points in the bottom right viewport
Street Creation
In Street Edit Mode:
Pressing the 'g' key creates a default street. It will be the active street since it's the one the user is currently editing.
If 'g' is pressed again, a new street is generated and the "current active street' changes to it.
The 'active street' can:
Be scaled in the x direction
Be scaled in the z direction
Be rotated around the y-axis
Be moved forward/backward, left/right with respect to the direction the camera is facing
Camera
The camera can be moved along the hemispheric dome of the city, and always points to the origin. It can zoom in and out.