[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, 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.
[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Mapper! (Hehehehe.)

Mapper! (Hehehehe.)

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1  2 3  4  5  

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #15 on Tue 18 Jan 2005 05:33 AM (UTC)
Message
Quote:
By c arrays I mean things like.. adding elements to an array by doing:

arr[arr_c++]=value;
Oh... err.. isn't that how you're supposed to do it in Lua? Except for the arr_c++, of course, which Lua doesn't have; but Lua definitely supports that kind of notation. In Lua, arrays are simply associative arrays where the key is the index into the array.
Quote:
I have other personal arguments against functional programming, but I refuse to post them here.
I would be very interested to know what you think. If you have the time and don't mind, I'd greatly appreciate to hear your reasons - my email is myfirstname at the-haleys.com where myfirstname is david.
Quote:
Oh, yeah, that really irritates me about Lua. Would it kill them to add things like ++ (increment) and ..= (append)?
The FAQ covers this albeit quite poorly IMHO. http://lua-users.org/wiki/LuaFaq - search for "Why does Lua lack the += operator, etc.?" Apparently it can be implemented via extensions, and I'll probably do that at some point; just haven't gotten around to it yet.
Quote:
Terms like north (being towards the top of the screen) break down. I wouldn't write anything with north being north-east, it'd make my brain explode.
You wouldn't (or shouldn't) have to do anything like that; the graphics engine would let you handle that transparently.
Quote:
I think the best soloution would probably be to have a 60 or 30degree view, looking north, with a squished perspective. As that made no sense, I'll do a concept demo (in c (maybe with some inline asm), of course, as any other languages are far too slow to render in, properly) or a "screenshot" at some point if I feel like it and I can get it looking good.
Sounds pretty good. The advantage to the isometric view is that it lets you see more, but it does require additional mental gymnastics. Oh, and by C, do you include C++ as languages suitable for rendering? :) If not, you should check out the OGRE3d project: www.ogre3d.org or .net, can't remember - 3d engine written in C++ that has absolutely beautiful performance.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Faux   United Kingdom  (77 posts)  [Biography] bio
Date Reply #16 on Tue 18 Jan 2005 11:31 AM (UTC)
Message
Quote:
.. isn't that how you're supposed to do it in Lua?

I don't think so, but nowhere does it tell you what's right and what's wrong, so..
I think `the lua way` to do it is to repeatedly call
array.insert()
, so you have absolutely no idea at what position you are in the array, and then, if you need to itterate the array, use the `foreach` syntax:
for k,v in pairs(t) do


Quote:
..just haven't gotten around to it yet.

Afaict, Lua Cheia doesn't implement them, so I'm guessing it's not trivial to do?

Quote:
...the graphics engine would let you handle that transparently.

Just picking a random image off of google to check I know what isometric rendering is...:
http://www.northants.police.uk/museum_new/images/isometric.jpg
In this case, if we're going to assume that muds have square instead of diamond rooms, north is either going to have to be the 7,8,9 wall (ne) or the 11,12,13 wall (nw).
Ignore me if I've missed the definition of isometric, btw =p

Quote:
...isometric view is that it lets you see more...

I'd actually have to draw it to agree with you, but you seem pretty certain so I'll at least have a go. =)

Quote:
..3d engine written in C++..

I normally find that engines provide too many features (bloated) but not, say, just one out of however many, that I actually need. Then I get.. irate. :p</flame, again..> Although this is probably my fault for not wanting to do it the way the implementor of the engine (/language) wanted me to do things.

Faux, from Discworld. Feel free to come talk to me =)

http://faux.servebeer.com/
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #17 on Tue 18 Jan 2005 04:55 PM (UTC)
Message
Quote:
, so you have absolutely no idea at what position you are in the array, and then, if you need to itterate the array, use the `foreach` syntax:
This part of the Lua book talks about arrays and how they think you should use them: http://www.lua.org/pil/11.1.html - You can use table.getn(array) to get the length of the array, which will either count the elements, or, if you've cached the size (using setn, or insert which updates it automatically) will retrieve that instead of counting.
Quote:
Afaict, Lua Cheia doesn't implement them, so I'm guessing it's not trivial to do?
I think you're right, it'd have to be written as a fairly major extension, but they claim it's doable. I do really like the feature, so at some point or another I'm going to look into it.
Quote:
In this case, if we're going to assume that muds have square instead of diamond rooms, north is either going to have to be the 7,8,9 wall (ne) or the 11,12,13 wall (nw).
I think the convention is that up-left is 'north' so up-right is 'east', but in any case that is indeed exactly what isometric rendering is. The reason why you see more is just that the view is slightly tilted; therefore, with a camera at the same altitude, you have a larger view on the world.
Quote:
Although this is probably my fault for not wanting to do it the way the implementor of the engine (/language) wanted me to do things.
Well, it's definitely true that almost no matter which package you choose, there'll be stuff in it that you don't need, and it'll be missing stuff that you do need. Generally, though, it's worth it, as you can add the stuff yourself (if you really need it and have no alternative solution) without having to write a 3d engine from scratch. In the case of things like Ogre3D, writing that from scratch would be quite an amazing feat. 3d engines are... hard to write. :-) (especially if they have advanced features and the like.) Not only are the mathematics non-trivial, but even then, it's fairly easy to get the darn thing running in general, but to get it running fast... that's quite challenging. And then, to be able to have a usable engine from an API perspective... *shudder* :P

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Faux   United Kingdom  (77 posts)  [Biography] bio
Date Reply #18 on Tue 18 Jan 2005 05:16 PM (UTC)

Amended on Tue 18 Jan 2005 05:17 PM (UTC) by Faux

Message
Quote:
...You can use table.getn(array) to get the length of the array,..

Things like.. say..

b={}
while array.getn(b)<200 do
array.insert(b,200-array.getn(b))
end

or

b={}
while i<200 do
i=i+1      -- Wouldn't be needed if:
b[i]=200-i -- i++
end


Quote:
..I'm going to look into it...

I found a page somewhere where someone had written source patches to allow things like, say, 0x000000 for numbers.

Oh, there it is: http://lua-users.org/wiki/PeterShook

Eeew, source patches.

Quote:
I think the convention is that up-left is 'north'..

Exactly what makes my brain ache. =/

Quote:
Well, it's definitely true that almost no matter which package you choose, there'll be stuff in it that you don't need, and it'll be missing stuff that you do need.

Not quite, but then I suppose you count engines I've written myself as cheating. :p

Hmm.. saying that it's quite possible that Strike2 could work for this. *thinks*

Faux, from Discworld. Feel free to come talk to me =)

http://faux.servebeer.com/
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #19 on Tue 18 Jan 2005 06:04 PM (UTC)
Message
Quote:

b={}
while array.getn(b)<200 do
array.insert(b,200-array.getn(b))
end

or

b={}
while i<200 do
i=i+1 -- Wouldn't be needed if:
b[i]=200-i -- i++
end
Definitely not the first... why not just:
b = {}
for i = 1, 200 do
  b[i] = 200 - i
end
Quote:
Eeew, source patches.
Yes, I agree, I'd rather stick away from source patches as well... but, well, sometimes you have to do what you have to do. :-)
Quote:
Not quite, but then I suppose you count engines I've written myself as cheating. :p
Yes, I meant packages you download off the net. :)
Quote:
Hmm.. saying that it's quite possible that Strike2 could work for this. *thinks*
Never heard of it... what kind of engine is it? You don't need a 3d engine per se, there are lots of engines specifically meant for isometric display. Those would be better, I think, but they're also much harder to find these days. :/

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #20 on Tue 18 Jan 2005 06:27 PM (UTC)

Amended on Tue 18 Jan 2005 06:28 PM (UTC) by Flannel

Message
Crystal Space has a isometric engine I believe. Erm, actually, looks like they got rid of it.

Theres some other open source solutions (Irrlicht has a tutorial for isometrics, for instance http://www.saigumi.net/archives/000067.html).

None of which are in Lua though, but thats not too terribly important.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #21 on Tue 18 Jan 2005 07:31 PM (UTC)
Message
I don't believe you could write a sufficiently rapid 2d/3d engine in Lua, anyhow. Besides, it would have to talk to C/C++ anyway, because how else will you interface with the underlying graphics library?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Faux   United Kingdom  (77 posts)  [Biography] bio
Date Reply #22 on Tue 18 Jan 2005 09:16 PM (UTC)
Message
Quote:
Never heard of it...

It's a game engine on which some other projects are based upon. And no, you won't find it. But it's my work, so if I want to use it for this.. :)

Quote:
Definitely not the first...

It wasn't an actual example, but it shows why (what I see as) the native lua way isn't necessarily (<-- important word) the best.

Quote:
Eeew, source patches.

(Yes, I know that's a self quote :p)
Hmmmmmmm.
It's just occoured to me that `rex` isn't a part of Lua. Do all of the rest of the Luacheaieaieaie features exist? I've heard vauge mention of sockets somewhere, and some variables like `bit` exist.
I'm aware that it could be a loadlib extension, but I don't see the dll, and I'm too lazy to browse a disassembly of Mush. As we're speaking in Mush, what would there be to stop there being an even more customised version?
Apart from the fact that the idea is silly, and that it's Wrong not to contribute to the community (should any of us be good enough to do it, that is).

Quote:
..Crystal Space..

Soo.. who wants to port the entire x lines of c++ code in Crystalspace/[name of other engine] to Lua?

Quote:
I don't believe you could write a sufficiently rapid 2d/3d engine in Lua, anyhow.

Possible solution: Display lists.
If you aren't familiar with display lists, note that in a typed language (c) mmatrix is a (float *), map is an (int), and that player is a Lua array of integers/floats.
This is possibly oversimplified, but.. don't think so.

window:OnPaint()
ogl.LoadIdentity()
ogl.glLoadMatrixf(mmatrix)
ogl.glTranslatef(player.x,player.y,player.z*heightmultiply)
ogl.glCallList(map);
end


Faux, from Discworld. Feel free to come talk to me =)

http://faux.servebeer.com/
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #23 on Tue 18 Jan 2005 09:42 PM (UTC)
Message
Quote:
It's a game engine on which some other projects are based upon. And no, you won't find it.
Ah- I was wondering why I hadn't found it on Google. :)
Quote:
It wasn't an actual example, but it shows why (what I see as) the native lua way isn't necessarily (<-- important word) the best.
Thing is, I don't think that's the "native Lua way" for handling arrays. It's more the way for handling bags (sets if you prefer), not arrays.
Quote:
I'm aware that it could be a loadlib extension, but I don't see the dll, and I'm too lazy to browse a disassembly of Mush. As we're speaking in Mush, what would there be to stop there being an even more customised version?
I didn't think you needed any special DLLs except fo rthe exception you're aiming to load.
Quote:
Soo.. who wants to port the entire x lines of c++ code in Crystalspace/[name of other engine] to Lua?
You wouldn't have to port the whole thing, just enough to make a Lua bridge to it and load it as an extension.
Quote:
Possible solution: Display lists.
AFAIK, it would not be possible to store the entire map in a display list, for a variety of reasons; for starters, it's far too big. Second, every time you changed the map you would have to recompute the display list. Display lists are meant for smaller objects that change infrequently, not large objects, or objects that change frequently.

I suppose that, come to think of it, for the purposes of what we're doing, we don't need a terribly fast engine. We won't, after all, be doing much computation (as is required for animation, all kinds of texture/lighting effects, etc.) All we need to do is display squares, exits and the like. The fanciest effect, AFAICS, will be translucent textures to represent altitude. So, the Lua speed issue is actually somewhat of a non-issue, for these particular purposes.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #24 on Tue 18 Jan 2005 09:47 PM (UTC)

Amended on Tue 18 Jan 2005 09:50 PM (UTC) by Flannel

Message
Yeah, we'd merely need a go between between a program that does what we need and lua.

However, I think I've found a better way. Googling either Isometric or Orthogonal (and Lua, obviously) turns up some interesting things.

LuaMat.
http://www.op-fx.com/luamat/

Or... well, this really isnt too relevent at the moment... but it does offer some interesting complete frontends...
http://h-world.simugraph.com/

You can look for more, I will be doing the same. This is just the first few things that came up relevantly. The latter one is a bit over the top. But would accomplish the task. Well, it looks like it. I haven't actually looked at the interface or anything like that.
The former does look promising, again, I haven't checked out interface or anything like that either. But it does appear to be an engine of some relevance.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Faux   United Kingdom  (77 posts)  [Biography] bio
Date Reply #25 on Tue 18 Jan 2005 09:56 PM (UTC)
Message
Quote:
Display lists.. for starters, it's far too big.

Hmm, I thought putting big models in a display list was the point. I've put, say, 2 million triangles (1kx1k grid) in one before, how it affects the performance, from c, I'm not sure.

Quote:
...changed the map...

When would we be changing the map? (changing as in modifying, not as in switching to a different map).

Quote:
The fanciest effect, AFAICS, will be translucent textures to represent altitude


ogl.glEnable(ogl.GL_BLEND)
ogl.glCallList(map)
ogl.glDisable(ogl.GL_BLEND)


Quote:
You wouldn't have to port the whole thing,..

It still ain't going to be me porting it :)

Quote:
I didn't think you needed any special DLLs except fo rthe exception you're aiming to load.

Exception.. extension?
True. I was assuming LuaCheia was an extension, although that seems unlikely.

Quote:
Ah- I was wondering why I hadn't found it on Google. :)

Type the right thing in and, not only do you find it, you get a googlewhack ;p

Faux, from Discworld. Feel free to come talk to me =)

http://faux.servebeer.com/
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #26 on Tue 18 Jan 2005 10:46 PM (UTC)
Message
Quote:
Hmm, I thought putting big models in a display list was the point.
Yes and no. Display lists are meant to save expensive calculations, such as a series of matrix manipulations or other mathematics. They also save (to some extent, and depending on the implementation) having to move the information to the graphics card. That being said, read this from the OpenGL 'Red Book':
Quote:
Remember that display lists have some disadvantages. The buildCircle() example in Example 4-1 requires storage for at least 200 floating-point numbers, whereas the object code for the original drawCircle() routine (in immediate mode) is probably a lot smaller than that.
http://fly.cc.fer.hr/~unreal/theredbook/chapter04.html
Quote:
When would we be changing the map?
Well, if you're automapping, you would be updating the map every time you entered a new room.
Quote:
ogl.glEnable(ogl.GL_BLEND)
ogl.glCallList(map)
ogl.glDisable(ogl.GL_BLEND)
It's not quite that simple. :-) You have to only reveal certain parts of the map, so you can't just plop the whole display list in. (Another reason incidentally why you don't want the whole "floor" as a display list.)
Quote:
Type the right thing in and, not only do you find it, you get a googlewhack ;p
A Googlewhack? :) I'm curious, then, what is the 'right' thing? :P

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Faux   United Kingdom  (77 posts)  [Biography] bio
Date Reply #27 on Tue 18 Jan 2005 11:49 PM (UTC)
Message
Quote:
It's not quite that simple.

It is if I don't have to show anyone the code. (Hehehehe.) :P

Quote:
...what is the 'right' thing? :P

(Hehehehe.) :P

Quote:
Display lists are meant to save expensive calculations..

Like array processing in Lua?

Quote:
Well, if you're automapping..

Push it to a list every 5/10/20/50/ rooms?




Flannel, I'm liking the look of: http://doris.sourceforge.net/

Faux, from Discworld. Feel free to come talk to me =)

http://faux.servebeer.com/
[Go to top] top

Posted by Shadowfyr   USA  (1,787 posts)  [Biography] bio
Date Reply #28 on Wed 19 Jan 2005 12:45 AM (UTC)
Message
Quote:
Quote:
Well, if you're automapping..


Push it to a list every 5/10/20/50/ rooms?


Also, sometimes it may be necessary to manually edit the map or move rooms around. A lot of muds intentionally make mapping complicated and even if your mapper comes 'close' to working, some adjustment may be needed to tell it (Room 3 and Room 53 are the same room) and adjust the entire maps layout to account for it.
[Go to top] top

Posted by Faux   United Kingdom  (77 posts)  [Biography] bio
Date Reply #29 on Wed 19 Jan 2005 01:59 AM (UTC)
Message
Come to think of it, I wouldn't want to be editing in 3d anyway.

Faux, from Discworld. Feel free to come talk to me =)

http://faux.servebeer.com/
[Go to top] 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.


150,454 views.

This is page 2, subject is 5 pages long:  [Previous page]  1  2 3  4  5  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]