Arvutiteaduse instituut
  1. Kursused
  2. 2020/21 sügis
  3. Mängumootorid (LTAT.02.018)
EN
Logi sisse

Mängumootorid 2020/21 sügis

  • Main
  • Schedule
  • Unity
  • Godot
  • Unreal
  • Unreal Networking
  • Points

Godot

Setting up Godot

  1. Download Godot Standard version from here: https://godotengine.org/download/windows
  2. Unpack it and run the exe file
  3. Create a new project by pressing New Project, for a 2D game OpenGL ES 2.0 is suitable (it will run on more platforms).

Godot Introduction

Godot Introduction Slides

This is a class diagram of Godot's base classes:

Practice 1

This practice is based on a Platform game tutorial series from HeartBeat:
Part1: https://youtu.be/wETY5_9kFtA

  1. Create a new 2D project
    1. Add basic node World
    2. Save the scene
  2. Add a player
    1. Add a KinematicBody2D, rename it Player and attach script Player.gd
    2. Add Sprite to KinematicBody2D, with Godot icon
    3. Add variable motion Vector2
    4. Add func _physics_process(delta)
    5. Change motion.x to 0, 100 or -100 based on which button player presses
    6. Add move_and_slide(motion) to move it
    7. Add GRAVITY constant and make player fall
  3. Add a StaticBody2D named Wall
    1. Add sprite to the wall (you can use Godot icon and tint it black)
  4. Add CollisionShape2D with box shape to both player and wall
  5. Save Wall as a scene and duplicate it multiple times
  6. Make the player jump when up button is pressed
    1. Add check is_on_floor() check to determine that player is on floor
    2. Check if the up button is pressed and change the motion.y when it is
    3. Add UP constant Vector and add it to the move_and_slide
    4. Update the motion by the return value from move_and_slide
  7. Add export variables for gravity, speed and jump_height, configure them in inspector

Practice 2

Part2: https://youtu.be/BfQGXtlmE7k

  1. Download sprites from https://www.dropbox.com/s/dq0q4udpujh1fzp/Sprites.zip?dl=0
    1. Import sprites as 2D pixel texture.
  2. Create a tileset.
    1. Create a new tileset scene (Regular node)
    2. Add sprite to the tileset and rename it to tile0.
    3. Turn on sprite region and select a tile.
    4. Add StaticBody2D and CollisionShape2D to the sprite and configure them.
    5. Duplicate sprite object to each different tiles.
    6. Save the scene as tileset: Scene -> Convert To -> Tileset
  3. Add Tilemap to the scene with the previously created Tileset
    1. Set the correct cell size.
    2. Change the view size (640, 480) Project -> Settings -> General -> Display -> Window (640, 480)
    3. Draw a simple map
    4. Set the view test size to (1280, 720)
    5. Set Mode to 2D and aspect to expand
  4. Animate the character
    1. Change Sprite node to AnimatedSprite
    2. Create new SpriteFrames
    3. Create Idle animation with Idle sprite (1 frame)
    4. Create Run animation (5 frames)
    5. Create Jump animation with only the first frame (1 frame)
    6. Resize the collision to fit the sprite
    7. Flip the sprite when the player changes the direction
    8. Switch between run and idle animations in code
    9. Play the Jump animation when player is not on the floor

Part3: https://youtu.be/ZsP7JDrRTJY

  1. Add acceleration to the the player with a max speed
  2. Make player to slow down when stopped (friction is higher on ground)
  3. Change the collision shape to a capsule

Part4: https://youtu.be/KzLfi0r4Muw

  1. Create a portal between scene
    1. Add Area2D with a collision shape and icon.
    2. Add a script to it
    3. Loop over overlapping bodies, and if the body.name == "Player" change the scene.
    4. Make the scene configurable by adding: export(String, FILE, "*.tscn") var world_scene

Practice 3

Part6: https://youtu.be/K-eM2ZLI1q8

  1. Add a following camera node to the character
  2. Add a parallax layer node to the character
    1. Download sky texture from here: https://www.dropbox.com/s/esskpfovx1lkk7v/Dirt%20Autotile%20and%20Sky.zip
  3. Use pixel snap: Settings -> General -> Rendering -> Quality -> Use Pixel Snap

Part7: https://youtu.be/sBuJRHvk5sY

  1. Add a basic UI and menu
    1. Add VBoxContainer
    2. Add Game Title
    3. Add Start and Exit buttons
    4. Configure Start and Exit buttons through events
  2. Add a theme
    1. Use scrollbar.png from here: https://opengameart.org/content/match-3-gui
    2. Configure buttons and background for the panel

Submission

Submit a compiled version of your game (Windows 64 build). Zip your build folder into a single package and make sure that all the additional files (that were created when building the game) are also included in this package. Don't submit your source code.

Deadline: 24.11 (before lab)

2. Godot project
Sellele ülesandele ei saa enam lahendusi esitada.
  • Arvutiteaduse instituut
  • Loodus- ja täppisteaduste valdkond
  • Tartu Ülikool
Tehniliste probleemide või küsimuste korral kirjuta:

Kursuse sisu ja korralduslike küsimustega pöörduge kursuse korraldajate poole.
Õppematerjalide varalised autoriõigused kuuluvad Tartu Ülikoolile. Õppematerjalide kasutamine on lubatud autoriõiguse seaduses ettenähtud teose vaba kasutamise eesmärkidel ja tingimustel. Õppematerjalide kasutamisel on kasutaja kohustatud viitama õppematerjalide autorile.
Õppematerjalide kasutamine muudel eesmärkidel on lubatud ainult Tartu Ülikooli eelneval kirjalikul nõusolekul.
Tartu Ülikooli arvutiteaduse instituudi kursuste läbiviimist toetavad järgmised programmid:
euroopa sotsiaalfondi logo