If you’re into gaming and love creating things, then you may take inspiration from this Launchpad App. By using Redis, Graham Pinsent created his very own online racing game where friends, family, and colleagues can settle old scores and compete against each other for the finish line.
Just like any racing game, the ultimate objective is to get from A to B in the fastest possible time. Players are given a car, times are contested, and the winner is decided based on whoever can zoom through each lap the fastest.
But for this application to function optimally, data must be transmitted with hyper-efficiency to ensure player commands are carried out in real time. Failing to achieve this would create a disconnect between the player’s commands and their in-game vehicle, leading to a frustrating gaming experience.
To prevent this from happening, Graham leveraged Redis’ advanced capabilities to create an application where components are able to seamlessly transmit data between one another with maximum efficiency.
Let’s investigate how this was done. We also have a variety of exciting applications created by the Redis community for you to check out. Make sure to catch all of the action on the Redis Launchpad.
- What will you build?
- What will you need?
- Architecture
- Getting started
- How it works
1. What will you build?
You’ll build an online racing game that allows players to compete against each other using Redis. Below, we’ll go through each stage chronologically and highlight what components you need to bring this application to life.
Ready to get started? Ok, let’s dive straight in.
2. What will you need?
- NodeJS: used as an open-source, cross-platform that executes JavaScript code outside a web browser
- Express: used as a flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
- Unity: used as a real-time development platform for video games
- RedisJSON: implements ECMA-404 The JSON Data Interchange Standard as a native data type.
3. Architecture
After every 0.1 seconds, the position of each user’s car is sent to the Node JS server.
Node JS processes this data and sends it to the Redis database.
The server then sends the position of each user’s car and updates their position.
The time of each lap completed by a user will be sent to the Node JS server to be added to the live leaderboard in the Redis database.
4. Getting started
Prerequisites
- Node.js
- NPM
- Unity 2020.3.4f1
- Redis with RedisJSON module
Read the complete blog here
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.