| 1 | # First-Person Shooter example |
| 2 | |
| 3 | Example of a fully-working 3D FPS game using "Castle Game Engine". We have: |
| 4 | |
| 5 | - level, |
| 6 | - creatures, |
| 7 | - items (medkit and weapon), |
| 8 | - inventory, |
| 9 | - player can be hurt and die, |
| 10 | - player can shoot and kill the creatures, |
| 11 | - bump mapping, |
| 12 | - move limit, |
| 13 | - sectors/waypoints (for AI), |
| 14 | - buttons, |
| 15 | - notifications, |
| 16 | - custom viewport, |
| 17 | - sounds, |
| 18 | - sky, |
| 19 | - water, |
| 20 | - footsteps |
| 21 | - and a *lot* of comments. |
| 22 | |
| 23 | ## TODO |
| 24 | |
| 25 | This example doesn't yet use _Castle Game Engine_ editor to setup level and creatures on it. See `examples/fps_game` for a new version that uses the editor to setup the level. |
| 26 | |
| 27 | ## Keys |
| 28 | |
| 29 | Move and rotate: |
| 30 | |
| 31 | - use AWSD or arrow keys, |
| 32 | - you can activate "Mouse Look" by F4 (or click a suitable button on the screen). |
| 33 | |
| 34 | Inventory: |
| 35 | |
| 36 | - use current item by Enter, |
| 37 | - change current item by [ ] or mouse wheel, |
| 38 | - drop item by R, |
| 39 | - attack (with currently equipped weapon) by Ctrl key. |
| 40 | |
| 41 | A lot more keys and mouse shortcuts are instantly working |
| 42 | (and they all are configurable, too). |
| 43 | |
| 44 | All input shortcuts are TInputShortcut instances. |
| 45 | The CastleInputs unit has a list of all global shortcuts (useful to allow |
| 46 | users to configure game keymap) in InputsAll variable. |
| 47 | Of course you can use it to present to user some "Configure controls" menu, |
| 48 | see castle-game for example. |
| 49 | |
| 50 | The ExtraViewport in right-bottom part of the screen uses Examine camera, |
| 51 | so the view there is fully editable. Try dragging with mouse, |
| 52 | "Home" key restores comfortable initial view, |
| 53 | and see e.g. [Castle Model Viewer](https://castle-engine.io/castle-model-viewer) docs for full key/mouse controls list. |
| 54 | |
| 55 | ## Building |
| 56 | |
| 57 | Using [Castle Game Engine](https://castle-engine.io/). |
| 58 | |
| 59 | Compile by: |
| 60 | |
| 61 | - [CGE editor](https://castle-engine.io/editor). Just use menu items _"Compile"_ or _"Compile And Run"_. |
| 62 | |
| 63 | - Or use [CGE command-line build tool](https://castle-engine.io/build_tool). Run `castle-engine compile` in this directory. |
| 64 | |
| 65 | - Or use [Lazarus](https://www.lazarus-ide.org/). Open in Lazarus `fps_game.lpi` file and compile / run from Lazarus. Make sure to first register [CGE Lazarus packages](https://castle-engine.io/lazarus). |