37
Marco Pleines | Dortmund, 05.11.2019 Lehrstuhl 11 Fakultät für Informatik Fachprojekt DET DET WS 2019/2020 - Hauptprojekt -

- Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Fachprojekt DET DET WS 2019/2020- Hauptprojekt -

Page 2: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

2

HauptprojektVoxel Engine

Page 3: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Ziel• Tiefgehender Einstieg in Elemente der Game Engine Unity

– z.B. Job System (DOTS)– z.B. Entity-Component-System (DOTS)– z.B. Assetbundle– z.B. Profiler– z.B. Render Pipeline– uvm.

DOTS: Data-Oriented Technology Stack

3

Page 4: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Ziel• Tiefgehender Einstieg in Entertainment Technologies

– z.B. Procedural Content Generation– z.B. AI, Pathfinding Methoden– z.B. Multiplayer

4

Page 5: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Wahlthemen• Procedural Content Generation• Kampfsystem und Künstliche Intelligenz• Networking (Multiplayer)

– Nur als 4er Gruppe

• Thema wird bis zum 12.11.2019 festgelegt• Mehrfach- oder Nichtbelegung von Themen ist möglich• Andere Themen nur nach Vereinbarung

5

Page 6: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Aufgaben• Entwickeln Sie Spielideen/Features und skizzieren diese

(z.B. auf Papier)• Planen Sie Ihr Projekt mit einem Meilensteinplan und

einem Gantt Chart• Implementieren Sie Ihre Spielidee und dessen Features

anhand Ihrer Projektplanung• Versionieren Sie häufig Ihr Projekt mit Git

6

Page 7: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Voxel Engine Download• https://github.com/MarcoMeter/DET-SS2019

Referenz: https://www.udemy.com/unityminecraft/

7

Page 8: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Alternative Grundlagen• Voxel Terrain Generation (Text Tutorial)

– https://steemit.com/static/search.html?q=voxel+terrain+generation

• b3agz Youtube Tutorial– https://www.youtube.com/watch?v=h66IN1Pnd

d0&list=PLVsTSlfj0qsWEJ-5eMtXsYp03Y9yF1dEn

8

Page 9: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Alternative Grundlagen• AlexStv Unity Voxel Block Tutorial (Text Tutorial)

– https://github.com/z3nth10n/AlexStv-Unity-Voxel-Block-Tutorial

9

Page 10: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Vergangene Projekte: Inselwelt

10

Page 11: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Vergangene Projekte: Waldgebiete

11

Page 12: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Vergangene Projekte: Kampfarena + Crafting

12

Page 13: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Vergangene Projekte:• Cube Voxel to Flat Terrain + Vegetation• 4D Voxel Welt

13

Page 14: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Einstieg in die Grundlage• Was ist ein Voxel?• Was ist ein Cube?• Mesh Zusammenfassung• Datenverarbeitung in einem Voxel Array• Texture Atlas• Procedural Content Generation• Perlin Noise• Fractional Brownian Noise

14

Page 15: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Was ist ein Voxel (Volume Pixel)?• Ein Voxel repräsentiert einen einzelnen Datenpunkt in

einem dreidimensionalen Array– z.B. chunk[0, 2, 1] = DirtBlock

• Ein Voxel kennt seine relative Position in einem Volumen– z.B. Position innerhalb eines Chunks

• Rendering: Interpretation der Daten• Anwendung: z.B. Terrain

15

Page 16: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Was ist ein Cube?• Ein Mesh aus Polygonen• Die einfachste Form eines Polygons in Unity is ein Triangle• Die drei Punkte des Dreiecks haben 3D Koordinaten• Eine Fläche eines Würfels hat zwei Dreiecke• Ein Dreieck hat eine Normale

16

Page 17: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Was ist ein Cube?• Ein Cube in Unity besteht aus 12 Triangles

• GetComponent<MeshFilter>().mesh– Vertex Array– Normal Array– UV Array– Triangle Array

17

Page 18: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Vertex Array(0.5, -0.5, 0.5)(-0.5, -0.5, 0.5)(0.5, 0.5, 0.5)(-0.5, 0.5, 0.5)(0.5, 0.5, -0.5)(-0.5, 0.5, -0.5)(0.5, -0.5, -0.5)(0.5, 0.5, -0.5)

(-0.5, -0.5, 0.5)(-0.5, -0.5, -0.5) (-0.5, -0.5, 0.5)(-0.5, 0.5, 0.5)(-0.5, 0.5, -0.5) (-0.5, -0.5, -0.5) (0.5, -0.5, -0.5)(0.5, -0.5, 0.5)

18

(-0.5, -0.5, -0.5) (0.5, 0.5, 0.5)(-0.5, 0.5, 0.5)(0.5, 0.5, -0.5)(-0.5, 0.5, -0.5)(0.5, -0.5, -0.5)(0.5, -0.5, 0.5)(0.5, 0.5, 0.5)

Page 19: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Normal Array(0.0, 0.0, 1.0)(0.0, 0.0, 1.0)(0.0, 0.0, 1.0)(0.0, 0.0, 1.0)(0.0, 1.0, 0.0)(0.0, 1.0, 0.0)(0.0, 0.0, -1.0)(0.0, 0.0, -1.0)

(-1.0, 0.0, 0.0)(-1.0, 0.0, 0.0)(-1.0, 0.0, 0.0)(-1.0, 0.0, 0.0)(1.0, 0.0, 0.0)(1.0, 0.0, 0.0)(1.0, 0.0, 0.0)(1.0, 0.0, 0.0)

19

(0.0, 1.0, 0.0)(0.0, 1.0, 0.0)(0.0, 0.0, -1.0)(0.0, 0.0, -1.0)(0.0, -1.0, 0.0)(0.0, -1.0, 0.0)(0.0, -1.0, 0.0)(0.0, -1.0, 0.0)

Page 20: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

UV Array(0.0, 0.0)(1.0, 0.0)(0.0, 1.0)(1.0, 1.0)(0.0, 1.0)(1.0, 1.0)(0.0, 1.0)(1.0, 1.0)

(0.0, 0.0)(0.0, 1.0)(1.0, 1.0)(1.0, 0.0)(0.0, 0.0)(0.0, 1.0)(1.0, 1.0)(1.0, 0.0)

20

(0.0, 0.0)(1.0, 0.0)(0.0, 0.0)(1.0, 0.0)(0.0, 0.0)(0.0, 1.0)(1.0, 1.0)(1.0, 0.0)

Page 21: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Triangle Array0, 2, 3,0, 3, 1,8, 4, 5,8, 5, 9,10, 6, 7,10, 7, 11,

21

12, 13, 14,12, 14, 15,16, 17, 18,16, 18, 19,20, 21, 22,20, 22, 23

Page 22: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Mesh Zusammenfassung1. Erstelle Quads

a. Erstelle Liste mit Verticesb. Erstelle UV Koordinatenc. Berechne Normalend. Verbinde Vertices zu Triangles

2. Kombiniere Quad Meshes

22

Page 23: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Datenverarbeitung in einem Voxel Array

Verschachtelte Schleife:

for(int z = 0; z < chunkSize; z++) for(int y = 0; y < chunkSize; y++) for(int x = 0; x < chunkSize; x++)

23

Page 24: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Benachbarte Blöcke

24

x, y, z

x + 1, y, z

x - 1, y, z

x, y + 1, z

x, y - 1, z

x, y, z + 1

x, y, z - 1

Page 25: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Benachbarte Blöcke

25

Page 26: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Benachbarte Blöcke

26

4, 4, 04, 4, 1

4, 4, 4

4, 4, 34, 4, 2

Page 27: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Benachbarte Blöcke

27

4, 4, 2 5, 4, 2

Page 28: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Benachbarte Blöcke

28

4, 4, 2 0, 4, 2

Page 29: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Benachbarte Blöcke• Chunks werden in Abhängigkeit von World.chunkSize

positioniert und benannt• Über die Chunkgröße und Chunkposition wird der

benachbarte Chunk gefunden• Der gewünschte Block ist auf der relevanten Achse mit 0

indexiert• Block.cs:335

29

Page 30: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Texture Atlas• Einsparung von Performance durch

ein einziges Material• UV Koordinaten müssen auf den

gewünschten Ausschnitt zugeschnittenwerden

30

Page 31: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Procedural Content Generation• Autonome Generierung von Inhalten mit möglichst

limitierten menschlichen Einfluss

31

• Terrain• Level• Karten• Texturen• Musik

• Regeln• Geschichten• Charaktere• ...

Page 32: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Procedural Content Generation• Schneller und günstigere Produktion

– 2D und 3D Assets verschlingen 40% der Produktionskosten (Yannanakis, 2018)

• Ziel: Augmentation der Fähigkeiten eines menschlichen Künstlers

32

Page 33: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Procedural Content GenerationPCG Schritte:● Verstehen des Design Prozesses● Auflistung der Einschränkungen● Verstehen des Prozesses● Auswählen einer Methoden zum Generieren● Iterieren

33

Page 34: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Perlin Noise• “Smooth and organic” noise• The Theory of Noise: An Overview of Perlin Noise

– https://www.youtube.com/watch?v=H6FhG9VKhJg

34

Page 35: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Fractional Brownian Motion• Auch genannt “Fractal Noise”• Mehrere “Oktaven” von Wellen werden überlagert und

führen zu einer höheren Detailgenauigkeit• https://thebookofshaders.com/13/

35

Page 36: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

Ressourcen• Implementieren eines Cubes von Hand

http://ilkinulas.github.io/development/unity/2016/04/30/cube-mesh-in-unity3d.html

• Implementieren eines Cubes und Kombination mehrer Mesheshttps://drive.google.com/open?id=1eqwZCBHvnuJtTfQwHIb_hDl8C2jCW4z5

36

Page 37: - Hauptprojekt - Fachprojekt DET DET WS 2019/2020 · • Procedural Content Generation • Kampfsystem und Künstliche Intelligenz • Networking (Multiplayer) – Nur als 4er Gruppe

Marco Pleines | Dortmund, 05.11.2019

Lehrstuhl 11 Fakultät für Informatik

ReferenzenGeorgios Yannakakis & Julian Togelius, 2018, Artificial Intelligence and Games, Springer

37