Real-Time Gaming Blog

GenCar.co: Multiplayer Genetic Algorithm 2D Cars

2 min read Joe Hanson on Jun 29, 2013
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

We've updated our SDKs, and this code is now deprecated. Good news is we've written a comprehensive guide to building a multiplayer game. Check it out! Around the PubNub office, we're always sharing o...

Warning

We’ve updated our SDKs, and this code is now deprecated.

Good news is we’ve written a comprehensive guide to building a multiplayer game. Check it out!

Around the PubNub office, we’re always sharing our gaming high scores with each other, whether it’s TrackPad Destroyer, Lightweight Multiplayer Games with melonJS, or Real-Time Stats for Candy Box. So when our CTO Stephen Blum stumbled upon Rafael Matsunaga‘s Genetic Cars, naturally another competition was born.

The game uses genetic algorithms to test and improve simple racing cars on a randomly generated track. Similar to the Darwinian concept of Evolution, the most superior cars continue to combine and mutate while the weak cars are thrown out. The winning car is  added to your gene pool and is then genetically spliced and paired with your other cars. As more mutations are made, the cars become more efficient and travel farther.

However, our CTO Stephen Blum decided to take the game to the next level from single player to multiplayer by harnessing the PubNub Data Stream Network. The result was Gencar.co.

multiplayer

Because of PubNub’s Gencar.co multiplayer capabilities, it involves thousands of players at a time, which in turn has significantly accelerated the mutation rate. As a result, thousands of users at a time can watch as their cars increase in efficiency. In addition, we added a chat feature using PubNub Channel Presence to see how many people are in the app.

The open source code is all available on our GitHub Repository: Multiplayer Genetic Cars.

multiplayer

More from PubNub

Top Trends to Engage Your App Users
InsightsSep 27, 20224 min read

Top Trends to Engage Your App Users

Take a look at the top trends that are the most effective in attracting customers and reducing churn, and how you can incorporate...

PubNub Staff

PubNub Staff

Comparing Game Engines: Unity vs Unreal vs the Rest
Real-Time Gaming BlogSep 21, 20225 min read

Comparing Game Engines: Unity vs Unreal vs the Rest

Comparing the major game engines: Unity vs Unreal Engine vs Corona SDK vs GameMaker Studio, including the benefits and cons of...

PubNub Staff

PubNub Staff

Python Socket Programming: Client, Server and Peer Libraries
BuildSep 21, 20226 min read

Python Socket Programming: Client, Server and Peer Libraries

Sockets (aka socket programming) enable programs to send and receive data, bi-directionally, at any given moment. This tutorial...

PubNub Staff

PubNub Staff