Advertisement Jump to content
Sign in to follow this  
Sixoul

Would LUA, xml, or some scripting language be for me?

This topic is 1826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm working on a game in C++ and I was debating whether I should use lua or xml to help me. I'll need a way to store all my data for the characters. It'll be a small pokemon like rpg. So everything has stats, moves it can learn when it levels up, experience to next level, etc etc.

 

I could set that up in an array, record, or something to hold all of this. But I was wondering if xml or lua would be possible to do this as well and make life easier for me. But as I looked more into it I thought this might give the user too much access if I set it up wrong.

 

What kind of instance would using lua or xml be proper time to use it? Could I use it to hold the config settings?

Share this post


Link to post
Share on other sites
Advertisement

You can surely use Lua for something like this. It's probably a bit overpowered for such a purpose but it's a pragmatic solution to the problem. If you want to go one step further, you might also be able to implement item-specific behaviour in Lua, which would be quite cool and make your game easily moddable.

 

XML would be another option, but my personal taste is to use as little XML as possible, because it's hard to read and write (again, personal taste) by hand.

 

I wouldn't care about giving the user to much access. Unless you have some legal reasons to protect your data, just don't. Just be happy about the fact that people will be able to mod your game, which can be a great amplifier for your community.

 

I usually implement my configuration files using Lua, because that gives me a lot of possibilities and flexibility at a very low price (in terms of implementation effort needed).

Share this post


Link to post
Share on other sites

I could set that up in an array, record, or something to hold all of this. But I was wondering if xml or lua would be possible to do this as well and make life easier for me. But as I looked more into it I thought this might give the user too much access if I set it up wrong.
 
What kind of instance would using lua or xml be proper time to use it? Could I use it to hold the config settings?


I find Lua to be highly useful for this kind of data description. XML is as well; however, it is unwieldy to type by hand, and is typically chosen as an intermediate output from a data-authoring tool rather than a first-choice for by-hand authoring. (Of course, such a tool can easily output Lua as well...)

Don't worry about giving the user too much access. Even a custom binary format is probably going to be cracked, if the game is interesting enough to motivate people to do so. You can crunch your data to binary (Lua provides a compiler to pre-compile scripts to a binary format) then run it through a simple encryption/decryption process at save/load time if it is really a concern; just be aware that if there is sufficient motivation to do so, your formats will still be cracked and your game modded by people who enjoy that sort of thing.

Share this post


Link to post
Share on other sites

If the bulk of the stats are the same across all types of creatures it's best to make a table based format which can be imported / exported from common spread sheet programs like google docs or access. This allows you to keep the data organized. If a creature needs a custom non-standard attribute or property u can probably extend your system to support custom scripts ( Lua ) in the place of of a standard property / stat.. 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!