Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ SMAUG
➜ Lua
➜ Lua and Merc
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Tyn
USA (6 posts) Bio
|
Date
| Sun 06 Feb 2011 10:35 PM (UTC) |
Message
| I want to integrate a scripting language into a Merc MUD. Research has led me here.
I wrote my own "mobprog" functionality back in 1999. It's, uh, not very good, and the effort was daunting enough that I've avoided re-addressing it, until now.
Judging by forum activity, it looks like I'm 3 or more years behind the curve. That sounds about right.
I know this has nothing to do with Merc (who runs Merc anymore anyway?!), but this forum seems to be the closest match for what I'm looking for.
Any words of wisdom before I embark on integrating Lua? I've been reading various threads, and the potential is very exciting. At the same time, I would like to avoid as much pain as possible.
Advice welcome!
Thank you. | Top |
|
Posted by
| Nick Cash
USA (626 posts) Bio
|
Date
| Reply #1 on Sun 06 Feb 2011 11:27 PM (UTC) Amended on Sun 06 Feb 2011 11:35 PM (UTC) by Nick Cash
|
Message
| Welcome to the Lua party! :P
Lua is remarkably easy to embed and quite hassle free. Avoiding pain should be pretty easy.
My suggestion would be to play with embedding Lua in some simple C/C++ progs before you attempt to integrate it into your game. Doing some simple examples (running scripts, calling C from Lua and Lua from C, etc) will help you make a few important design decisions. After you play with some examples I would suggest deciding on the scope of your implementation. It is much easier to implement it only for mobprogs compared to something like internal game logic. This is mostly due to the effort involved in exposing game data to the scripts. However, if you can somewhat gracefully expose a lot of your game data to scripts then you can build a much more dynamic game.
Nick Gammon wrote a very good post on simple examples of Lua embedding in C/C++. I'm sure you found it already, but here is the link in case you missed it:
And, of course, the heavy-weight thread detailing the addition to SMAUG will be useful:
|
~Nick Cash
http://www.nick-cash.com | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #2 on Mon 07 Feb 2011 03:59 AM (UTC) |
Message
| Also:
Aardwolf uses a Lua interface these days for their scripting. It is completely different to what I describe here, but shows that they also agree that it is a good idea in principle to do. You could look at their "builders guide" on their web site to see how they went about it, at least from the interface point of view. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Tyn
USA (6 posts) Bio
|
Date
| Reply #3 on Tue 08 Feb 2011 07:42 PM (UTC) |
Message
| Thank you both for the replies and links. I appreciate it. So much useful detail.
Nick, you mentioned Aardwolf's Lua implementation and how it's completely different from what you have done. If you had it to do over again, would you design your Lua interface pretty much how you've done it, or more how Aardwolf designed it?
Thanks again for the reference implementation. I've never been exposed to Lua before, aside from skimming through the online book, so it helps to see how the code would be written in practice. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #4 on Tue 08 Feb 2011 08:42 PM (UTC) |
Message
| I haven't seen the implementation of Aardwolf (the source is not released) but from what I have seen of the documentation it is much more sophisticated than what I did.
My examples were more of a proof of concept, whereas Aardwolf is running live on an active MUD. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
20,571 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top