Lua Discussion
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
Been looking at some Lua tutorials and it seems an interesting language to learn. It would seem that most of the other DM engines have a graphical interface with a makro/dsa 'thingy' attached to it too for those that wish to get their fingers burnt and really put some special functionality in their custom dungeon. Documentation would be the thing here, I suppose (Paul Stevens is CONSTANTLY referring people to his docs ).
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
I've tried to get away from that approach (time will tell if this is a good or bad thing) and instead of having a "default" way and then a way to modify that, simply have the engine call Lua directly and let you do whatever you like.
This means some rather "core" features, such as opening/closing doors, stepping on triggers, and handling the display of chests and scrolls are left up to Lua. This could make things interesting... or confusing.
I have, of course, provided scripts that do things the basic DM way, but the sky's the limit, really...
This means some rather "core" features, such as opening/closing doors, stepping on triggers, and handling the display of chests and scrolls are left up to Lua. This could make things interesting... or confusing.
I have, of course, provided scripts that do things the basic DM way, but the sky's the limit, really...
- Paul Stevens
- CSBwin Guru
- Posts: 4319
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Oh goody.
Seriously, though, it shouldn't be so bad, as long as people are good enough to provide rather minimalist code fragments if the engine is going wrong, so we can be sure it's the engine going wrong, and not simply someone being too clever for their own good.
Programmers seem to have that problem sometimes.
Seriously, though, it shouldn't be so bad, as long as people are good enough to provide rather minimalist code fragments if the engine is going wrong, so we can be sure it's the engine going wrong, and not simply someone being too clever for their own good.
Programmers seem to have that problem sometimes.
- Parallax
- DMwiki contributor
- Posts: 424
- Joined: Mon Aug 28, 2006 7:56 pm
- Location: Back in New Jersey
This is (at least) six kinds of awesome!
My guess is 'interesting'. After all, if one is interested only in the default behavior of a particular feature, one can just leave it alone, right? I've only just started on the Lua tutorials so maybe I have the wrong idea, but it looks like it is going to make it fairly easy for people to implement whatever changes they want in the code. I was also wondering, and maybe it's a moot point with Lua, but is this an open source type of project?Sophia wrote:This means some rather "core" features, such as opening/closing doors, stepping on triggers, and handling the display of chests and scrolls are left up to Lua. This could make things interesting... or confusing.
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Right.Parallax wrote:After all, if one is interested only in the default behavior of a particular feature, one can just leave it alone, right?
It's pretty much a moot point-- just about anything that you'd be interested in hacking around with will be part of the included Lua scripts, and distributed in source form.Parallax wrote:I was also wondering, and maybe it's a moot point with Lua, but is this an open source type of project?
- Parallax
- DMwiki contributor
- Posts: 424
- Joined: Mon Aug 28, 2006 7:56 pm
- Location: Back in New Jersey
Cool. Having transparent and customizable mechanics means a lot.Sophia wrote:It's pretty much a moot point-- just about anything that you'd be interested in hacking around with will be part of the included Lua scripts, and distributed in source form.
Hint hint?Beowuuf wrote:Also notice if someone wanted to try to port a complex dungeon, they could certainly try with this
- Trantor
- Duke of Banville
- Posts: 2466
- Joined: Wed Mar 09, 2005 4:16 am
- Location: Berlin, Germany
- Contact:
I just realized that I haven't commented on this yet, so I'll do it now. First of all, it's cool to see you working on something new that seems to be customizable in the highest possible way. What I am wondering is how "technical" this will get for someone who doesn't know zilt about programming (IE: me). Will building a dungeon more or less result in direct programming? I just looked briefly over the tutorials linked by ian_scho, and while Lua seems to be quite an easy language to learn, I still wonder how designing will actually work. I suppose you can do practically anything you want to if you program it yourself, but what about dungeons that only use a few more or less complicated features that are possible in CSBWin or RTC?
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
It's not exactly programming, but kind of like the early days of RTC hacking, there's no GUI editor (as such) and you'll probably have to poke around in the text files. The text file is technically a Lua program, but I do provide most of the basic DM functionality, so it's not terribly complex. For example, here's how to make a door+button:
What this means is: spawn a doorframe, spawn a portcullis (and store its id number in "targ"), spawn a doorbutton (and store its id number in "tmp"), and then set the target of the doorbutton (stored in tmp) to the door (stored in targ). The whole "exvar" thing simply refers to using an external variable, which is how DSB stores a lot of data not stored directly by the engine... hopefully this idiom will become familiar with use fairly quickly.
And hopefully it's not too awful.
Code: Select all
dsb_spawn("doorframe", 0, 9, 3, CENTER)
targ = dsb_spawn("door_portcullis", 0, 9, 3, CENTER)
tmp = dsb_spawn("doorbutton", 0, 9, 3, CENTER)
exvar[tmp] = { target=targ }
And hopefully it's not too awful.
-
- Ee Master
- Posts: 688
- Joined: Mon May 07, 2001 7:00 pm
- Location: Indiana, USA
- Contact:
That's cool to see a new clone, and fully editable by the way !
I'll look into lua coding language. I learned it is also used by supreme commander so it will be one stone two hits
If it's not too soon, and lua is not too messy, I'll be glad to help you. (I'm a C++ user...)
Does this also means that :
1/ There can be a plugin system (using some additional pieces of code to get new things or not --> simple way of having "mutators" for the game) ?
2/ Anyone can specify his own way of coding a dungeon (like, diverse way to write maps for dungeons, to specify some functionalities...) ?
3/ Anyone can mess up with "core" things, like graphical engine, or (less deep but still core) game mechanics like party [more than 4 char / inventory etc.] / movement / spells / fight / monsters AI ?
You'll need a whole forum and code sharing capabilities !
I suppose this also means it will be able to compile under linux, which would be a big progress at least for me, would-be Ubuntu user.
I'll look into lua coding language. I learned it is also used by supreme commander so it will be one stone two hits
If it's not too soon, and lua is not too messy, I'll be glad to help you. (I'm a C++ user...)
Does this also means that :
1/ There can be a plugin system (using some additional pieces of code to get new things or not --> simple way of having "mutators" for the game) ?
2/ Anyone can specify his own way of coding a dungeon (like, diverse way to write maps for dungeons, to specify some functionalities...) ?
3/ Anyone can mess up with "core" things, like graphical engine, or (less deep but still core) game mechanics like party [more than 4 char / inventory etc.] / movement / spells / fight / monsters AI ?
You'll need a whole forum and code sharing capabilities !
I suppose this also means it will be able to compile under linux, which would be a big progress at least for me, would-be Ubuntu user.
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
I don't see why not, though are you saying they would be added by the player, not the dungeon designer? I'm not sure if this wouldn't make cheating too easy, and kind of defeat some of the uniqueness of each dungeon.Joramund wrote:1/ There can be a plugin system (using some additional pieces of code to get new things or not --> simple way of having "mutators" for the game) ?
Right. Dungeon.lua is not properly a dungeon itself, but rather, a program that when run generates a dungeon. This means it can do all sorts of things.Joramund wrote:2/ Anyone can specify his own way of coding a dungeon (like, diverse way to write maps for dungeons, to specify some functionalities...) ?
Some aspects of the graphics engine can be messed with, others are hardcoded. I'll see about adding new functions if people find they want to be more creative, though. 4 party members is pretty solidly hardcoded, I don't see that changing ever. Movement, spells, fighting, and monster responses are all very flexible, though.Joramund wrote:3/ Anyone can mess up with "core" things, like graphical engine, or (less deep but still core) game mechanics like party [more than 4 char / inventory etc.] / movement / spells / fight / monsters AI ?
Hmm. The main libraries I'm using are cross-platform. The Windows API functions I'm using aren't, but they may not be that terribly hard to replace. I'll have to see how this one goes.Joramund wrote:I suppose this also means it will be able to compile under linux, which would be a big progress at least for me, would-be Ubuntu user.
This one is the one I've been dreading. It happened to me once, in all my testing-- I was hoping it was cosmic rays. I can't reproduce it. I looked the code over and I don't know what might cause it.Tom Hatfield wrote:Crash report!
I use something called, rather fittingly, LuaEdit. Notepad will do in a pinch, but things like syntax highlighting spoil us pretty fast, don't they? There were a couple of other editors mentioned earlier in the thread, but I've never tried them.DSE wrote:recommended lua editor to use ?
Yeah, I was thinking about the normal DM dungeon, and things like modify mechanics. This means releasing a "modular" code for the DM dungeon.Sophia wrote: I don't see why not, though are you saying they would be added by the player, not the dungeon designer? I'm not sure if this wouldn't make cheating too easy, and kind of defeat some of the uniqueness of each dungeon.
Of course you need something cheat-proof for custom dungeons like some sort of compiled version.
Great... Well for now, I suppose getting a working dungeon is already a time-consuming goalSome aspects of the graphics engine can be messed with, others are hardcoded. I'll see about adding new functions if people find they want to be more creative, though.
Didn't thought of those damn' libraries... Well, there're always emulators...Hmm. The main libraries I'm using are cross-platform. The Windows API functions I'm using aren't, but they may not be that terribly hard to replace. I'll have to see how this one goes.
What Is Your Quest ?