Jump to content
  • Advertisement
Sign in to follow this  
Recopian

Lua for TCG Card Behavior

This topic is 3269 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

Hi all, I'm working on a TCG-like game and I've been wracking my brain on how to create a design that is flexible enough to handle the wide variety of card behaviors which can appear in these type of games. After a lot of thought, I've decided to use lua to attach behaviors to cards. I'm using C# with LuaInterface and I've played with a proof of concept which works decently well. I do have some concerns tho and I was hoping someone here would be able to answer a couple of questions or guide me in the right direction. - The game is multiplayer and I need to spawn battle rooms. I found that the easiest way is to create a new LuaInterface Lua object for each battle which I believe is another instance of the lua VM. However, I'm worried about how this will affect performance when the server is under load. Does anyone know if this might be a problem? It it is, I'd love to hear any suggestions. - I'd like the spell scripts to be attached to objects and to have access to the object they belong to without always relying on function parameters. Currently, scripts can register their functions as event handlers, but when the event is called, the script doesn't know what object it belongs to. I figured that one solution would be to create event handlers on the c# side. Those c# event handlers would fill an argument object with the appropriate info, then call the appropriate lua function. Could any lua experts suggest another method? Thank you! =) Edit - Since I wrote this post, I've been able to find a bunch of posts discussing my second issue above. I think thats been covered enough but I'd still like to hear people's thoughs on my first question above. [Edited by - Recopian on November 4, 2009 1:33:43 AM]

Share this post


Link to post
Share on other sites
Advertisement
for issue 1, it has been a couple months since i worked with LuaInterface but there is a rule about how many lua objects there can be. it might be something else but i know there is a limit somewhere.

Share this post


Link to post
Share on other sites
Thanks for the response. I just did a test where I created thousands of Lua objects and got to about 44000 before running out of memory. Those Lua objects were the only objects created in my program so it seems that the vms are consuming a good chunk of memory.

I'm thinking of handling it by creating a single vm and just passing contexts to each function in the lua files.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!