It’s been a few weeks since my last Escape from Alcatraz update, during which time I have implemented a camera system based on multiple fixed cameras, and point-and-click movement with navigation mesh pathfinding.
Week Two – Springfield
As an exercise to become better acquainted with the ins and outs of the Unreal Editor, a group of more than twenty students teamed up to recreate (parts of) Springfield – The Simpson’s fictional home. The group was sub-divided into four groups, each with its own leader. I was the leader for the Evergreen Terrace group. It was our job to recreate the Simpson’s home, Ned Flander’s home, the Simpson’s other neighbour, and the President’s Mansion opposite the Simpson’s. The latter was my task:
Week Three/Four – Cameras, Point-and-click
After blocking out some basic levels (like the one you can see in the video above) I implemented a simple fixed camera system using Kismet. Essentially, whenever the player walked into a trigger volume, an infinitely looping matinee sequence would activate, changing the perspective to a camera actor object placed in the level. While this worked well enough, it was pretty messy Kismet logic, and it’s not particularly flexible.
Eventually I decided to rewrite this system using UnrealScript – storing a reference to a camera actor in a custom CameraTriggerVolume object and dynamically switching camera in the code. Not only is this approach cleaner, it also allows me to be more flexible about when I update the camera. When it comes to movement, for example, I can instruct my main camera class to update to a new viewpoint when, and only when, the player has stopped moving.
The most interesting task this week was implementing point-and-click movement. I began by deprojecting the 2D mouse coordinates and tracing from (read: near) the camera through the resulting 3D position to find the location at which my cursor “hits” the world beneath it. With this information I was able to make sure the player always faces the cursor, and also move to the position under it, assuming there are no obstacles in the way (verified by an additional ray trace).
With this basis in place I looked into the ways in which the Unreal Engine 3 handles pathfinding. Prior to the UDK, pathfinding was achieved solely with the use of way points and path nodes placed in the editor, but this is no longer true. UDK now supports pathfinding via navigation meshes â€“ a representation of the world made out of convex polygons. Not only do navigation meshes result in more realistic AI pathfinding than do way points, they can be automatically generated in the UDK editor!
The AIController class features an example of navigating via NavMeshes, which I was able to use and learn from. The result can be seen in the previous video. So, what’s next? With point-and-click basics in place I can start looking into implementing some actual gameplay, something for the player to do. My intention is to start with item collection and/or some simple NPC interactions. Until next week!