We present a new Castle Game Engine component TCastleThirdPersonNavigation. You can use it easily with TCastleViewport to have a working 3rd-person navigation. This means that you control an avatar with keys (ASWD QE), and the mouse orbits around the avatar, who is displayed and animated in front of the camera.
You can move the camera around the avatar and control the avatar in various ways. All the inputs are configurable.
Avatar can run, crouch, with collisions, with gravity.
Camera follows avatar smoothly and avoids being blocked by walls.
Mouse can optionally also “aim” the avatar, which makes it easier to rotate the avatar. OTOH, it makes it harder to look at avatar’s front, e.g. at avatar’s face.
You can look closer/further at the avatar.
Avatar can have gravity enabled, so it can fall down and climb stairs correctly.
This work has been sponsored through Castle Game Engine Patreon. In particular thanks to Ramazan Geven and Robert Daniel Murphy for donating and requesting this feature! If you like what I’m doing — please support me on Patreon. Thank you!
Castle Game Engine is of course 100% compatible with it. I was watching and testing FPC SVN branch leading to this release. So I encourage everyone to upgrade their FPC installations. As always, we recommend using CGE with the latest FPC stable.
Note: Following our supported versions docs, you can also use some older FPC versions (we will maintain compatibility with FPC >= 3.0.2). So you don’t have to upgrade, for now we promise to keep compatibility with FPC 3.0.x for the next CGE release.
Tone Mapping is just a fancy name for nice-looking color processing, that makes the final look more visually pleasing. It is independent from the gamma correction (technically), although they both “change the scene colors” so are often considered together. We now implement 3 tone mapping operators (based on glTF sample viewer): see TToneMapping. Note that you can easily do your own color processing (thus providing functionality equivalent to these tone-mapping operators) by using Effect node like in this example: tone_mapping.x3dv from demo models.
This is a really easy way to request animation cross-fading (blending) which makes changing animations look much smoother. Just set this to some non-zero value to have smooth animation change. It’s the time in seconds, often it’s reasonable to start with something small like 0.1.
This is also configurable in the CGE editor (as it’s a published property). Our “New Project” template 2d_game is using it.
This also brings improved switching to the default state (like idle or walk) after Attack/Hurt. This makes animation change smoother for creatures using resource.xml, whether you use default_animation_transition or not.
The lights have to follow glTF extension KHR_lights_punctual. It’s a popular extension supported e.g. by Blender -> glTF exporter. So you can just add lights in Blender, export to glTF, open in CGE, and the lights are there!
This works for “punctual” glTF lights, which are converted in a very straightforward fashion to X3D lighting nodes: PointLight, SpotLight, DirectionalLight.
Saving screenshot to the best location, automatically determined: Container.SaveScreenToDefaultFile, lower-level SaveScreenPath. This is important as you cannot assume that your application can write to the current directory when installed. This featue is also already used by the editor new project templates (press F5 in 2D and 3D games).
If you use TCastleTransform.Direction and want to restore compatibility, just set TCastleTransform.DefaultOrientation := otUpYDirectionMinusZ; somewhere early (like in the Application.OnInitialize callback).
Our build tool now does output filtering to hide many useless FPC warnings that occur when using Generics.Collections. This is better than disabling these warnings through FPC command-line options, this way e.g. compiler will still warn about instantiating abstract classes.
view3dscene gets a new command-line option --project, automatically used by the editor if you double-click on a scene file in your project. In effect, the castle-data:/ protocol will also work as URL for textures etc. inside X3D, glTF and other files.
CGE editor has now context menu when you right-click on files section at the bottom. You can open file manager, delete the file, refresh the directory.
For PointLight / SpotLight, radius < 0 means “infinity”. This is useful to convert glTF lights, that may have range equal 0 to mean infinity. So we just convert 0 to -1.
If you click on “New Project” in the Castle Game Engine editor now, it will propose 4 useful templates:
3D FPS game
3D model viewer
I advise everyone, new and old engine user, to check out these templates. You can get the latest engine version from our main page, as usual. Just unpack and run bin/castle-editor executable. (Or you can get the source code from GitHub).
I tried hard to make these templates small but also very useful as a starting point.
They show how to use most important engine features (design viewports, scenes, basic UI in the editor), advise using TUIState to split your code into states, show how to react to basic input (clicking on game field to do something).