16
SFML projects / Re: Cendric: An RPG Platformer
« on: May 08, 2017, 10:13:50 am »I'm curious why did you decide to use sqlite over Lua, XML or plain text for defining your items and spells and all? Isn't that more work for little to no gain? Do you just like SQL or sqlite DB Browser?Good question. When I began implementing this game, I didn't know much about gamedev with C++ so I just sticked with what I knew. The custom config (ini) files were just a way for me to learn how to write a parser and as the config files stayed simple enough, I never changed to something more sophisticated. Using a simple text editor, they are also more readable than XML.
Regarding the database: I started using it because I needed a simple solution for the localisation. With a database, you never have to reload all strings when changing the language and you don't have to keep much in memory. It's really fast and convenient. Items and their properties are all nicely packed in one intelligent file that is kept open while playing. And just imagine the possibilities when balancing the item's stats! Want to know about all items that have a "health" attribute that is at least 5? Easy.
SELECT item.item_id FROM item INNER JOIN item_attribute ON item.item_id=item_attribute.item_id WHERE item_attribute.max_health >= 5;
I'd say it would require more code (and there's overhead) to do something like this when using Lua tables. Also, there is Lua 5.3.4 and you have compiled the Windows exe with 5.3.1.Oh, I've never updated the Lua version since I first got it. I guess it's time to do so, thank you
Also also - shameless plug - I happen to have a nice LuaConsole that happens to work with 5.3 too. It's very convenient.
That's great, I need one anyway for "cheating" (inserting gold and items into the player's inventory, checking and changing quest states etc.) These functions are already in the API but I got no ingame console - yet. So I'll check it out