The front end of Fury Racing has been built to make the interaction with the smart contracts as smooth as possible. Only one transaction is required to play a game, even as a new player. All racing modes are accessible directly from the front end.
This comes as a PWA (Progressive Web App) with a responsive design, allowing it to be played on any device, from desktop to mobile to be accessible to as many users as possible. And because it is a PWA, you can even install it on your device in one click!
Dark mode, sound, and Fullscreen are also available to enhance the user experience and make it feel like a real game.
And the best part... To make it even cooler, we have integrated some beautiful 3D animations with BabylonJS to make the game more immersive and fun!
The following features of the BabylonJS engine were used:
- Loading all assets (meshes, textures) in batch, with a loading screen during processing, with
AssetsManager
. - Loading
glTF
meshes specifically with the built-in BabylonJS loader. - Using a
FollowCamera
to automatically follow the vehicle as it moves. - Using
Animation
andAnimationGroup
classes to animate the vehicle's movement. - Generating shadows for the vehicle with
ShadowGenerator
and aDirectionalLight
. - Generating a skybox with the
Scene.createDefaultSkybox()
helper function. - Generating rain particles with a
ParticleSystem
. - Generating fog via the
Scene.fogMode
property.
All 3D assets were found on SketchFab (credits listed further down this document).
However, not all assets were perfectly centered on the origin (0, 0, 0)
.
Furthermore, many of the assets varied greatly in size.
As such, an array of metadata constants was created to specify the offset and scale of each asset. The meshes are therefore correspondingly offset and re-scaled during initialization.
In order to quickly implement a simple, flexible race track builder system, we opted to allow the coding of tracks using plain ASCII. This allows us to embed the layout of race tracks directly in the code, and makes it easy to visualize the end result in advance, without any third-party tools. Furthermore, this greatly facilitates the creation/addition of new tracks, if desired.
By going with a grid/tile-based approach, it also simplifies the automation of the vehicle animation. The engine simply gets the vehicle to move from the current tile to the next tile in the appropriate direction through a looping process.
We ended up choosing Monaco as the sole race track of the first release. You can see its ASCII equivalent below:
0000000000V000000˻V00V
000V00000000VV┌───┐0V0
0V0000V0000V00│┴┴┴│┌┐V
0000V00000000V│VV0└┘│0
0V0V╦╦0╦0╦╦0˻V│0V000│0
00┌───────────┘0000V│˹
V┌┘00VV00V00˹V0000VV│V
˼│V┌───┐0┌──────────┘V
0│╣│V┴V└─┘0˺0┴V┴┴╩┴0V0
├│╣│V00V╩V0000V0V00000
├│V└┐000000V000000V0V0
V│V╠│┤0000000V00VV0000
├│V╠│˹00V000000V000000
├│˻┌┘0V0000V0000000000
├│0│V00V0V000000000000
V│0│┤V0V00000V0000000V
V└┐└─┐00000000000000V0
0V└──┘ 0V00000V0000000
00VVVV00000000000V0000
With the corresponding character legend:
0
: Blank (grass) tile.V
: Tree (vegetation) tile.─
,│
,┌
,┐
,└
and┘
: Road tiles.├
,┤
,┴
and┬
: House tiles, each representing a particular orientation.╠
,╣
,╩
and╦
: Building tiles, each representing a particular orientation.˼
,˻
,˹
and˺
: Billboards, each representing a particular orientation.
- node.js installed (developed on LTS v18)
- typescript installed (developed on v5.3.3)
- bun or pnpm or yarn or npm installed
- MetaMask (or any web3 compatible wallet) installed in your browser
Once your config is ready, create a new repo, open your favorite code editor, and clone the repo with the following cmd:
git clone https://github.com/Pedrojok01/fury-racing.git .
Depending on your favorite package manager, run one of the following commands in your terminal to install all the dependencies needed for the project:
bun install
# or
pnpm install
# or
yarn install
# or
npm install
Remove the .example
from the .env.example
file name at the root of the project and add your API keys inside. The WalletConnect project ID is now required since the v2 update. You can create one easily on the WalletConnect dashboard.
And for the weather API key, you can get one for free on [www.weatherapi.com](sign up at https://www.weatherapi.com/.).
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID = "Project ID needed for WalletConnect v2 here";
WEATHER_API_KEY = "Your OpenWeatherMap API key here";
First, run the development server:
bun dev
# or
pnpm dev
# or
yarn dev
# or
npm run dev
Open http://localhost:3000 with your browser to see the result.
This work is based on:
- "Low poly Ad Billboard" by Anthony Yanez licensed under CC-BY-4.0
- "Modern building 03" by burunduk licensed under CC-BY-4.0
- "Modern building 02" by burunduk licensed under CC-BY-4.0
- "Modern building 05" by burunduk licensed under CC-BY-4.0
- "Classic Muscle car" by Lexyc16 licensed under CC-BY-4.0
- "Toyota Corolla AE86 Trueno" by Lexyc16 licensed under CC-BY-4.0
- "Low Poly Car" by Straight Design licensed under CC-BY-SA-4.0
- "Low poly house" by its_sagar_bro licensed under CC-BY-4.0
- "Low poly house" by its_sagar_bro licensed under CC-BY-4.0
- "low poly building" by GreyHorn102 licensed under CC-BY-4.0
- "Low Poly Tree 2" by Render Zing licensed under CC-BY-4.0
- "Leafy Tree - Low poly" by lightguard licensed under CC-BY-4.0
- "Low-poly Tree" by ALostEggroll licensed under CC-BY-4.0
- "Abstract green grass seamless texture" by Maksim Borzdov
- Overcast Soil (Pure Sky) by Sergej Majboroda, Jarod Guest licensed under CC0
- Farm Field (Pure Sky) by Dimitrios Savva, Jarod Guest licensed under CC0
- Drakensberg Solitary Mountain (Pure Sky) by Dimitrios Savva, Jarod Guest licensed under CC0
- The colour of the sky from Gaia’s Early Data Release 3 from the European Space Agency licensed under CC BY-SA 3.0 IGO
The music in the game is free for use under the Pixabay Content License.
- Gym Phonk by dopestuff: https://pixabay.com/music/beats-gym-phonk-187854/
- Night Phonk by Artiss22: https://pixabay.com/music/upbeat-night-phonk-203960/
- The Final Race by Audiorezout: https://pixabay.com/music/adventure-the-final-race-epic-sport-action-trailer-cinematic-music-198690/