From an idea to a release on Steam: everything about making your game using Castle Game Engine

michaliskambi 563 views 52 slides Oct 11, 2024
Slide 1
Slide 1 of 52
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52

About This Presentation

Slides from my presentation at Cologne at FPC / Lazarus meeting (October 2024). Showing all important Castle Game Engine features, starting from using the editor to design games, using Pascal code to implement game logic, using ready assets from Sketchfab, Quaternius, OpenGameArt etc., adding Steam ...


Slide Content

From an idea to a release on Steam:
everything about making your game
using Castle Game Engine
Michalis Kamburelis

I'm Michalis Kamburelis
●Castle Game Engine - https://castle-engine.io/
●PasDoc - https://pasdoc.github.io/
●Modern Object Pascal Introduction -
https://castle-engine.io/modern_pascal
●Involved in 3D standards
○X3D (Web3D member)
○glTF (Khronos liaison)
○Others (WIP IFC implementation for https://www.sorpetaler.de/ )

Castle Game Engine intro:

Editor, Components and Building
Applications

Castle Game Engine

Features


●3D and 2D
○any game type
●Comfortable Editor
○with game simulation possible, and custom components
●Pascal API (all that you can do in editor + much more)
○For your games and for engine
○FPC (all platforms) and Delphi (Windows, Linux)
●Open-source
○Want to fork to add a project-specific feature? OK.
●Multi-platform
○Windows, Linux (Raspberry Pi too), FreeBSD, macOS
○Android, iOS
○Nintendo Switch

3D FPS game template
●Views
●Play view
○Viewport, navigate in 3D
○Left side: hierarchy with components
■UI
■viewport is also UI
■3D: transform scenes, cameras, lights
■drag-and-drop 3D models, images
■transform, delete, duplicate
■behaviors attach to transforms, like billboard
○Right side: properties
○Bottom: files
■preview
■special data directory
■double click to run view3dscene on scenes

2D game template

Run!
From CGE editor, or Lazarus, or Delphi, or VS Code.

Run on mobile
Just switch "Run -> Platform (...)" to "Android".
Assuming you have Android SDK and FPC cross-compilers, see https://castle-engine.io/android .

Coding

Any editor you like - VS Code, Lazarus IDE,
Delphi, Emacs…
Our VS Code extension ( https://castle-engine.io/vscode ) provides everything:
●Pascal highlighting and code completion (LSP), knowing also CGE layout
●Integration with CGE projects (build, run, debug)

Views, handle key press
●Organize project into views
●Views can handle events, like
○Start
○Update
○Press
○Natural place to handle events, like OnClick of buttons, too

Handle button click, change Translation
●Assign TCastleButton.OnClick event to handle classic button clicks
●Change TCastleTransform.Translation whenever
●TVector3, our vector type, is used throughout the engine

Play a sound
●Non-spatial?Just setup TCastleSound and call SoundEngine.Play(MySound)
●Spatial? Use TCastleSoundSource and TCastleSound.
●See https://castle-engine.io/sound

Physics

Setup and test Physics in editor -
colliders and rigid bodies

Use forces from code

Level design in editor (bigger
projects)

Reuse designs, factory of designs

Design (compose) components and reuse
●Design a composition of CGE components in editor
●Instantiate them, once or multiple times using TCastleComponentFactory
●This is a bit like LCL / VCL / FMX TFrame, but more for our purposes
○It can be 3D or 2D thing
○Factory allows to create lots of it - spawn monsters, falling down debris, rockets
etc.

Demo

Behaviors

Behaviors
●Descend from TCastleBehavior
●Override TCastleBehavior.Update to do what you want
●Attach to multiple things
●Example: patrolling enemy in "3D FPS Game"

Ready behaviors
●TCastleBillboard
●TCastleSoundSource (mentioned previously)
●Physics colliders and rigid bodies (mentioned previously)
●New….

In progress (not yet in master) TCastleLiving,
TCastleMoveAttack behaviors
●Add TCastleLiving where you want the player to be (camera, avatar)
●Add TCastleLiving and TCastleMoveAttack to each creature
●Configure stuff, like Enemy
●Ready FPS game mechanics!
●Short-range attack, approach the player when sees player. Underneath also
fire missile and navmesh (in progress to make them exposed nicely).
●It works when you run the game, or in simulation.

TCastleMoveAttack and TCastleLiving demo
Show creatures_behaviors demo.
●Where are behaviors
●Run game
●Run simulation
●Show tweaks - change Enemy.
Notes:
●Behaviors can be added by code, or by editor.
●You can query for all TCastleMoveAttack occurences in Viewport.Items etc.
●Custom components, like behaviors, want to see them at design-time?
https://castle-engine.io/custom_components

Demo - TCastleMoveAttack also at simulation

Demo "poor guy" - one skeleton is enemy

Use ready assets
(aka: why I love open 3D
standards and glTF in particular)

We integrate with Sketchfab, you can search
and download models from Sketchfab
●Demo:
○Get level (dungeon) (tweak PreciseCollisions)
○Get props (barrel)
○Setup walk/fly navigation (tweak MouseLook, MoveSpeed)
○Ready game - run!
●The assets are in data/sketchfab, with licenses and authors to attribute
●This is thanks to using glTF standard , https://castle-engine.io/gltf

Demo from Sketchfab models

More open-source and free assets
●Quaternius https://quaternius.com/
●OpenGameArt https://opengameart.org/
●Pro tip: Seek for "modular" assets to have "lego pieces" to build levels, either in CGE
editor or Blender
●Demo:
○Drag-and-drop glTF files on plane
○Add lights, shadows
●Again, glTF rules

Demo from Quaternius models

Integrations - Steam, Google Play

Create a game on Steam, use our integration
for achievements and more
●https://castle-engine.io/steam
●Soon: engine also on Steam

We also integrate with Google Play Games and
Apple Game Center
●Android and iOS applications:
○Compiled using FPC to library
○We add support code in Java / Objective-C to interact with system
○We add optional "services" code to interact with specific 3rd-party native libraries,
like Google Play Games
○The resulting project is build to APK (Android) or IPA / Xcode project (iOS)

TCastleControl

Also on LCL / VCL / FMX form, alongside other
LCL / VCL / FMX
●Useful if you only want to CGE rendering to existing LCL / VCL / FMX applications
●Everything described here still works, you just start a bit different, by TCastleControl
●See https://castle-engine.io/control_on_form

Conclusion

Homework proposal: try to combine all the
things you learned:)
You know now how to:
●Design stuff in editor
●Write Pascal code to make logic you want
●Use ready-made assets from the Internet
○learning Blender is beyond this talk :), but if you do -- export from Blender to glTF and
the world is your oyster.
●Download https://castle-engine.io/ and make a game!
●Let me know how it goes:
[email protected]
○https://forum.castle-engine.io/
○https://castle-engine.io/talk.php

Plans
●We are at 7.0-alpha.3, I think we'll make 7.0-alpha.4 in October
○New features already: https://castle-engine.io/steam
○TCastleMoveAttack almost finished
○Other features (distance field fonts, export design to X3D/STL),
shadows optimization
●Working on 7.0 release, hopefully in 2024
○For 7.0: material components, new navigation components
○See https://castle-engine.io/roadmap
●Then, for 7.2: Web target using FPC WebAssembly

How to make this sustainable?
●We are looking for your support:
https://www.patreon.com/castleengine

●We are open to cooperation with companies (consulting, dedicated
features, platforms…). Talk to me!

Thank you!
https://castle-engine.io

These slides:
https://castle-engine.io/cologne2024

[email protected]