Debian Codegraph @

examples/isometric_game/README.md

raw symbols SCIP
1 # Isometric Game
2
3 Simple example of arranging images in a viewport to show an isometric map layout.
4
5 - From code, it creates a random map.
6
7 It creates a number of `TCastleImageTransform` instances and arranges them to show a ground with some trees.
8
9 - It includes a pre-designed `TCastleScene` with a sprite sheet and `TCastleImageTransform` with a penguin, just to show that we can also place stuff using the editor in `gameviewmain.castle-user-interface`.
10
11 Animations, sprite sheets, physics... everything can be placed on map this way. See https://castle-engine.io/viewport_and_scenes for documentation what components can be used in a viewport.
12
13 - The design contains `TCastle2DNavigation` component so user can easily move (drag with left mouse button) and zoom the map (mouse wheel).
14
15 ![Screenshot](screenshot.png)
16
17 ## Notes
18
19 - Cross-scene batching when drawing is very important in case of this demo. You need `DynamicBatching` = `true` to have reasonable performance for non-trivial maps.
20
21 Without `DynamicBatching`, this would make 1 "draw call" per image, very inefficient for large maps with 1 or more image per tile. With `DynamicBatching`, images are batched, and the "draw calls" number drops significantly, making them trivial to render.
22
23 Use key `b` to toggle `DynamicBatching` to test this.
24
25 ## TODO
26
27 - Turn this into a real isometric game :)
28
29 - Add a player character moving.
30
31 - Implement "view follows the player" mode, toggable in this demo.
32
33 - Collisions. Player should not be able to move everywhere.
34
35 - Some enemies you can fight with, some NPCs you can talk with, trade with, some items you can pick up...
36
37 - Make sure the memory footprint is small. All `TCastleImageTransform` should share the resources, on GPU and CPU. Without the need to wrap them in `TCastleTransformReference`. We have plans to improve the memory footprint of X3D nodes already.
38
39 - Add snapping to CGE editor, or even full tile editor inside CGE, to make it easy to design such map in CGE editor.
40
41 NOTE: You can also design isometric map using [Tiled](https://www.mapeditor.org/) and load it in CGE using [TCastleTiledMap](https://castle-engine.io/tiled_maps). For examples of using Tiled, see CGE `examples/tiled/` subdirectory. Tiled supports isometric map layout fully.
42
43 Using [Castle Game Engine](https://castle-engine.io/).
44
45 ## Building
46
47 Compile by:
48
49 - [CGE editor](https://castle-engine.io/editor). Just use menu items _"Compile"_ or _"Compile And Run"_.
50
51 - Or use [CGE command-line build tool](https://castle-engine.io/build_tool). Run `castle-engine compile` in this directory.
52
53 - Or use [Lazarus](https://www.lazarus-ide.org/). Open in Lazarus `isometric_game_standalone.lpi` file and compile / run from Lazarus. Make sure to first register [CGE Lazarus packages](https://castle-engine.io/lazarus).
54
55 - Or use [Delphi](https://www.embarcadero.com/products/Delphi). Open in Delphi `isometric_game_standalone.dproj` file and compile / run from Delphi. See [CGE and Delphi](https://castle-engine.io/delphi) documentation for details.