Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Exploring programming patterns through game dev...

Codemotion
November 13, 2019

Exploring programming patterns through game development_Derek Briggs_Codemotion Berlin 2019

This talk will teach you about some of the programming patterns, that are commonly used in Game Development. I will be showing real world of examples, of patterns like Finite State Machine, and ECS Architecture, used in video games. I will talk about how to implement these patterns in games, why you would want to use these patterns in games, and I will talk about when to use some of these patterns, in software projects, that are not video games. I will be using Kotlin in most code samples, but knowing Kotlin, will not be required to learn something from this talk.

About: Derek Briggs, Software-Developer, Self-Employed

I am a self taught developer. My specialties are mobile and game development. My primary languages are Kotlin/Java and Ruby. I am a Linux poweruser, and FOSS advocate.

Codemotion

November 13, 2019
Tweet

More Decks by Codemotion

Other Decks in Technology

Transcript

  1. About Me • Free and Open Source Software advocate •

    Hobbyist Game Developer • Website: Derekbriggs.xyz
  2. What is this talk? • Programming Patterns − Erich Gamma,

    Richard Helm, Ralph Johnson, and John Vlissides – Gang of Four • LibGDX with Kotlin
  3. What is LibGDX? • Game Framework written in Java •

    FOSS • Targets Android, Desktop, IOS, and HTML • Supports Kotlin with a little configuring • LibKTX – Optional 3rd party extensions
  4. What is Kotlin? • JVM Language by Jetbrains • Full

    Interoperability with Java • Syntactically similar to Java • 2 Notable differences − Type Inference − Mutable vs Immutable “variables”
  5. If jumpButton is pressed player jump Player Y position –=

    gravity Obstacle X position -= Speed If 1.5 seconds have passed spawn new obstacles If player passes an obstacle update the score
  6. Update Method • The responsibility of controlling entities in our

    games, should belong to the entities themselves
  7. Game Loop and Update Method • Pros: • Separates our

    loop from processor speed and user input • It’s how games are made • Cons: • It’s how games are made
  8. Data != Logic • Logic: Generally what happens in a

    game • Data: Exactly what happens in a game • Do not treat them as the same thing • Avoid hardcoding data whenever possible
  9. Command • Commands are an object-oriented replacement for callbacks •

    Function pointers and closures are pretty closely related • Cons: • You may end up with a LOT of classes