SlideShare una empresa de Scribd logo
1 de 64
Descargar para leer sin conexión
..to boldly go where no web developer has
                              gone before.




Building a game engine
with jQuery
Why build a game engine?
Aren‘t there enough already?
Game development
Browsergame development vs. game industry*
* PC/Console game publishers
Same basic questions
What kind of genre for my
game?
Singleplayer or multiplayer?
What platform(s) am I
targeting?
What tools do I need for
development?
How does the game scale?
The game industry
Convenience

Countless tools and
frameworks to choose from
Frameworks can be
extended with more genres
Modularity gives you flexible
combinations inbetween
The browser game industry
Browser games are often grown
hobby projects
Development often copied from app
dev paradigms rather than games
No real technical standard (i.e. C++)
a lot (no seriously, a lot!) of legacy,
custom code
Frameworks
 Few good commercial flash
 frameworks
 No commercial JavaScript
 alternatives
 A couple tiny projects
   most of them concepts
   most of them dead
Why no frameworks?
Browser game development is pretty young!

Game industry has an advantage of ~25 years
Only very recently, we got

  powerful enough hardware
  to run lots of crazy JS

  new advanced
  technologies: CSS3,
  HTML5

  highly optimized rendering
  engines: Nitro etc.
Additionally...

 Lots of knowledge needed to build sophisticated
 games
   ..but many started it as hobby
 Actual web devs are seldom good game devs – and
 vice versa
 Very few allrounders that know both worlds
Reality without frameworks:




Countless iterations of code!
Sweet!


I have no competition
There‘s high demand
Let‘s rock!
The open web stack
Picking the right technologies
Cross-browser?

 If your engine is platform specific, no need to care
 about cross-browser
   Example: Engine for mobile WebKit
 Pro‘s and con‘s
   Limited audience
   Extreme development speedup and advantage
Don‘t worry about today   Your game won‘t be
                          ready tomorrow!
Pick technologies from
the future                Predict wisely
Our pick

 Vanilla HTML (rendering)
 JavaScript (scripting, client + server!)
 Canvas (as tool, not for rendering)
   (mostly) cross-platform via ExCanvas

 CSS Transforms
   cross-platform via Transformie
..and of course
Architecture and API Design
What to keep in mind when building the web
Impossibilities

 Genres that can‘t be   Genres that can‘t be
 implemented now, but   implemented for many
 pretty soon:           years to come:
   Casual 3D games,     Next-gen 3D games
   simple shooters
                        WebGL is not
   Using WebGL          advanced enough (yet)
So what is left?
2D                 2.5D*
     Puzzles         RPG‘s

     Adventure       Strategy

     Board games       turn based

     Card games        real time

     Platformers     Simulation

     Jump & Runs     etc.

                                * isometry
We chose...
I want...
 Free mouse panning         Pathfinding
 Infinite real-time worlds   Walking into houses
 Non-rectangular objects    Mashups with normal
                            HTML content
 Animated characters
                            Sound effects
 Chat bubbles
                            Scalable viewports
 Collision detection
                            MMO-ready server
Awesome! Sounds
just like the Duke!
Errr...


 Yes, if we try to develop a
 classic game engine
 We‘re aiming for the web
 though, let‘s cheat!
Advanced Techniques
Two examples
Rendering
„How do I render 2000 objects in < 50ms?“
Uh uh, obviously I‘ll use
Canvas!
Oh noes! Canvas is a lot
slower!

            Canvas‘ image API is pretty
            inefficient, as it needs a DOM
            representation of the image first
            Which means if you‘re working
            with lots of graphics, Canvas is
            actually way slower than generic
            HTML
Block rendering
Block rendering?
 Directly replace innerHTML with a huge string instead of
 multiple DOM append operations
 Huge performance boost:
   Native parsing of HTML engine is really fast
   Reflow and Repaint occur only once
 Huge disadvantage:
   No reference to individual nodes!
Lazy node linking

 Fixes the main disadvantage of missing references
 After innerHTML has been set, run:
 var elements = $(‘ *‘, container);
 Now you have a collection of all elements!
 Since you know the order of the construction, you can
 reference back
Smart rendering
Conservative method
Build <div>‘s and style
them via JavaScript (on      <div
                             style="position:absolut
the style tag)               e; top:122px; left:
                             145px; z-index:102;
Render them out en           background-image:url
bloque through               (house_1.png); margin-
innerHTML                    top:-10px; margin-
                             left:-10px; background-
                             position:10px 33px;"></
Ugh, still kind of slow...   div>

I want more!
Dummy, forgot
how to build
websites?
Web method

Don‘t ignore the layout
layers
  expecially not external
  CSS
Keep the style tag of the
<div> Object minimal:
  z-index, top, left
Web method

 Everything else is
 rendered through a
 CSS rule
 i.e. model-134
 Includes background,
 margin, padding etc
Delegation
jQuery events and click-through maps
What is event delegation?
 A technique to „forward“ events to implicit listeners
 In web development, usually the following:
   Bind an event to the root node except for the actual
   child element
   When an event happens (i.e. click), find out if the
   target or an ancestor matches the child element
   Moves processing efforts to when the event
   happens, scales really well
One event to rule them all

 „mousemove“
  Handles position detection, dragging
 „mousedown“
  Handles drag start, clicking
 „mouseup“
  Handles drag stop, clicking
..and with jQuery?

 With jQuery, it‘s even easier
 jQuery has live/die methods that
   work like bind/unbind
   abstracts event delegation so..
   ..you don‘t need to worry about it
 Sweet!
live/die on objects


                      Yay, I can click on
                      houses!
                      Mh, I can click on
                      transparency, too..
                      This kind of sucks!
Be creative!
Click through maps

Build up a pixel map for each object that tells us where
the transparent pixels are
If transparent, check behind until you find a valid target
  Checking behind can be done, since you control the viewport, and you know
  where your elements are

W00t, this fixes our issue!
Building up those pixel maps is amazingly
              crappy work!
Let Canvas do it!
 Canvas can read pixel data from images
 Then, we can check if our pixel is in fact transparent
 ...and save this 0/1 value in a new optimized, smaller
 array


        var   clickMap = [];
        for   (var i = 0, n = imageData.length; i < n; i += 4) {
        	     var row = Math.floor((i / 4) / width);
        	     var col = (i/4) - (row * width);
        	     if(!clickMap[row]) clickMap[row] = [];
        	     clickMap[row][col] = imageData[i+3] == 0 ? 0 : 1;
        }
Server-side JavaScript
Bridging the gap
„JavaScript is painful enough already, now you
want me to work with it in the backend as well?“
Why JavaScript?

A single scripting language per project dramatically
speeds up development
Great portions of client side code (i.e. for calculations)
can be reused without costs
JavaScript is awesome!
Meet node.js
 „So sexy it hurts“
„The most revolutionary
technology for web developers
        since jQuery.“
                       Paul Bakaus
JavaScript in the Browser
JavaScript in node
Node‘s features

 Google‘s V8 engine running on server
 Server and scripting combined
 Comes with sugar (pretty modules for system, servers
 etc.)
 EcmaScript 5
The great innovation?
Node is completely event-
         driven.
  db.query(‘ select..‘, function(result) {});
?

Professional game engine for the web
Commercially licensable
Cross-platform (yes, works on iPhone!)
Comes with all mentioned features (and more)
Currently in alpha   Contact us for availability and pricing!
Show me the video!
http://tinyurl.com/dextrose-aves-engine-sneak
Thanks for your attention!
More at dextrose.com & paulbakaus.com
Rate this talk at http://spkr8.com/t/2986




                                     @pbakaus


We‘re looking for investors and
partners!

Contact us at contact@dextrose.com
for more information.

Más contenido relacionado

La actualidad más candente

Advanced Power Point 1
Advanced Power Point 1Advanced Power Point 1
Advanced Power Point 1liwei1207zz
 
Unty3D Awesome Assets - uTomate
Unty3D Awesome Assets - uTomateUnty3D Awesome Assets - uTomate
Unty3D Awesome Assets - uTomateTaras Leskiv
 
Phaser Workshop Internet World 2014
Phaser Workshop Internet World 2014Phaser Workshop Internet World 2014
Phaser Workshop Internet World 2014Alvinsight
 
3D Clearance Rack: Add Affordable 3D Content to eLearning Simulations, AR, an...
3D Clearance Rack: Add Affordable 3D Content to eLearning Simulations, AR, an...3D Clearance Rack: Add Affordable 3D Content to eLearning Simulations, AR, an...
3D Clearance Rack: Add Affordable 3D Content to eLearning Simulations, AR, an...Michael Sheyahshe
 
Javascript Animation with Canvas - Gregory Starr 2015
Javascript Animation with Canvas - Gregory Starr 2015Javascript Animation with Canvas - Gregory Starr 2015
Javascript Animation with Canvas - Gregory Starr 2015Gregory Starr
 
Unity3D Tips and Tricks or "You are doing it wrong!"
Unity3D Tips and Tricks or "You are doing it wrong!"Unity3D Tips and Tricks or "You are doing it wrong!"
Unity3D Tips and Tricks or "You are doing it wrong!"Taras Leskiv
 
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...Pablo Farías Navarro
 
Prototyping Axure
Prototyping AxurePrototyping Axure
Prototyping Axurekkostuch
 
Managing Visual Design in Axure
Managing Visual Design in AxureManaging Visual Design in Axure
Managing Visual Design in AxureFred Beecher
 
Intro to Axure 7 - User Vision Breakfast Briefing
Intro to Axure 7 - User Vision Breakfast BriefingIntro to Axure 7 - User Vision Breakfast Briefing
Intro to Axure 7 - User Vision Breakfast BriefingStephen Denning
 
Practical Guide for Optimizing Unity on Mobiles
Practical Guide for Optimizing Unity on MobilesPractical Guide for Optimizing Unity on Mobiles
Practical Guide for Optimizing Unity on MobilesValentin Simonov
 
Mirror - Android UI development on steroids
Mirror - Android UI development on steroidsMirror - Android UI development on steroids
Mirror - Android UI development on steroidsSylwester Madej
 
Unity: Unity Flash – ключ к созданию Flash 3D
 Unity: Unity Flash – ключ к созданию Flash 3D Unity: Unity Flash – ключ к созданию Flash 3D
Unity: Unity Flash – ключ к созданию Flash 3DDevGAMM Conference
 
Rapid Game Development with RUby and Gosu – Ruby Manor 4
Rapid Game Development with RUby and Gosu – Ruby Manor 4Rapid Game Development with RUby and Gosu – Ruby Manor 4
Rapid Game Development with RUby and Gosu – Ruby Manor 4benko
 
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)David Salz
 
Game Design 2: 2011 - Introduction to Game Interface Design
Game Design 2: 2011 - Introduction to Game Interface DesignGame Design 2: 2011 - Introduction to Game Interface Design
Game Design 2: 2011 - Introduction to Game Interface DesignDavid Farrell
 
Game Engine Architecture
Game Engine ArchitectureGame Engine Architecture
Game Engine ArchitectureAttila Jenei
 

La actualidad más candente (19)

Advanced Power Point 1
Advanced Power Point 1Advanced Power Point 1
Advanced Power Point 1
 
Unty3D Awesome Assets - uTomate
Unty3D Awesome Assets - uTomateUnty3D Awesome Assets - uTomate
Unty3D Awesome Assets - uTomate
 
Phaser Workshop Internet World 2014
Phaser Workshop Internet World 2014Phaser Workshop Internet World 2014
Phaser Workshop Internet World 2014
 
3D Clearance Rack: Add Affordable 3D Content to eLearning Simulations, AR, an...
3D Clearance Rack: Add Affordable 3D Content to eLearning Simulations, AR, an...3D Clearance Rack: Add Affordable 3D Content to eLearning Simulations, AR, an...
3D Clearance Rack: Add Affordable 3D Content to eLearning Simulations, AR, an...
 
Javascript Animation with Canvas - Gregory Starr 2015
Javascript Animation with Canvas - Gregory Starr 2015Javascript Animation with Canvas - Gregory Starr 2015
Javascript Animation with Canvas - Gregory Starr 2015
 
Unity3D Tips and Tricks or "You are doing it wrong!"
Unity3D Tips and Tricks or "You are doing it wrong!"Unity3D Tips and Tricks or "You are doing it wrong!"
Unity3D Tips and Tricks or "You are doing it wrong!"
 
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
HTML5 Mobile Game Development Workshop - Module 2 - HTML5 Developer Conferenc...
 
Prototyping Axure
Prototyping AxurePrototyping Axure
Prototyping Axure
 
Managing Visual Design in Axure
Managing Visual Design in AxureManaging Visual Design in Axure
Managing Visual Design in Axure
 
Intro to Axure 7 - User Vision Breakfast Briefing
Intro to Axure 7 - User Vision Breakfast BriefingIntro to Axure 7 - User Vision Breakfast Briefing
Intro to Axure 7 - User Vision Breakfast Briefing
 
Practical Guide for Optimizing Unity on Mobiles
Practical Guide for Optimizing Unity on MobilesPractical Guide for Optimizing Unity on Mobiles
Practical Guide for Optimizing Unity on Mobiles
 
Inkscape
InkscapeInkscape
Inkscape
 
Mirror - Android UI development on steroids
Mirror - Android UI development on steroidsMirror - Android UI development on steroids
Mirror - Android UI development on steroids
 
Phaser presentation
Phaser presentationPhaser presentation
Phaser presentation
 
Unity: Unity Flash – ключ к созданию Flash 3D
 Unity: Unity Flash – ключ к созданию Flash 3D Unity: Unity Flash – ключ к созданию Flash 3D
Unity: Unity Flash – ключ к созданию Flash 3D
 
Rapid Game Development with RUby and Gosu – Ruby Manor 4
Rapid Game Development with RUby and Gosu – Ruby Manor 4Rapid Game Development with RUby and Gosu – Ruby Manor 4
Rapid Game Development with RUby and Gosu – Ruby Manor 4
 
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
Albion Online - A Cross-Platform MMO (Unite Europe 2016, Amsterdam)
 
Game Design 2: 2011 - Introduction to Game Interface Design
Game Design 2: 2011 - Introduction to Game Interface DesignGame Design 2: 2011 - Introduction to Game Interface Design
Game Design 2: 2011 - Introduction to Game Interface Design
 
Game Engine Architecture
Game Engine ArchitectureGame Engine Architecture
Game Engine Architecture
 

Destacado

Beyond the Standards
Beyond the StandardsBeyond the Standards
Beyond the StandardsPaul Bakaus
 
An in-depth look at jQuery
An in-depth look at jQueryAn in-depth look at jQuery
An in-depth look at jQueryPaul Bakaus
 
An in-depth look at jQuery UI
An in-depth look at jQuery UIAn in-depth look at jQuery UI
An in-depth look at jQuery UIPaul Bakaus
 
EMC World 2015 - Why DevOps is Critical for Business
EMC World 2015 -  Why DevOps is Critical for BusinessEMC World 2015 -  Why DevOps is Critical for Business
EMC World 2015 - Why DevOps is Critical for BusinessBrian Gracely
 
Activated Carbon Study
Activated Carbon StudyActivated Carbon Study
Activated Carbon StudyJandel Gimeno
 
영양과 식이 파트1
영양과 식이 파트1영양과 식이 파트1
영양과 식이 파트1kochung77
 
마케팅 관점에서 IoT째려보기
마케팅 관점에서 IoT째려보기마케팅 관점에서 IoT째려보기
마케팅 관점에서 IoT째려보기형석 Bobby 김
 
Activated Carbon
Activated CarbonActivated Carbon
Activated CarbonJahee Lee
 
Rapid Prototyping (Mechanical)
Rapid Prototyping (Mechanical)Rapid Prototyping (Mechanical)
Rapid Prototyping (Mechanical)Shubham Thakur
 
Micro Electro Mechanical Systems (MEMS) Class Materials - Lecture 01
Micro Electro Mechanical Systems (MEMS) Class Materials - Lecture 01Micro Electro Mechanical Systems (MEMS) Class Materials - Lecture 01
Micro Electro Mechanical Systems (MEMS) Class Materials - Lecture 01Manipal Institute of Technology
 
Working of safety airbags and their manufacturing
Working of safety airbags  and their manufacturingWorking of safety airbags  and their manufacturing
Working of safety airbags and their manufacturinganil mangalan
 
Rapid prototyping
Rapid prototypingRapid prototyping
Rapid prototypingAjaa Tahir
 
Rapid prototyping technology
Rapid prototyping technologyRapid prototyping technology
Rapid prototyping technologyanil mangalan
 
What is UX and how can it help your organisation?
What is UX and how can it help your organisation?What is UX and how can it help your organisation?
What is UX and how can it help your organisation?Ned Potter
 
Chaos Driven Development (Bruce Wong)
Chaos Driven Development (Bruce Wong)Chaos Driven Development (Bruce Wong)
Chaos Driven Development (Bruce Wong)Future Insights
 
Pedal Powered Washing Machine
Pedal Powered Washing MachinePedal Powered Washing Machine
Pedal Powered Washing MachineShubham Thakur
 
How to shout so your users will listen
How to shout so your users will listenHow to shout so your users will listen
How to shout so your users will listenNed Potter
 
Exhaust gas-recirculation-in-four-stroke-engine
Exhaust gas-recirculation-in-four-stroke-engineExhaust gas-recirculation-in-four-stroke-engine
Exhaust gas-recirculation-in-four-stroke-engine0510abhi
 

Destacado (20)

Beyond the Standards
Beyond the StandardsBeyond the Standards
Beyond the Standards
 
An in-depth look at jQuery
An in-depth look at jQueryAn in-depth look at jQuery
An in-depth look at jQuery
 
An in-depth look at jQuery UI
An in-depth look at jQuery UIAn in-depth look at jQuery UI
An in-depth look at jQuery UI
 
EMC World 2015 - Why DevOps is Critical for Business
EMC World 2015 -  Why DevOps is Critical for BusinessEMC World 2015 -  Why DevOps is Critical for Business
EMC World 2015 - Why DevOps is Critical for Business
 
Activated Carbon Study
Activated Carbon StudyActivated Carbon Study
Activated Carbon Study
 
Z510 3D PRINTER
Z510 3D PRINTERZ510 3D PRINTER
Z510 3D PRINTER
 
영양과 식이 파트1
영양과 식이 파트1영양과 식이 파트1
영양과 식이 파트1
 
마케팅 관점에서 IoT째려보기
마케팅 관점에서 IoT째려보기마케팅 관점에서 IoT째려보기
마케팅 관점에서 IoT째려보기
 
Activated Carbon
Activated CarbonActivated Carbon
Activated Carbon
 
Rapid Prototyping (Mechanical)
Rapid Prototyping (Mechanical)Rapid Prototyping (Mechanical)
Rapid Prototyping (Mechanical)
 
Micro Electro Mechanical Systems (MEMS) Class Materials - Lecture 01
Micro Electro Mechanical Systems (MEMS) Class Materials - Lecture 01Micro Electro Mechanical Systems (MEMS) Class Materials - Lecture 01
Micro Electro Mechanical Systems (MEMS) Class Materials - Lecture 01
 
Activated Carbon
Activated CarbonActivated Carbon
Activated Carbon
 
Working of safety airbags and their manufacturing
Working of safety airbags  and their manufacturingWorking of safety airbags  and their manufacturing
Working of safety airbags and their manufacturing
 
Rapid prototyping
Rapid prototypingRapid prototyping
Rapid prototyping
 
Rapid prototyping technology
Rapid prototyping technologyRapid prototyping technology
Rapid prototyping technology
 
What is UX and how can it help your organisation?
What is UX and how can it help your organisation?What is UX and how can it help your organisation?
What is UX and how can it help your organisation?
 
Chaos Driven Development (Bruce Wong)
Chaos Driven Development (Bruce Wong)Chaos Driven Development (Bruce Wong)
Chaos Driven Development (Bruce Wong)
 
Pedal Powered Washing Machine
Pedal Powered Washing MachinePedal Powered Washing Machine
Pedal Powered Washing Machine
 
How to shout so your users will listen
How to shout so your users will listenHow to shout so your users will listen
How to shout so your users will listen
 
Exhaust gas-recirculation-in-four-stroke-engine
Exhaust gas-recirculation-in-four-stroke-engineExhaust gas-recirculation-in-four-stroke-engine
Exhaust gas-recirculation-in-four-stroke-engine
 

Similar a Building a game engine with jQuery

Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesVitaly Friedman
 
Academy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsAcademy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsBinary Studio
 
Catan world and Churchill
Catan world and ChurchillCatan world and Churchill
Catan world and ChurchillGrant Goodale
 
Responsive design and retina displays
Responsive design and retina displaysResponsive design and retina displays
Responsive design and retina displaysEli McMakin
 
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.esCreating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.esdavrous
 
Node.JS| Coffeescript Presentation
Node.JS| Coffeescript PresentationNode.JS| Coffeescript Presentation
Node.JS| Coffeescript PresentationSam Frons
 
The 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityThe 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityDirk Ginader
 
Stocktwits & Responsive Web Design, social network meets flexible framework
Stocktwits & Responsive Web Design, social network meets flexible frameworkStocktwits & Responsive Web Design, social network meets flexible framework
Stocktwits & Responsive Web Design, social network meets flexible frameworkJohn Strott
 
Embracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think ResponsivelyEmbracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think ResponsivelyChad Currie
 
I thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupI thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupMario Heiderich
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty grittyMario Noble
 
Full stack development in Go
Full stack development in GoFull stack development in Go
Full stack development in GoYves Junqueira
 
Simplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and toolsSimplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and toolsRui Carvalho
 
HTML5 - Chances and Pitfalls (Bytro Labs GmbH)
HTML5 - Chances and Pitfalls (Bytro Labs GmbH)HTML5 - Chances and Pitfalls (Bytro Labs GmbH)
HTML5 - Chances and Pitfalls (Bytro Labs GmbH)Felix Faber
 
HTML5 Dev Conf 2013 Presentation
HTML5 Dev Conf 2013 PresentationHTML5 Dev Conf 2013 Presentation
HTML5 Dev Conf 2013 PresentationIker Jamardo
 
Sx sw speaker proposal slides
Sx sw speaker proposal slidesSx sw speaker proposal slides
Sx sw speaker proposal slidesMitch Williams
 
Responsive Web Design tips and tricks.
Responsive Web Design tips and tricks.Responsive Web Design tips and tricks.
Responsive Web Design tips and tricks.GaziAhsan
 

Similar a Building a game engine with jQuery (20)

Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and Techniques
 
Academy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsAcademy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphics
 
Catan world and Churchill
Catan world and ChurchillCatan world and Churchill
Catan world and Churchill
 
The Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. WebThe Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. Web
 
Responsive design and retina displays
Responsive design and retina displaysResponsive design and retina displays
Responsive design and retina displays
 
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.esCreating 3D Worlds with WebGL and Babylon.js - Codemotion.es
Creating 3D Worlds with WebGL and Babylon.js - Codemotion.es
 
Node.JS| Coffeescript Presentation
Node.JS| Coffeescript PresentationNode.JS| Coffeescript Presentation
Node.JS| Coffeescript Presentation
 
Html5 (games)
Html5 (games)Html5 (games)
Html5 (games)
 
The 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityThe 5 Layers of Web Accessibility
The 5 Layers of Web Accessibility
 
Stocktwits & Responsive Web Design, social network meets flexible framework
Stocktwits & Responsive Web Design, social network meets flexible frameworkStocktwits & Responsive Web Design, social network meets flexible framework
Stocktwits & Responsive Web Design, social network meets flexible framework
 
Embracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think ResponsivelyEmbracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think Responsively
 
I thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupI thought you were my friend - Malicious Markup
I thought you were my friend - Malicious Markup
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty gritty
 
Full stack development in Go
Full stack development in GoFull stack development in Go
Full stack development in Go
 
Simplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and toolsSimplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and tools
 
HTML5 - Chances and Pitfalls (Bytro Labs GmbH)
HTML5 - Chances and Pitfalls (Bytro Labs GmbH)HTML5 - Chances and Pitfalls (Bytro Labs GmbH)
HTML5 - Chances and Pitfalls (Bytro Labs GmbH)
 
HTML5 Dev Conf 2013 Presentation
HTML5 Dev Conf 2013 PresentationHTML5 Dev Conf 2013 Presentation
HTML5 Dev Conf 2013 Presentation
 
Sx sw speaker proposal slides
Sx sw speaker proposal slidesSx sw speaker proposal slides
Sx sw speaker proposal slides
 
Responsive Web Design tips and tricks.
Responsive Web Design tips and tricks.Responsive Web Design tips and tricks.
Responsive Web Design tips and tricks.
 
Rwd slidedeck
Rwd slidedeckRwd slidedeck
Rwd slidedeck
 

Último

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Último (20)

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

Building a game engine with jQuery

  • 1. ..to boldly go where no web developer has gone before. Building a game engine with jQuery
  • 2. Why build a game engine? Aren‘t there enough already?
  • 3. Game development Browsergame development vs. game industry* * PC/Console game publishers
  • 4. Same basic questions What kind of genre for my game? Singleplayer or multiplayer? What platform(s) am I targeting? What tools do I need for development? How does the game scale?
  • 6. Convenience Countless tools and frameworks to choose from Frameworks can be extended with more genres Modularity gives you flexible combinations inbetween
  • 7. The browser game industry
  • 8. Browser games are often grown hobby projects Development often copied from app dev paradigms rather than games No real technical standard (i.e. C++) a lot (no seriously, a lot!) of legacy, custom code
  • 9. Frameworks Few good commercial flash frameworks No commercial JavaScript alternatives A couple tiny projects most of them concepts most of them dead
  • 11. Browser game development is pretty young! Game industry has an advantage of ~25 years
  • 12. Only very recently, we got powerful enough hardware to run lots of crazy JS new advanced technologies: CSS3, HTML5 highly optimized rendering engines: Nitro etc.
  • 13. Additionally... Lots of knowledge needed to build sophisticated games ..but many started it as hobby Actual web devs are seldom good game devs – and vice versa Very few allrounders that know both worlds
  • 15. Sweet! I have no competition There‘s high demand Let‘s rock!
  • 16. The open web stack Picking the right technologies
  • 17. Cross-browser? If your engine is platform specific, no need to care about cross-browser Example: Engine for mobile WebKit Pro‘s and con‘s Limited audience Extreme development speedup and advantage
  • 18. Don‘t worry about today Your game won‘t be ready tomorrow! Pick technologies from the future Predict wisely
  • 19. Our pick Vanilla HTML (rendering) JavaScript (scripting, client + server!) Canvas (as tool, not for rendering) (mostly) cross-platform via ExCanvas CSS Transforms cross-platform via Transformie
  • 21. Architecture and API Design What to keep in mind when building the web
  • 22. Impossibilities Genres that can‘t be Genres that can‘t be implemented now, but implemented for many pretty soon: years to come: Casual 3D games, Next-gen 3D games simple shooters WebGL is not Using WebGL advanced enough (yet)
  • 23. So what is left?
  • 24. 2D 2.5D* Puzzles RPG‘s Adventure Strategy Board games turn based Card games real time Platformers Simulation Jump & Runs etc. * isometry
  • 26.
  • 27. I want... Free mouse panning Pathfinding Infinite real-time worlds Walking into houses Non-rectangular objects Mashups with normal HTML content Animated characters Sound effects Chat bubbles Scalable viewports Collision detection MMO-ready server
  • 29. Errr... Yes, if we try to develop a classic game engine We‘re aiming for the web though, let‘s cheat!
  • 31. Rendering „How do I render 2000 objects in < 50ms?“
  • 32. Uh uh, obviously I‘ll use Canvas!
  • 33. Oh noes! Canvas is a lot slower! Canvas‘ image API is pretty inefficient, as it needs a DOM representation of the image first Which means if you‘re working with lots of graphics, Canvas is actually way slower than generic HTML
  • 35. Block rendering? Directly replace innerHTML with a huge string instead of multiple DOM append operations Huge performance boost: Native parsing of HTML engine is really fast Reflow and Repaint occur only once Huge disadvantage: No reference to individual nodes!
  • 36. Lazy node linking Fixes the main disadvantage of missing references After innerHTML has been set, run: var elements = $(‘ *‘, container); Now you have a collection of all elements! Since you know the order of the construction, you can reference back
  • 38. Conservative method Build <div>‘s and style them via JavaScript (on <div style="position:absolut the style tag) e; top:122px; left: 145px; z-index:102; Render them out en background-image:url bloque through (house_1.png); margin- innerHTML top:-10px; margin- left:-10px; background- position:10px 33px;"></ Ugh, still kind of slow... div> I want more!
  • 39. Dummy, forgot how to build websites?
  • 40. Web method Don‘t ignore the layout layers expecially not external CSS Keep the style tag of the <div> Object minimal: z-index, top, left
  • 41. Web method Everything else is rendered through a CSS rule i.e. model-134 Includes background, margin, padding etc
  • 42. Delegation jQuery events and click-through maps
  • 43. What is event delegation? A technique to „forward“ events to implicit listeners In web development, usually the following: Bind an event to the root node except for the actual child element When an event happens (i.e. click), find out if the target or an ancestor matches the child element Moves processing efforts to when the event happens, scales really well
  • 44. One event to rule them all „mousemove“ Handles position detection, dragging „mousedown“ Handles drag start, clicking „mouseup“ Handles drag stop, clicking
  • 45. ..and with jQuery? With jQuery, it‘s even easier jQuery has live/die methods that work like bind/unbind abstracts event delegation so.. ..you don‘t need to worry about it Sweet!
  • 46. live/die on objects Yay, I can click on houses! Mh, I can click on transparency, too.. This kind of sucks!
  • 48. Click through maps Build up a pixel map for each object that tells us where the transparent pixels are If transparent, check behind until you find a valid target Checking behind can be done, since you control the viewport, and you know where your elements are W00t, this fixes our issue!
  • 49. Building up those pixel maps is amazingly crappy work!
  • 50. Let Canvas do it! Canvas can read pixel data from images Then, we can check if our pixel is in fact transparent ...and save this 0/1 value in a new optimized, smaller array var clickMap = []; for (var i = 0, n = imageData.length; i < n; i += 4) { var row = Math.floor((i / 4) / width); var col = (i/4) - (row * width); if(!clickMap[row]) clickMap[row] = []; clickMap[row][col] = imageData[i+3] == 0 ? 0 : 1; }
  • 52. „JavaScript is painful enough already, now you want me to work with it in the backend as well?“
  • 53. Why JavaScript? A single scripting language per project dramatically speeds up development Great portions of client side code (i.e. for calculations) can be reused without costs JavaScript is awesome!
  • 54. Meet node.js „So sexy it hurts“
  • 55. „The most revolutionary technology for web developers since jQuery.“ Paul Bakaus
  • 56. JavaScript in the Browser
  • 58. Node‘s features Google‘s V8 engine running on server Server and scripting combined Comes with sugar (pretty modules for system, servers etc.) EcmaScript 5
  • 60. Node is completely event- driven. db.query(‘ select..‘, function(result) {});
  • 61.
  • 62. ? Professional game engine for the web Commercially licensable Cross-platform (yes, works on iPhone!) Comes with all mentioned features (and more) Currently in alpha Contact us for availability and pricing!
  • 63. Show me the video! http://tinyurl.com/dextrose-aves-engine-sneak
  • 64. Thanks for your attention! More at dextrose.com & paulbakaus.com Rate this talk at http://spkr8.com/t/2986 @pbakaus We‘re looking for investors and partners! Contact us at contact@dextrose.com for more information.