SlideShare a Scribd company logo
1 of 49
Download to read offline
Killer Robots are a
Concurrency Problem
Stephen McQuay @smcquay
Fraser Graham @twisted_weasel
I am learning Go, it's awesome.
I always wanted to write a game.
Cool
Cool
We should write a game, in Go…
LOL
“REAL”
GAMES
C
C++
NOT
GAMES
!
Java
Python
Ruby
Go
etc.
“simple”
GAMES
Javascript
Objective-C
Flash😩
C#
“Go is like Java, right?
Best suited for server
stuff? Nobody ever made a
successful game in Java!”
MINECRAFT
MATHPHYSICS
OPEN GL
GUINPUTCONCURRENCY
Let’s
Make a
Game!
o/
Robots
Are Cool
START:!
MV 100, 200!
FIR 300, 312!
SCN 3000!
JMPIF s0,
FOUND!
GOTO START:!
FOUND:!
FIR s0
Screenshots are Pre-Rendered
WEB
WebGL
Websockets
Game
Server
Game
Architecture
Bandwidth
Management
Game
Architecture
Robot Protocol
Game
Server
Robot
Game Server
SIMULATION
LOGIC
PLAYER
MANAGEMENT
SERIALIZATION
SERIALIZATION
SERIALIZATION
SERIALIZATION
Game(s) Server
SIMULATION
LOGIC
PLAYER MANAGEMENT
SERIALIZATION
SERIALIZATION
SERIALIZATION
SIMULATION
LOGIC
PLAYER MANAGEMENT
SERIALIZATION
SERIALIZATION
SERIALIZATION
SIMULATION
LOGIC
PLAYER MANAGEMENT
SERIALIZATION
SERIALIZATION
SERIALIZATION
SIMULATION
LOGIC
PLAYER
MANAGEMENT
SERIALIZATION
SERIALIZATION
SERIALIZATION
60Hz Not 60Hz
SIMULATION
LOGIC
!
GOROUTINE
PLAYER
MANAGEMENT
!
GOROUTINE
PLAYER
SERIALIZATION
!
GOROUTINE(S)
CHANNEL CHANNEL
Control, Control, You
must learn Control
Game
Server
Robot
Control, Control, You
must learn Control
Game
Server
Robot
Game
Broker
SIMULATION
LOGIC
!
GOROUTINE
PLAYER
MANAGEMENT
!
GOROUTINE
PLAYER
SERIALIZATION
!
GOROUTINE(S)
CHANNEL CHANNEL
HTTP
CONTROL
!
GOROUTINE
SIMULATION
LOGIC
!
GOROUTINE
PLAYER
MANAGEMENT
!
GOROUTINE
PLAYER
SERIALIZATION
!
GOROUTINE(S)
CHANNEL CHANNEL
SIMULATION
LOGIC
!
GOROUTINE
PLAYER
MANAGEMENT
!
GOROUTINE
PLAYER
SERIALIZATION
!
GOROUTINE(S)
CHANNEL CHANNEL
Bandwidth
Management
OR
“How I Learned to Stop
Worrying and Love
Interfaces”
Robot Protocol
Game
Server
Spectator Player
Robot Protocol
Game
Server
Spectator Player
Robot Protocol
Game
Server
Spectator Player
http://hyperboleandahalf.blogspot.com/2010/06/this-is-why-ill-
never-be-adult.html
type Point struct {
X, Y float64
}
!
...
!
p := Point{x, y}
b, err := json.Marshal(p)
!
...
!
json: '{"X":23.827610293658736,"Y":
42.273774761991874}'
bytes: 47 (worst)
func (fp *Point) AsArray() []float64 {
return []float64{fp.X, fp.Y}
}
!
...
!
p := Point{x, y}
b, err := json.Marshal(p.AsArray())
!
...
!
json: '[23.827610293658736,42.273774761991874]'
bytes: 39 (47 worst)
type Point struct {
X, Y float32
}
!
func (p *Point) AsArray() []float32 {
return []float32{p.X, p.Y}
}
!
...
!
jsoned: '[23.82761,42.273773]'
bytes: 20 (47 worst)
!
"(ಠ益ಠლ)
but at what cost?!
game.go:123: invalid operation: d + f
(mismatched types float64 and float32)
ʕノ◔ϖ◔ʔノ ︵ ┻━┻
type Gopher interface {
Squeak()
}
type Point struct {
X, Y float64
}
!
func (ip Point) Squeak() {
// ...
}
!
...
!
var p Point = Point{2, 3}
var g Gopher = Point{2, 3}
func foo(g Gopher) {}
!
var p Point = Point{2, 3}
foo(p)
If an encountered value
implements the
Marshaler interface and
is not a nil pointer,
Marshal calls its
MarshalJSON method to
produce JSON
type Point struct {
X, Y float64
}
!
func (p *Point) MarshalJSON() ([]byte, error) {
coords := []float32{
float32(fp.X),
float32(fp.Y),
}
return json.Marshal(coords)
}
!
...
!
jsoned: '[23.82761,42.273773]'
bytes: 20 (47 worst)
!
┬─┬ ʕ◔ϖ◔ʔ
package encoding
!
type BinaryMarshaler interface {
MarshalBinary() (data []byte, err error)
}
!
type TextMarshaler interface {
MarshalText() (text []byte, err error)
}
type encoder interface {
Encode(v interface{}) error
}
!
if encoding == "json" {
player.enc = json.NewEncoder(ws)
} else {
player.enc = gob.NewEncoder(ws)
}
!
...
player.enc.Encode(boardState)
Demo
Future
Work

More Related Content

Viewers also liked

Best practices-for-production-environments
Best practices-for-production-environmentsBest practices-for-production-environments
Best practices-for-production-environments
Artem Kovardin
 

Viewers also liked (8)

High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014
 
Best practices-for-production-environments
Best practices-for-production-environmentsBest practices-for-production-environments
Best practices-for-production-environments
 
Garbage collector и управление памятью в Go
Garbage collector и управление памятью в GoGarbage collector и управление памятью в Go
Garbage collector и управление памятью в Go
 
Anthony Starks - deck
Anthony Starks - deckAnthony Starks - deck
Anthony Starks - deck
 
C-spirit reborn: why Go was bound to be created
C-spirit reborn: why Go was bound to be createdC-spirit reborn: why Go was bound to be created
C-spirit reborn: why Go was bound to be created
 
OOP в Go
OOP в GoOOP в Go
OOP в Go
 
Talknoteとgolangと私
Talknoteとgolangと私Talknoteとgolangと私
Talknoteとgolangと私
 
GoによるWebアプリ開発のキホン
GoによるWebアプリ開発のキホンGoによるWebアプリ開発のキホン
GoによるWebアプリ開発のキホン
 

Similar to Fraser Graham Killer Robots

Architecting Cross-Platform Apps with MvvmCross, Stuart Lodge
Architecting Cross-Platform Apps with MvvmCross, Stuart LodgeArchitecting Cross-Platform Apps with MvvmCross, Stuart Lodge
Architecting Cross-Platform Apps with MvvmCross, Stuart Lodge
Xamarin
 
iBasket: The story of an HTML5 game
iBasket: The story of an HTML5 gameiBasket: The story of an HTML5 game
iBasket: The story of an HTML5 game
Iker Jamardo
 
Cheating in Computer Games
Cheating in Computer GamesCheating in Computer Games
Cheating in Computer Games
Iftach Ian Amit
 
Minkoff getting noticed-gdc_final
Minkoff getting noticed-gdc_finalMinkoff getting noticed-gdc_final
Minkoff getting noticed-gdc_final
Ninguno Ningun Otro
 

Similar to Fraser Graham Killer Robots (20)

Full stack development in Go
Full stack development in GoFull stack development in Go
Full stack development in Go
 
Introduction to 2D Game Development on Nokia Series 40 Asha Phones
Introduction to 2D Game Development on Nokia Series 40 Asha PhonesIntroduction to 2D Game Development on Nokia Series 40 Asha Phones
Introduction to 2D Game Development on Nokia Series 40 Asha Phones
 
Architecting Cross-Platform Apps with MvvmCross, Stuart Lodge
Architecting Cross-Platform Apps with MvvmCross, Stuart LodgeArchitecting Cross-Platform Apps with MvvmCross, Stuart Lodge
Architecting Cross-Platform Apps with MvvmCross, Stuart Lodge
 
Hacking for salone: drone races
Hacking for salone: drone racesHacking for salone: drone races
Hacking for salone: drone races
 
Wilhelm Oesterberg-Nordic Game Conference 2012-Why Making Social Games Doesn'...
Wilhelm Oesterberg-Nordic Game Conference 2012-Why Making Social Games Doesn'...Wilhelm Oesterberg-Nordic Game Conference 2012-Why Making Social Games Doesn'...
Wilhelm Oesterberg-Nordic Game Conference 2012-Why Making Social Games Doesn'...
 
Make believe - Droidcon UK 2015
Make believe - Droidcon UK 2015Make believe - Droidcon UK 2015
Make believe - Droidcon UK 2015
 
John Romero - The Early Days of Id Software: Programming Principles - Codemot...
John Romero - The Early Days of Id Software: Programming Principles - Codemot...John Romero - The Early Days of Id Software: Programming Principles - Codemot...
John Romero - The Early Days of Id Software: Programming Principles - Codemot...
 
Pc54
Pc54Pc54
Pc54
 
Introduction to game development
Introduction to game developmentIntroduction to game development
Introduction to game development
 
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
Hacking for Salone: Drone Races - Di Saverio; Lippolis - Codemotion Milan 2016
 
Google Developer Groups, Why We Choose Angular.js
Google Developer Groups, Why We Choose Angular.jsGoogle Developer Groups, Why We Choose Angular.js
Google Developer Groups, Why We Choose Angular.js
 
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
JavaOne 2017 - Choosing a NoSQL API and Database to Avoid Tombstones and Drag...
 
Drama Dash
Drama DashDrama Dash
Drama Dash
 
NVIDIA Cloud Gaming
NVIDIA Cloud GamingNVIDIA Cloud Gaming
NVIDIA Cloud Gaming
 
iBasket: The story of an HTML5 game
iBasket: The story of an HTML5 gameiBasket: The story of an HTML5 game
iBasket: The story of an HTML5 game
 
Sutd Game Lab's prototyping tips
Sutd Game Lab's prototyping tipsSutd Game Lab's prototyping tips
Sutd Game Lab's prototyping tips
 
Cheating in Computer Games
Cheating in Computer GamesCheating in Computer Games
Cheating in Computer Games
 
KeyLoggers - beating the shit out of keyboard since quite a long time
KeyLoggers - beating the shit out of keyboard since quite a long timeKeyLoggers - beating the shit out of keyboard since quite a long time
KeyLoggers - beating the shit out of keyboard since quite a long time
 
Minkoff getting noticed-gdc_final
Minkoff getting noticed-gdc_finalMinkoff getting noticed-gdc_final
Minkoff getting noticed-gdc_final
 
Gaming technology Presentation
Gaming technology PresentationGaming technology Presentation
Gaming technology Presentation
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Fraser Graham Killer Robots