pinoypixel game developer blog by Joey Albert Abano

Pinoypixel is a game development blog. This site contains casual filipino themed web and mobile indie games. Most of the projects would be in alpha or beta stages, sourcing from gamejams, test prototypes or just plain adhoc dumps.

Construct 2 online game using ajax polling

Thursday of August 11, 2016

In learning new things in software development, I believe that it is best to scale your knowledge by developing simple working projects. When creating a polling html5 game one should also consider polling request limitations and advantages, this will help you decide what type of gameplay you can create on top of it. Polling is different from websocket, webrtc and other tcp socket connected interfaces. The advantages are as follows:

  1. The game will work in most devices, This is the only major advantage of polling over other technologies, html5 is still on the works and currently not all browsers or mobile devices support webrtc and websockets(websockets are slowing being supported by newer browser.).
  2. Server resource, polling games if designed properly can use less resources compared to dedicated connections.
  3. Learning curve, if currently you only know traditional php, dotnet and java. I would recommended though to use nodejs as polling server to achive better response rate.

Below are the list of things to note of on the client side.

  1. Create a single synchronization function
  2. Create a request builder
  3. Create a response assigner
  4. Create an event handler trigger for every response recieved
  5. If possible put all the heavy processing in the client side
  6. Handle online and offline transition

Below are the list to note of on the server side.

  1. Go for Nodejs or other high performing server
  2. Simplified query
  3. Identify flash data
  4. Sensitive data should be handled in the server side

Polling should only be used on games that requires less update non-real time games, achievement tracking or static data request such as global maps, monster definitions or weapons. Using hybrid of polling and websockets/webrtc would take advantage of each others pro and cons.


This site pinoypixel is designed, developed and copyrighted by me [Joey Albert Abano], to view my main blog refer to Rankaru | I support this striving game studio Jyoru Games and this graphic content provider Katture. Please also provide your care for people with disability, by donating to this institution Philippine Down Syndrome Association.

Go Top. 2016-2020 Copyright by pinoypixel.com. If you want to contact me, drop a message in my gmail account at joey.abano(at)gmail(dot)com