Hello readers 👋
Today I'm introducing HoltsOfSurvival, a RTS game where you play as a chief, build and maintain your Village to grow.
I was working on this project for last 10-15 days for the Planetscale Hackathon, But seems like my project idea was pretty big to complete under 15 days as I had to work alone and do everything from creating assets for the game, to program the game mechanics, still I tried my best to make it to a point that can show the potential of the project. Hope you like it.
Tech Stack ⚙️
- Godot :
Godot provides a huge set of common tools, so you can just focus on making your game without reinventing the wheel. Godot is completely free and open-source under the very permissive MIT license.
I chose Godot as the game engine for this project, as I heard it is very begginer friendly and very powerful for 2D games. And indeed it is, I had to learn Godot on the go while working on the project and I find it pretty friendly and also it uses a pretty easy to understand in-house language called GDScript which is very similar to python. Obviously having some basic concepts of making games earlier helped me alot.
- Blender :
Blender is a free and open-source 3D computer graphics software toolset used for creating animated films, visual effects, art, 3D-printed models, motion graphics, interactive 3D applications, virtual reality, and, formerly, video games.
I used Blender mainly to create the assets for the game.
Node & Express : To build the backend server
Planetscale : as Database for storing the players authentication data and game data.
Prisma : as it makes working with databases pretty easy.
WS : to keep the connection to the client state full and fast.
Heroku : for the server deployment
Netlify : for serving the static game build
Others : JWT, bcrypt, uuid, cors etc.
The game server is a nodejs express server that handles player authentication, authorization and upgrades to websocket connection when player requests for it.
Authentication is done by basic username/password method ; when a new user signed up the server creates a user record with the unique username and hashed password. Also a player record is added to the player table with initial game values.
Authorization is done by JWT; when a player is successfully logged in they were provided a JWT access token. this access token is later comes handy while upgrading to websocket connection and making query to the database.
Websocket connection is requested by player just after they get the access token from server.
- when the socket connection is established the server sends a message to the client requesting the access token to authorize the player.
- When the player is authorized the server query player data from database and sends to the player to initialize the game instance.
- websocket connection then starts listening for update requests from player and update new data to the database
These are the main pieces that makes the game
- Grid based Snapping system
- Building system
- upgradeable over time
- generate resource over time
- Collecting resource and storing
- User Interface
- Updating game state to server : right now whenever the game updates states to the server, server writes new player states directly to the main database(PlanetScale ) but in future I'm thinking of adding redis for write-through caching.
I'll Be writing a series called learn-godot-together covering the building process of this game.
Role of PlanetScale
While making the server for the game, PlanetScale as a database really helped me or I should say amazed me, to be specific the PlanetScale branching feature that allows two types of database branches: development and production.
The development branch provides an isolated copy of my main production database schema, where I was able to make changes without breaking anything to the production and when I felt satisfied with my schema changes, I can easily open a deploy request from the UI itself. Also PlanetScale analyzes the schema changes for conflicts to ensures changes can be deployed safely without impacting production.
Coming up with a good idea:
Even though I was pretty sure about making a game for this hackathon coming up with a good game idea took me more than a week.
Making the assets:
creating assets for the games is pretty time consuming as well as hard if you don't have experience in drawing or 3D modelling.
And that is why I chose a pretty basic art style for the game and modeled the assets in 3D and renderd out using blender.
this time the limited time constraint was the main challenge, as I had to complete this huge idea in a very short time period.
Future Plans 🔮
Some features that I'm unable to complete during the hackathon but I'll be pushing, soon I finish working on them
- add leaderboard
- visiting other player's Village
- add redis for caching and realtime read/writes.
Important links 🔗
Keep in mind that the file size for the game is little high (~14MB) so it might take long time to load if your connection is slow