Real-Time Gaming Blog

GenCar.co: Multiplayer Genetic Algorithm 2D Cars

2 min readJoe 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

How to Advance Telehealth and Virtual Care Technologies
News May 2, 20221 min read

How to Advance Telehealth and Virtual Care Technologies

Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...

PubNub Staff

PubNub Staff

Another Step Towards Data Security: ISO-27001 Implementation
BuildMay 2, 20221 min read

Another Step Towards Data Security: ISO-27001 Implementation

Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.

PubNub Staff

PubNub Staff

Improving Virtual Care in a Post-Pandemic World
News Apr 14, 20221 min read

Improving Virtual Care in a Post-Pandemic World

Meg Barron, VP of Digital Health Strategy at the AMA, talks with PubNub’s COO, Casey Clegg, about what’s next for the healthcare...

PubNub Staff

PubNub Staff