Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > Advanced MUD Concepts
Click here to Register

Reply
 
Thread Tools
Old 09-11-2002, 07:50 AM   #1
Artovil
Member
 
Join Date: Jun 2002
Location: Sweden
Posts: 32
Artovil is on a distinguished road
Send a message via AIM to Artovil
Unhappy

Hello,

I am relatively new to the world of embedding, and I just wondered if there are any success stories out there? What have you used Perl or Python for in your MUD, and how did you do it? I am mainly interested in purely technical solutions, I have rough ideas of how to use it, but I am not entirely on track when it comes to the interaction between my embedded interpreter and the MUD itself.

I am using a CircleMUD, for reference, but I don't think that's bears any significance to the topic.

What I want to do is this:

Create a dynamic spell system that utilizes embedded scripting to handle affects, damage, loading/destroying of objects, and setting values on players and victims, and even rooms.

The way I figured it was that I write a common sub in Perl for spells, which I use throughout all spell code. This accepts a set of vars, or pointers to vars in the memory on the character, I don't really know how that would work, though. Would it be possible to somehow pass the Perl script the entire char_data struct? No, I didn't think so. How do I do it then?

Things that I need to create/set/alter:
Hitpoints
Manapoints
Movepoints
Affects (they are multi-dim arrays (structs) in Circle)
Create mobiles and objects
Affect entire rooms
Affect the world

Just like any other spell system, of course.

Any help appreciated.

I have also considered using DG Scripts for the actual effects of spells, nothing more, just to calculate damage or affects, for instance, and then handle the rest with static stuff stored on the spell, like cast messages and mana drain, and such. Has anybody tried any such implementation of DG Scripts? Was it very resource consuming, or would it work for an RPI? Since we're going to be a roleplay enforced mud based on skills and crafting, I am sure that our player base will never ever raise above 100 players, which would demand a smaller miracle. I know that most RPI's have about 10-50 players on at peaks, there may be exceptions out there, but I am not sure that I will ever be competing with them.

I already have the embedded interpreter working, so I do not help with that, what I need is to understand how to pass data between the two, preferably by memory pointers, and preferably more than just a string or an int, which isn't too hard.

Should I perhaps create a predefined structured array in the Perl script, return that and just parse that with the Perl functions from the C code, what I mean is, I use the Perl specific functions to handle Perl datatypes on it and just do all the calculation and affect application from within the MUD instead of straight in the Perl code?

Gah. My head melts. Help.

Kind regards,
/Torgny
Artovil is offline   Reply With Quote
Old 09-12-2002, 03:44 AM   #2
Winddancer
New Member
 
Join Date: Apr 2002
Posts: 9
Winddancer is on a distinguished road
I code on Dawn of the Ages which is done in Java. We have quite a number of Scheme scripts as well. Recently, our head coder created a totally new profession along with all spells and skills in Scheme.
Major advantage of this is of course that you can alter and improve any part of that new profession online without the need for a reboot, which is normally required when new Java Classes are to be introduced into the MUD code.
Java has the advantage of having special class-applications like Skij, Scheme in Java, or kawa. These allow an easy way to create handles in Scheme with which you then can manipulate the Objects created by the normal Java code.
Since your codebase is C or C++, I would first look out there for a similiar wrapper class that will allow you the easy road to use Perl or Python in your mud. Since I never attempted to create or code in a C based mud, this is where my advice has to end.
I hope the information did help you none the less.
Winddancer is offline   Reply With Quote
Old 09-12-2002, 04:26 AM   #3
Artovil
Member
 
Join Date: Jun 2002
Location: Sweden
Posts: 32
Artovil is on a distinguished road
Send a message via AIM to Artovil
Quote:
Originally Posted by
Since your codebase is C or C++, I would first look out there for a similiar wrapper class that will allow you the easy road to use Perl or Python in your mud. Since I never attempted to create or code in a C based mud, this is where my advice has to end.
In this case, what would you define as a wrapper class?

I have already implemented the actual hooks to Perl, and I've got it working so far as initiating the interpreter and all of that. Now I need some help/ideas with how to actually pass data between the two, and if somebody out there has any code written in C for this purpose, let me know, I don't mind if the code is not written for Circle as long as it tangents on what I need for my MUD.
Artovil is offline   Reply With Quote
Old 09-12-2002, 05:51 PM   #4
Ogma
Member
 
Ogma's Avatar
 
Join Date: Apr 2002
Home MUD: DartMUD
Posts: 86
Ogma is on a distinguished road
Personally, if you want to get that complex, I'd go with an LPMUD.
Ogma is offline   Reply With Quote
Old 09-12-2002, 06:03 PM   #5
Artovil
Member
 
Join Date: Jun 2002
Location: Sweden
Posts: 32
Artovil is on a distinguished road
Send a message via AIM to Artovil
Well, when I first started out coding I considered LPMud, but I chose CircleMUD for several reasons, mainly because I did not want to reinvent the wheel by coding the WHOLE server from scratch, and because I wanted a codebase that was active and growing, and something I could actually learn to code from just by extending it.

Chances that I will be converting to an LPMud now, almost four years later are slimmer than none. Which leaves me little choice in the matter, I either use embedding, or I reuse DG Scripts, or I do it the old fashioned way by hard coding each and every last one of the spells (which is my very last way out).
Artovil is offline   Reply With Quote
Old 09-12-2002, 09:59 PM   #6
Loriel
Member
 
Join Date: May 2002
Posts: 49
Loriel is on a distinguished road
Quote:
Originally Posted by
Well, when I first started out coding I considered LPMud, but I chose CircleMUD for several reasons, mainly because I did not want to reinvent the wheel by coding the WHOLE server from scratch, and because I wanted a codebase that was active and growing, and something I could actually learn to code from just by extending it.
Whilst accepting your subsequent statement that you've invested too much time in your mud to change to LPC, the original reasons for choosing Circle are questionable, and you are now seeing some of the disadvantages of that decision.

There are several mudlibs available that provide something close to a "ready to run" mud, so you wouldn't have had to "code from scratch" (unless you preferred to).

I don't see why you dismiss LPC on the grounds that it's not "active and growing".

There is some validity in your final point that by using  CircleMUD you are "learning to code" - but doing something similar in LPC would also teach you to code - the difference being that LPC is of no direct relevance outside the MUD community, but the Object Oriented design techniques it uses may be more useful than the design techniques of CircleMUD.

Please note that I am not making the "LPC is better than C for muds" claim - I am merely saying that LPC has some advantages which should not be ignored or dismissed as you appear to have done.
Loriel is offline   Reply With Quote
Old 09-13-2002, 02:01 AM   #7
Artovil
Member
 
Join Date: Jun 2002
Location: Sweden
Posts: 32
Artovil is on a distinguished road
Send a message via AIM to Artovil
Well, considering that I have redone almost every game aspect of my CircleMUD, except the very basic aspects such as the comm.c stuff and some things in db.c and interpreter.c, it would take me ages to recode EVERYTHING in LPC just because it might be better served for the purpose.  Besides, discussing whether or not to run LPMud or CircleMUD is irrelevant to my original question, and I suggest we bring this discussion to alt.flame or something.

I am aware of the fact that LPMud is a really good server, and that there are mudlibs out there that give you "almost" everything, but I am not interested in that.  I'd probably end up recoding the entire mudlib anyway, and spend another four years for nothing, when I might as well just run this with Circle.  The advantages with LPMud are vast, I am aware of that, but the performance losses I might experience with a CircleMUD (if any) are also irrelevant since our MUD is a role-playing intensive system which is skill based and has crafting and various player economy related systems implemented, and we will probably peak around 10-30 players, which will hardly put a strain on the server in any case.  Maybe when I find out that I have a player base of 150 players I will consider LPMud.

So you see, discussing whether or not this server is superior to that server doesn't get me anywhere as far as my problem, quite the contrary.
Artovil is offline   Reply With Quote
Reply


Thread Tools


Embedding scripting languages - Similar Threads
Thread Thread Starter Forum Replies Last Post
Which scripting language? Gakusei MUD Coding 9 03-14-2004 08:39 AM
Scripting gutterzombie MUD Builders and Areas 6 01-28-2004 01:30 PM
Internal Scripting Languages xanes Advanced MUD Concepts 10 05-19-2003 05:12 PM
"Other" Languages for Mud Creation kaylus1 MUD Coding 14 03-24-2003 11:50 AM
shell scripting Emit MUD Coding 3 05-26-2002 02:48 PM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 09:18 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2014