I wanted to level up my skills with React, so I started building out a game engine for a click-through RPG. I’m designing the front end to be flexible enough that I can reuse it with different maps, enemies, and loot items easily. I’ve been working it for a bit, so I’ll use this post to introduce the game, show you the state of things, and where I’m going with it next.
React will be responsible for keeping track of state, and will pull game data from three different sources: enemy data, item data, and map data. In the first iteration, all of the data came from static JSON files, were loaded in as objects, and then manipulated. I want to try something new though, so I’m currently finding ways to move as much of this data as I can to a blockchain. Enemy data was the first JSON data to be fully converted. I minted some NFTs from a testing collection on the WAX blockchain. Instead of querying the JSON file, I ran an API call to pull information about these NFTs
In the first iteration of the game, enemies were hard coded into the map, but that’s boring to play through multiple times, so I created a more dynamic way of setting enemies to the map randomly when the data gets pulled into the game engine. Essentially, it will query the blockchain for the number of enemy NFTs minted, and place each one on the map. If I want to make it more difficult, I can mint more NFTs. If it’s too difficult, I can burn some. If I want to add a new enemy type, I simply mint it as an NFT and it will be instantly included in the game map.
Notice that much of the original JSON data looks a lot like the NFT data details. The information is read and interpreted by the game engine just as if it were locally saved information.
There’s still a lot of work to be done before I can release this as an Alpha version demo. Next steps will be to start moving item info to the blockchain and working on the CSS for the inventory and equipment screens. And I need to make more enemies than just a bunch of rats of course
Leave a Reply