Yannik Brändle - WS25/26
TH Bingen
Katalog→TH Bingen→Studieneinstieg und
Support→Studienerfolgsberatung
# Overview
## Game Name
## One-Sentence Pitch (Was ist die Kernidee des Spiels?)
## Genre/Style (Platformer, Puzzle, Simulation, ...)
## Gruppenmitglieder mit Matrikelnummer
# Gameplay Loop
## Player Action (Was macht der Spieler beim Spielen?)
## Goal (Worauf arbeitet der Spieler hin/was muss bzw. will er machen?)
## Win/Loss Conditions (Wann gewinnt oder verliert der Spieler?)
# Aesthetics and Assets
## Sourcen (Woher kommen die Assets? Ein/mehere Asset packs? Selbst machen?)
## Spielperspektive (3D 3rd Person, FPS, 2D Top down, etc.)
# Spiel KI
## AI Systems (welche Systeme werden eingesetzt? FSM, Behaviour Trees, Machine Learning, ...)
## What's hard (welche Hauptprobleme werden hierbei erwartet)
## Godot Addons/Externe Tools (wenn welche genutzt werden sollen)
# Scope & Milestones
## Minimum Viable Product (Was ist das absolute minimum damit das Projekt spielbar ist?)
## Milestones (Was sind die Meilensteine die das Projekt durchlaufen soll?)
# Team & Responsibilities
## Roles (Wer macht was? Macht jeder alles?)
## Collaboration Tools (Welche Projekttools sind geplant? Also Git, Github, Gitlab, Trello, etc.)
# Inspirations
## Similar Games in Concept (Welche Spiele waren die Inspiration für die Idee, bzw welche ähnliche Mechaniken haben)
# Experience level
## Group Member Gamedev Experience (Je Gruppenmitglied: Bereits Erfahrung Mit Gamedev/dem Spielgenre/etc.)
CharacterBody2D default script in GDScript
extends CharacterBody2D
@export var speed = 400
func get_input():
var input_direction = Input.get_vector("left", "right", "up", "down")
velocity = input_direction * speed
func _physics_process(delta):
get_input()
move_and_slide()
CharacterBody2D default script in C#
using Godot;
public partial class Movement : CharacterBody2D
{
[Export]
public int Speed { get; set; } = 400;
public void GetInput()
{
Vector2 inputDirection = Input.GetVector("left", "right", "up", "down");
Velocity = inputDirection * Speed;
}
public override void _PhysicsProcess(double delta)
{
GetInput();
MoveAndSlide();
}
}
Wissenswerte Abschnitte
Node
Sprite2D→Node2D→CanvasItem→Node
"Rigid" (Starr) im gegensatz zu "Soft" (Weich) bodies!
func _ready():
$Button.pressed.connect(_on_button_pressed)
func _on_button_pressed():
print("Button wurde gedrückt!")
signal my_signal()
signal damaged(amount: int)
Konventionen, Funktionen und Tücken
func _ready():
var test1 = "cool text"
test1 = 5
print(test1) # Output "5"
var test2 : String = "cool text"
test2 = 5 # Fehler und bricht hier ab
print(test2)
func myNum():
return 5 # Geht, da keine Typisierung
func myName() -> String:
return 5 # Fehler und bricht hier ab
Naming Conventions Godot Style Guide
| Type | Convention | Example |
| File names | snake_case | yaml_parser.gd |
| Class names | PascalCase | class_name YAMLParser |
| Node names | PascalCase | Camera3D, Player |
| Functions | snake_case | func load_level(): |
| Variables | snake_case | var particle_effect |
| Signals | snake_case | signal door_opened |
| Constants | CONSTANT_CASE | const MAX_SPEED = 200 |
| Enum names | PascalCase | enum Element |
| Enum members | CONSTANT_CASE | {EARTH, WATER, AIR, FIRE} |
Reihenfolge der Sprachelemente einer GDScript Datei
01. @tool, @icon, @static_unload
02. class_name
03. extends
04. ## doc comment
05. signals
06. enums
07. constants
08. static variables
09. @export variables
10. remaining regular variables
11. @onready variables
12. _static_init()
13. remaining static methods
14. overridden built-in virtual methods:
1. _init()
2. _enter_tree()
3. _ready()
4. _process()
5. _physics_process()
6. remaining virtual methods
15. overridden custom methods
16. remaining methods
17. subclasses
Per-Frame-CodePer-Phsyics-Step-Code_process(delta): wird jedes Frame aufgerufen
_physics_process(delta): wird bei jedem Physik
Schritt aufgerufen
delta ist hierbei jeweils die Zeit zum letzten Aufruf
_physics_process_processdelta?"Why timers in Sierra games are so broken" - Space Quest Historian
func _process(delta):
position.x += 1
func _physics_process(delta):
position.x += 1
delta
func _process(delta):
position.x += 60 * delta
func _physics_process(delta):
position.x += 60 * delta
* deltadelta die Zeit seit letzten Durchlauf ist
* delta ist in _physics_process ca
* 0.016
_init: Konstruktor der Node/Klasse (einmalig)
_enter_tree: Wenn die Node in den Scene Tree
eingehangen wird
_ready: Wenn alle Child Nodes fertig initialisiert
wurden (einmalig)
@toolToolscripts laufen im Editor, bentutzt wenn man Hilfen baut mit denen man den Entwicklungsprozess verbessert
@tool
func _process(delta):
if Engine.is_editor_hint():
rotation += PI * delta # rotiert im Editor im Uhrzeigersinn
else:
rotation -= PI * delta # rotiert im Spiel gegen den Uhrzeigersinn
Vorsicht: wenn man mit tool scripts den SceneTree verändert und das gespeichert wird ist das permanent
@export [var]Exposed die Variable in den Inspector
Hilfreich bei Dingen die man pro Node im Editor einstellen will
Sind weiterhin normale Variablen
@onready [var]
Direkt vor _ready wird etwas gemacht (idR zuweisungen)
@onready var parent = get_parent()
var first_child
func _ready():
first_child = get_child # gleicher effekt wie ein onready auf first_child
Hilft primär für kompakteren Code