#nuvie@irc.freenode.net logs for 27 Aug 2006 (GMT)

Archive Today Yesterday Tomorrow
Nuvie homepage

[00:38:43] <-- exultbot has left IRC (shutting down)
[00:40:04] --> exultbot has joined #nuvie
[00:40:06] --- Topic for #nuvie is: Nuvie - New Ultima VI Engine (http://nuvie.sf.net)
[00:40:06] --- Topic for #nuvie set by ChanServ at Sun Jun 25 04:12:02 2006
[01:21:05] --> Yuv422 has joined #nuvie
[02:11:24] <SB-X> hey yuv
[02:28:28] <-- Yuv422 has left IRC (Read error: 110 (Connection timed out))
[02:29:35] --> Yuv422 has joined #nuvie
[02:29:48] <SB-X> hey yuv
[02:29:57] <Yuv422> hey SB-X
[02:30:12] <Yuv422> how's it going?
[02:37:01] <SB-X> going well
[02:37:05] <SB-X> im about to go work on nuvie
[02:37:34] <SB-X> but right now im playing a few games
[02:39:04] <Yuv422> cool
[02:39:11] <Yuv422> I'm researching lua
[02:39:52] <SB-X> right, i have to finish reading the programmer's guide
[02:39:57] <SB-X> i've barely touched it so far
[02:40:14] <SB-X> did you see my comments about using lua for the endgame and other scenes?
[02:40:33] * Yuv422 looks
[02:42:03] <Yuv422> so have a sprite obj
[02:42:20] <Yuv422> say avatar.x = 30
[02:42:43] <Yuv422> or avatar::move_to(x)
[02:43:23] <Yuv422> origin_logo::fade(duration)
[02:47:39] <SB-X> fade and move_to are probably global scope
[02:47:57] <SB-X> move_to or translate
[02:49:18] <SB-X> what i had for "objects" already were really just subroutines
[02:49:43] <SB-X> newshape digital_clock would call the digital_clock subroutine
[02:50:07] <SB-X> but also add it as a managed shape
[02:51:02] <Yuv422> so the shape would always be tied to a function
[02:51:07] <Yuv422> to update the display
[02:52:32] <SB-X> the function called with adding the shape constructed it; any update functions would probably be called like member functions digital_clock::update
[02:52:50] <Yuv422> right
[02:53:55] <SB-X> message_box::set_text(str)
[02:55:52] <SB-X> we could use lua for the gui eventually
[02:56:13] <SB-X> not the core display routines but for defining dialogs
[02:57:05] <Yuv422> yeah
[02:57:19] <Yuv422> I'm reading about using lua for config files
[02:57:22] <Yuv422> ATM
[02:57:31] <Yuv422> it's an example they use in PiL
[06:05:28] <-- Zerothis has left IRC (Read error: 110 (Connection timed out))
[06:10:12] <Yuv422> x = 0x134
[06:10:12] <Yuv422> y = 0x208
[06:10:12] <Yuv422> z = 0
[06:10:13] <Yuv422> lat = ""
[06:10:13] <Yuv422> lon = ""
[06:10:14] <Yuv422> x = math.floor(x / 8)
[06:10:15] <Yuv422> y = math.floor(y / 8)
[06:10:17] <Yuv422> if x > 38
[06:10:19] <Yuv422> then
[06:10:21] <Yuv422> x, lon = x - 38, "E"
[06:10:23] <Yuv422> else
[06:10:25] <Yuv422> x, lon = 38 - x, "W"
[06:10:27] <Yuv422> end
[06:10:29] <Yuv422> if y > 45
[06:10:32] <Yuv422> then
[06:10:33] <Yuv422> y, lat = y - 45, "S"
[06:10:35] <Yuv422> else
[06:10:37] <Yuv422> y, lat = 45 - y, "N"
[06:10:39] <Yuv422> end
[06:10:41] <Yuv422> nuvie_display(y.."{"..lat..", "..x.."{"..lon);
[06:12:31] <SB-X> cool
[06:12:39] <SB-X> that's longer than the current code though
[06:13:33] <SB-X> do we have to put nuvie_ on engine functions?
[06:24:20] <Yuv422> I guess
[06:24:21] <Yuv422> not
[06:24:36] <Yuv422> bbl
[06:26:40] <SB-X> that's among the calling conventions i'm not sure about how to handle
[06:42:22] <Yuv422> you could have display
[06:42:51] <Yuv422> all the standard libs for lua are in chunks
[06:44:02] <Yuv422> I've changed luteijn's spells.nsl file to inline the lua code
[06:44:13] <Yuv422> but we could call the code from external files
[06:44:18] <Yuv422> or maybe a lib_n
[06:44:27] <Yuv422> in bytecode form
[06:59:30] <SB-X> what's around the magic function? what are the parameters to the function? how do we pass arguments to magic? are there required arguments? do we have one file for each function, or multiple functions in a large magic script? do magic functions use the same conventions as usecode and cutscene functions?
[07:00:45] <Yuv422> magic has no functions in lua script
[07:00:50] <Yuv422> at the moment
[07:01:06] <Yuv422> magic runs a spell script
[07:01:18] <Yuv422> inplace of the existing stack based script
[07:01:58] <Yuv422> I'm still learning about lua environments etc so I'm not too sure how best to approach things
[07:02:20] <Yuv422> should we try to have an all encompassing script system
[07:02:35] <Yuv422> or should we have separate script engines for the different components
[07:02:57] <Yuv422> gui, config, ingame, cut scenes etc
[07:03:13] <SB-X> the guide says it is targeting various people including those who are implementing lua scripting in a larger program :)
[07:03:20] <Yuv422> magic and usecode should be in the same script space
[07:03:34] <SB-X> the same scripting for magic and usecode appeals to me for some reason
[07:03:40] <SB-X> not sure if it's feasable
[07:03:57] <Yuv422> magic scripts could use objects
[07:04:20] <SB-X> but we could set up a scripted usecode engine that treats magic as usecode functions
[07:04:31] <Yuv422> yes
[07:04:51] <Yuv422> a spell could open all doors in a given area
[07:05:03] <Yuv422> calling each door's usecode
[07:05:05] <SB-X> then we could still use spells.nsl, having it point to the appropriate usecode for each spell
[07:05:30] <Yuv422> by lua function name?
[07:05:31] <SB-X> that's an interesting spell ;)
[07:05:48] <SB-X> well if we did one function per file, it would be by script name
[07:06:00] <Yuv422> or a spell that pushes your enemy is all directions
[07:07:24] <Yuv422> could we use principles from u7 usecode?
[07:07:30] <Yuv422> I'm not too sure how that works
[07:07:35] <SB-X> i dont think so... all of u7's magic is hardcoded
[07:07:41] <Yuv422> righto
[07:08:06] <SB-X> if we generalize everything as usecode scripts then we need the ability to call usecode without an object
[07:08:06] <Yuv422> magic could just be use:spell
[07:08:18] <SB-X> hmm
[07:08:39] <SB-X> you still need to call it without an object unless you want to create some dummy object just for that cast
[07:08:48] <Yuv422> yeah
[07:09:22] <SB-X> how does a spells.nsl spell block go again?
[07:09:24] <Yuv422> maybe you could call it by circle and index
[07:09:34] <SB-X> im only remembering "script:" right now :)
[07:09:52] <Yuv422> # num
[07:10:01] <Yuv422> name: spell name
[07:10:11] <Yuv422> invocation: codes
[07:10:18] <Yuv422> reagents: number
[07:10:24] <Yuv422> script:
[07:10:29] <Yuv422> ~
[07:10:40] <SB-X> ok, so anyway you could add something like script_file: u6magic/wind_change.lua
[07:10:57] <Yuv422> yes
[07:11:11] <Yuv422> or u6magic/spellnumber.lua
[07:11:20] <Yuv422> but that's not a easy to read
[07:12:05] <SB-X> but at that point instead of Magic running the script, it would go to the new usecode engine
[07:12:18] <SB-X> if we want to generalize them together like that
[07:12:27] <SB-X> combine the two domains
[07:12:34] <Yuv422> yes
[07:13:03] <SB-X> or engines, whatever
[07:13:30] <SB-X> i havnt gotten far in the lua guide yet but this implies that the magic code is top-level in the file, right?
[07:13:36] <SB-X> not inside any function scope
[07:13:58] <Yuv422> by default all functions are global
[07:14:26] <SB-X> the main code wouldnt be in any function at all though
[07:14:47] <Yuv422> we can make a table in lua indexed by spell number
[07:15:14] <Yuv422> with functions as data
[07:15:30] <SB-X> yes that would give us a way to call a spell using the function directly
[07:15:44] <servus> Since functions are first-class objects in Lua, you can make them indices in an array.
[07:15:48] <SB-X> but that means we wont be calling u6magic/spell.lua directly
[07:15:58] <servus> myfunctions[123]( "my parameters" );
[07:16:32] <Yuv422> hi servus
[07:16:38] <servus> Hello Yuv422 :)
[07:17:40] <SB-X> we probably wont need to pass any arguments to spells, because they usually get their own target
[07:18:03] <SB-X> if we want to set the target ahead of time it could be in a global
[07:18:53] <servus> Are U6 usecode programs referenced by game-global IDs? Could you do function g_usecode[123] () ... end ?
[07:19:21] <Yuv422> we could reference them by obj_n
[07:19:32] <servus> So that you don't have to make a specific Lua interface for each Usecode invocation?
[07:19:35] <SB-X> not currently
[07:19:56] <servus> That way you could have the generic call_usecode (or whatever) function automatically call the correct Lua function.
[07:21:08] <SB-X> we do use object types (obj_n) mapped to function pointers
[07:21:39] <SB-X> but not in a global array
[07:27:39] <Yuv422> we could translate the obj table into a lua table which is usable via lua scripts
[07:27:58] <Yuv422> so a lua script could call usecode given an obj_n
[07:28:30] <Yuv422> or just provide a C function that takes the obj_n as an arg
[07:28:51] <SB-X> which we already have :)
[07:28:55] <Yuv422> which then calls the relevant lua usecode script
[07:28:57] <Yuv422> yeah
[07:30:48] <servus> I'm pretty sure that's what I just said, right? : o)
[07:31:10] <Yuv422> pretty much
[07:31:28] <Yuv422> just thinking straight into the channel. ;-)
[07:31:32] <Yuv422> bbl
[08:30:57] <luteijn> (if we put lua scripts in-line into the spells.nsl file, the blocks will become rather large, but it is 'ready' for it. the script: thingy runs until the terminating ~ token. I'd prefer to add a printable 'newline' token like ; \ or </ to the scripts and replace than by a newline when reading in the file.. that example locate spell is just too vertically drawn out for my taste :).
[08:34:37] <luteijn> you'd stil be able to use a real newline, but things like the assignments could be concatenated with the printable newline character.
[10:42:20] --> GhostBear has joined #nuvie
[10:43:11] <GhostBear> Hello all
[10:44:25] <GhostBear> Is anybody alive? o_O
[11:05:39] <-- SB-X has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] <-- GhostBear has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] <-- jargon has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] <-- wjp has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] <-- ChanServ has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] <-- Yuv422 has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] <-- luteijn has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] <-- Kirben has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] <-- servus has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] <-- laxdragon has left IRC (orwell.freenode.net irc.freenode.net)
[11:05:39] --> ChanServ has joined #nuvie
[11:05:39] --> Yuv422 has joined #nuvie
[11:05:39] --> Kirben has joined #nuvie
[11:05:39] --> servus has joined #nuvie
[11:05:39] --> laxdragon has joined #nuvie
[11:05:39] --> SB-X has joined #nuvie
[11:05:39] --> jargon has joined #nuvie
[11:05:39] --> luteijn has joined #nuvie
[11:05:39] --> wjp has joined #nuvie
[13:58:42] <-- Kirben has left IRC (Read error: 110 (Connection timed out))
[14:12:36] <Yuv422> x,y,z = player_get_location();
[14:12:36] <Yuv422> x,y = math.floor(x / 8), math.floor(y / 8)
[14:12:36] <Yuv422> if x > 38 then x, lon = x - 38, "E" else x, lon = 38 - x, "W" end
[14:12:36] <Yuv422> if y > 45 then y, lat = y - 45, "S" else y, lat = 45 - y, "N" end
[14:12:37] <Yuv422> display(y.."{"..lat..", "..x.."{"..lon);
[14:12:56] <Yuv422> here's a more compact version for luteijn
[14:12:58] <Yuv422> :-)
[14:30:31] <-- servus has left IRC (Read error: 110 (Connection timed out))
[14:31:44] --> servus has joined #nuvie
[14:40:59] <luteijn> Yeah I figured you'd be able to use the comma operator to combine some of the assignments.
[14:42:30] <Yuv422> :-)
[14:42:54] <luteijn> although x=<exp> :: y=<exp> is probably more clear, esp. if the expression is complicated.
[14:43:02] <Yuv422> yeah
[14:43:26] <Yuv422> x, y = y, x
[14:43:39] <luteijn> that's a nice feature of lua.
[14:43:42] <Yuv422> yeah
[14:43:55] <luteijn> no more t=x; x=y; y=t;
[14:46:43] <luteijn> so how far did you get make nuvie lua capable? Should I (if I get time) work on usecode for blue gates in the current system, or hold my breath for lua usecode?
[14:51:03] <Yuv422> at the moment only magic has lua scripting
[14:52:58] <Yuv422> I'm not sure when lua usecode will be ready
[14:53:36] <Yuv422> we need to think about the implementation some more.
[14:53:46] <Yuv422> to make sure we get a good fit
[14:54:38] <Yuv422> I'm off to bed now
[14:54:40] <Yuv422> cya
[14:55:06] <-- Yuv422 has left IRC ()
[22:04:56] --> Kirben has joined #nuvie
[22:27:20] <-- SB-X has left IRC ("brb")
[22:27:27] --> SB-X has joined #nuvie