🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

[lua] Script Based RPG

Started by
1 comment, last by keen 20 years, 11 months ago
Hi there, Im designing an online rpg , and I''ve come such far as you can kill enemies. The server is written in C but once I got this far the development kinda halted. Now I have started again and I was thinking about using a scripting language that the map creators easily could use to do their own quests and tweak the gameplay as they want and for easier maintainablitiy. I''ve looked into lua and it''s promising, now I''m starting with the design and I have a few questions and I would like your opinion on my thoughts. How should I store all player information? Now it''s all stored in structs in c, should I remove everything and store it in lua variables and not access player attributes from c at all? I''ve chosen to store the map in C due to my pathfinding algorithm I''ve implemented, how would I access the map information in lua? Here I have several options 1. Never access map information, instead implement functions for MovePlayer(x,y) AttackPlayer(ID) in c accessible for lua 2. Store the map information in lua and C, this would be very slow I think :/ 3. Access the map information directly from lua, I dont know if this is possible but it would be great if it''s possible. I have a lot more thoughts but these are the main ones. Once I get into the right thinking on how to intreact between lua and c it''s a lot easier to get started implementing lua in to my game. Any help would be great! Thanks in advance [Edited by - keen on October 6, 2006 7:03:11 AM]
Advertisement
I use Lua in my game (a single-player isometric hack-and-slash), and it''s been a learning experience for me, so I can feel your confusion.

I''ve elected to go mainly with option #1 in your list-- ie, most things implemented in C, with an interface exposed to Lua.

All of my map generation functionality is scripted, but the map itself is done in the engine rather than in script. There are certain functions such as SetGround() SetWall() InstanceStaticProp() etc... which can be called from Lua, but which are merely wrappers for their corresponding C++ functions in the engine. The main loop, message passing, input processing, and object updating are all done in the engine in the interest of performance, and once the map is generated, the only things that are currently done in script are actions such as OnUse, OnGet, OnThink, etc...

Monsters are spawned using script, which specifies stats, parameters, animation, etc... Each monster has various "script hooks" which are called upon receipt of the proper message from the engine.

However, all attributes for objects outside of action script hooks are implemented and stored in C++ classes, due to the performance overhead of Lua.

I hope this helps. Forgive me if I sound like I ain''t got a clue; I''m still learning about this.



Josh
vertexnormal AT email DOT com

Check out Golem at:
My cheapass website
VertexNormal - your game looks amazing

This topic is closed to new replies.

Advertisement