dimanche 1 février 2015

Creating a database for items in an RPG


Purely Theoretical Post


I've played quite a few video games in my time, and the one thing I've always kind of wondered is how they store the items in the game such that their passive or active effects work as intended. Now, when I had first started learning MySQL I set off on a sort of "learn as you code" project of trying to make a card game. This was roughly 11 years ago, and technologies have definitely progressed, but the largest problem I had was how do I code the actual bonuses or abilities into the item?


It was messy, and it relied on my double-coding items (remember, I was new to the entirety of web development) in both Javascript and PHP. What I ended up doing was creating a sort of mini-api that could be parsed independently so that I didn't have to have a JS version of the item and a PHP version of the item stored. I also made a rudimentary checksum so that on the JS side someone couldn't just send random requests to the server via the console - it had to be accompanied by a valid checksum for the code given.


I was never a professional web developer, but it is definitely a hobby I enjoy, and this question has always confuddled me - how do you think games like World of Warcraft, League of Legends, or even the Magic: The Gathering card game store the information to make it work without bogging down the database? How do they get it to actually do what the items/cards are supposed to do? I just really want to know, mostly for the sake of knowing.





Aucun commentaire:

Enregistrer un commentaire