All Projects → Josh1billion → Thatconf2015pong

Josh1billion / Thatconf2015pong

Slides and sample project code (pong) for my talk at That Conference 2015

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Thatconf2015pong

Never Blink
👀Blink and lose.
Stars: ✭ 802 (+15940%)
Mutual labels:  game, socketio
Game
⚔️ An online JavaScript 2D Medieval RPG.
Stars: ✭ 388 (+7660%)
Mutual labels:  game, gamedev
Magnum
Lightweight and modular C++11 graphics middleware for games and data visualization
Stars: ✭ 3,728 (+74460%)
Mutual labels:  game, gamedev
Terasology
Terasology - open source voxel world
Stars: ✭ 3,247 (+64840%)
Mutual labels:  game, gamedev
Texturepanner
This repository hosts a shader for Unity3D whose main goal is to facilitate the creation of neon-like signs, conveyor belts and basically whatever based on scrolling textures
Stars: ✭ 528 (+10460%)
Mutual labels:  game, gamedev
Voxelengine3
Voxel-engine in Javascript
Stars: ✭ 302 (+5940%)
Mutual labels:  game, gamedev
Ssvopenhexagon
C++14 FOSS clone of "Super Hexagon". Depends on SSVStart, SSVEntitySystem, SSVLuaWrapper, SSVMenuSystem, JSONcpp, SFML2.0. Features JSON/LUA customizable game files, a soundtrack by BOSSFIGHT, pseudo-3D effects.
Stars: ✭ 364 (+7180%)
Mutual labels:  game, gamedev
Noahgameframe
A fast, scalable, distributed game server engine/framework for C++, include the actor library, network library, can be used as a real time multiplayer game engine ( MMO RPG/MOBA ), which support C#/Lua script/ Unity3d, Cocos2dx and plan to support Unreal.
Stars: ✭ 3,258 (+65060%)
Mutual labels:  game, gamedev
Lambdahack
Haskell game engine library for roguelike dungeon crawlers; please offer feedback, e.g., after trying out the sample game with the web frontend at
Stars: ✭ 439 (+8680%)
Mutual labels:  game, gamedev
Cpp 3d Game Tutorial Series
C++ 3D Game Tutorial Series is a YouTube tutorial series, whose purpose is to help all those who want to take their first steps in the game development from scratch.
Stars: ✭ 400 (+7900%)
Mutual labels:  game, gamedev
Coffee
An opinionated 2D game engine for Rust
Stars: ✭ 771 (+15320%)
Mutual labels:  game, gamedev
Entitas Csharp
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
Stars: ✭ 5,393 (+107760%)
Mutual labels:  game, gamedev
Defaultecs
Entity Component System framework aiming for syntax and usage simplicity with maximum performance for game development.
Stars: ✭ 286 (+5620%)
Mutual labels:  game, gamedev
Games
🎮 A list of popular/awesome video games, add-ons, maps, etc. hosted on GitHub. Any genre. Any platform. Any engine.
Stars: ✭ 18,676 (+373420%)
Mutual labels:  game, gamedev
Minigolf
A minigolf game written without a game engine in C
Stars: ✭ 282 (+5540%)
Mutual labels:  game, gamedev
Vue Babylonjs
A ready-to-go 3d environment for Vue.js using Babylon.js
Stars: ✭ 356 (+7020%)
Mutual labels:  game, gamedev
Dino3d
🦖 Google Chrome T-Rex Run! in 3D (WebGL experiment)
Stars: ✭ 263 (+5160%)
Mutual labels:  game, gamedev
Wizardwarz
WebGL Multiplayer game with NodeJS backend
Stars: ✭ 270 (+5300%)
Mutual labels:  game, gamedev
Exengine
A C99 3D game engine
Stars: ✭ 391 (+7720%)
Mutual labels:  game, gamedev
Anything about game
A wonderful list of Game Development resources.
Stars: ✭ 541 (+10720%)
Mutual labels:  game, gamedev

#Installing node.js Nodejs.org has easy installation instructions. Note that Node.js installations come with npm installed by default, so you won't need to install that separately.

#Installing the sample code

Just checkout the repository, and you're good to go. Slides are in the root folder, and the code is in the pong folder.

I've included the node_modules directory, so you won't need to run npm install like you would for most projects.

Note that you'd generally not want to publish the node_modules directory to your repository, because it contains all of your dependencies, which tend to have many files, and so it will cause checkouts to be very slow (not to mention making updating those dependencies more difficult). It's better to keep that directory out of your repository, and just tell your users to run npm install, which will download all of the dependencies that are listed in package.json.

#Running the sample code

Open a command line and navigate to the pong folder, then type node app.js. You can also use nodemon app.js to run it with Nodemon instead (after you've installed it with npm install -g nodemon), which will cause it to restart the server upon any source code changes. The app should say "Listening on port 80", and then you can open two web browsers to http://localhost to try out the game.

The game is intentionally simple, so the server doesn't handle multiple game sessions, nor does it reset its state when the players disconnect. If you play a game of pong, you'll have to restart the server in order to play another one.

#Additional considerations not mentioned in talk/slides

Due to time/scope constraints, I left the following out of the talk intentionally, but these are some important concepts to note if you want to go forward with building games with Node.js/socket.io.

##Use requestAnimationFrame instead of setInterval()

On the client, using setInterval() to execute a function every second isn't really a good idea. I used it in the talk because it's familiar to every JavaScript developer, but there's a drop-in alternative that offers better performance and won't run into issues such as the application falling behind and trying to play catch-up.

You basically just need to pass your per-frame function to window.requestAnimationFrame(). But since browsers haven't always been consistent in their implementations of it, using a polyfill here is a good idea. Paul Irish has a robust polyfill and example on his blog that you should use.

##Modularizing your Node.js code

As you've probably guessed, putting all of your server code in one file is going to make things more difficult to maintain. A better approach is to modularize the building blocks of your code into your own Node.js modules, and require() them in, similar to how you would require() in somebody else's package that you installed with npm.

##Routes and templating

I mentioned in the talk that part of the reason for adding Express as a dependency (in addition to using it for serving static files) is that we might want to use some of its other features as the scope of the app expands.

Among these, Express offers easy use of routing and templating.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].