the computing scientist s main challenge is not to get
play

The computing scientists main challenge is not to get confused by - PowerPoint PPT Presentation

The computing scientists main challenge is not to get confused by the complexities of their own making. E. W. Dijkstra Entity-Component Systems + You ( They're not just for games anymore ) @parisba | @The_McJones | @TheMartianLife


  1. “The computing scientist’s main challenge is not to get confused by the complexities of their own making. ” E. W. Dijkstra

  2. Entity-Component Systems + You ( They're not just for games anymore ) @parisba | @The_McJones | @TheMartianLife 2

  3. Hello! » Paris (@parisba) » Game developer, PhD Computing, Author » Tim (@The_McJones) » Game developer, PhD Computing, Author » Mars (@TheMartianLife) » Software developer, Research & Teaching Assistant, Upcoming Author @parisba | @The_McJones | @TheMartianLife 3

  4. ECS? @parisba | @The_McJones | @TheMartianLife 6

  5. If you Google ECS, you'll probably get Unity, or Amazon. Or something entirely unrelated. Sorry. @parisba | @The_McJones | @TheMartianLife 7

  6. This is not a games talk! Mostly. @parisba | @The_McJones | @TheMartianLife 8

  7. Before we start.. Is anyone using ECS, or working in games? @parisba | @The_McJones | @TheMartianLife 9

  8. Overview » What is ECS? » History Lesson » ECS Implementations » What ECS is good for » What ECS is not good for » Summary @parisba | @The_McJones | @TheMartianLife 10

  9. What is ECS? @parisba | @The_McJones | @TheMartianLife 11

  10. Entity Component Systems @parisba | @The_McJones | @TheMartianLife 12

  11. There's the short answer, and the long answer... @parisba | @The_McJones | @TheMartianLife 13

  12. ECS?! @parisba | @The_McJones | @TheMartianLife 14

  13. Strict separation between data and logic @parisba | @The_McJones | @TheMartianLife 15

  14. Oh, ECS... @parisba | @The_McJones | @TheMartianLife 16

  15. The Impetus Games really only have two needs: » performance » flexibility @parisba | @The_McJones | @TheMartianLife 17

  16. Performance (you've only got ~16.6 milliseconds) @parisba | @The_McJones | @TheMartianLife 18

  17. Flexibility (with jillions of objects and factors) @parisba | @The_McJones | @TheMartianLife 19

  18. ECS encourages both Performance + Flexibility @parisba | @The_McJones | @TheMartianLife 20

  19. The key word being 'encourages' You can, of course, mess it up. @parisba | @The_McJones | @TheMartianLife 21

  20. So what? Everything is fine already! @parisba | @The_McJones | @TheMartianLife 22

  21. It's a bit messy. @parisba | @The_McJones | @TheMartianLife 26

  22. God Objects @parisba | @The_McJones | @TheMartianLife 27

  23. History Lesson! @parisba | @The_McJones | @TheMartianLife 29

  24. Early 'ECS' @parisba | @The_McJones | @TheMartianLife 30

  25. Adam Martin's ECS » Entities have IDs » Components have data » Systems have logic @parisba | @The_McJones | @TheMartianLife 32

  26. Let's look at these one by one... @parisba | @The_McJones | @TheMartianLife 33

  27. Entity » an object in your game, uh, software » anything, really, a player, an enemy, anything » an identifier, no logic @parisba | @The_McJones | @TheMartianLife 34

  28. Entity Two excellent descriptions of an entity (in games): » everything but the terrain » assemblages @parisba | @The_McJones | @TheMartianLife 35

  29. Entities are boring. Just a thing to reference. @parisba | @The_McJones | @TheMartianLife 36

  30. Isn't this just a primary key? @parisba | @The_McJones | @TheMartianLife 37

  31. Yes, yes it is. @parisba | @The_McJones | @TheMartianLife 38

  32. Components » it has some data @parisba | @The_McJones | @TheMartianLife 39

  33. Components Also pretty boring. A flag that may also hold raw data for one aspect of a thing. @parisba | @The_McJones | @TheMartianLife 40

  34. System @parisba | @The_McJones | @TheMartianLife 41

  35. Systems are the interesting bit. Logic that runs continuously and performs actions on every Entity that has a Component of the aspect the System is designed to work with. @parisba | @The_McJones | @TheMartianLife 42

  36. ECS or EC? @parisba | @The_McJones | @TheMartianLife 43

  37. ECS in use today @parisba | @The_McJones | @TheMartianLife 44

  38. It's very popular. In games. @parisba | @The_McJones | @TheMartianLife 45

  39. To do this... @parisba | @The_McJones | @TheMartianLife 46

  40. We're gonna talk about games. Sorry. @parisba | @The_McJones | @TheMartianLife 47

  41. Games are very dynamic @parisba | @The_McJones | @TheMartianLife 48

  42. Game worlds are built out of entities @parisba | @The_McJones | @TheMartianLife 49

  43. A tree is different from a human who is different from an alien who is different from... @parisba | @The_McJones | @TheMartianLife 50

  44. Games are in constant development flux @parisba | @The_McJones | @TheMartianLife 51

  45. @parisba | @The_McJones | @TheMartianLife 52

  46. @parisba | @The_McJones | @TheMartianLife 53

  47. games are made up of moving parts @parisba | @The_McJones | @TheMartianLife 54

  48. But... @parisba | @The_McJones | @TheMartianLife 55

  49. There is common pool of aspects » Position data » Visuals data » Animation data » Sound data » Gameplay data @parisba | @The_McJones | @TheMartianLife 56

  50. What a game seems like 1.Player presses walk forward 2.Move the player forward 3.Check if enemy can see the player avatar 4.Move towards the player 5.If in range swing sword 6.Deal damage to the player @parisba | @The_McJones | @TheMartianLife 57

  51. What a game is actually doing 1.Receive user input 2.Raycast from enemy to player avatar 3.Update avatar and enemy position 4.Deal damage 5.Update animations 6.Render frame @parisba | @The_McJones | @TheMartianLife 58

  52. Separating data from behaviour @parisba | @The_McJones | @TheMartianLife 59

  53. Objects? @parisba | @The_McJones | @TheMartianLife 60

  54. Objects and (rigid, mostly) class hierarchies @parisba | @The_McJones | @TheMartianLife 61

  55. Complex hierarchies @parisba | @The_McJones | @TheMartianLife 62

  56. Composition, not Inheritance @parisba | @The_McJones | @TheMartianLife 64

  57. Composing entities @parisba | @The_McJones | @TheMartianLife 65

  58. Composing entities Benefits: 1. Easy to add new entities. 2. Easy to change entities. 3. Performant! @parisba | @The_McJones | @TheMartianLife 66

  59. ECS and Games, now @parisba | @The_McJones | @TheMartianLife 68

  60. Entity @parisba | @The_McJones | @TheMartianLife 69

  61. Entity Examples: - Crate - Ball - Enemy - Player - Traffic light @parisba | @The_McJones | @TheMartianLife 70

  62. Component @parisba | @The_McJones | @TheMartianLife 71

  63. Component Examples » position (an x and a y) » velocity » sprite(s) » health value » character name » player (tag) @parisba | @The_McJones | @TheMartianLife 72

  64. System @parisba | @The_McJones | @TheMartianLife 73

  65. System Examples » player control » render » gravity » movement » AI control @parisba | @The_McJones | @TheMartianLife 74

  66. Games, Games, Games @parisba | @The_McJones | @TheMartianLife 75

  67. ECS doesn't necessarily mean less code. Theoretically it means better code, though. @parisba | @The_McJones | @TheMartianLife 76

  68. What ECS is good for @parisba | @The_McJones | @TheMartianLife 77

  69. Performance? @parisba | @The_McJones | @TheMartianLife 78

  70. “The purpose of all programs, and all parts of those programs, is to transform data from one form to another.” Mike Acton

  71. Data Oriented Design @parisba | @The_McJones | @TheMartianLife 80

  72. Data-oriented Design is tricky @parisba | @The_McJones | @TheMartianLife 81

  73. You never do just one thing @parisba | @The_McJones | @TheMartianLife 82

  74. Cache Misses @parisba | @The_McJones | @TheMartianLife 86

  75. Cache misses suck @parisba | @The_McJones | @TheMartianLife 87

  76. Data-oriented Design = Programming for Good Memory Access @parisba | @The_McJones | @TheMartianLife 89

  77. ECS encourages Data- oriented Design @parisba | @The_McJones | @TheMartianLife 90

  78. Caches, memory speed, oh my! @parisba | @The_McJones | @TheMartianLife 91

  79. Parallelisation @parisba | @The_McJones | @TheMartianLife 92

  80. Lots of tasks. Large set of data. @parisba | @The_McJones | @TheMartianLife 93

  81. Structure around consuming data as a stream. @parisba | @The_McJones | @TheMartianLife 94

  82. Complex, interlocking systems. @parisba | @The_McJones | @TheMartianLife 95

  83. Composability The biggest advantage @parisba | @The_McJones | @TheMartianLife 96

  84. ECS is great for... » GUI Programming » Editors » Audio systems » VFX systems » Simulations » A service registry » ... almost anything that's event-driven » ... anything you want to easily unit test @parisba | @The_McJones | @TheMartianLife 97

  85. GUI Programming @parisba | @The_McJones | @TheMartianLife 98

  86. A NEAT SIDE-EFFECT OF ECS! @parisba | @The_McJones | @TheMartianLife 99

  87. In practice, it's not that easy... @parisba | @The_McJones | @TheMartianLife 100

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend