RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic Goto page Previous  1, 2, 3, 4, 5  Next 
View previous topic - View next topic  
Author Message
PhyrFox
Tenshi's Bitch (Peach says "Suck it!")


Joined: 19 Nov 2004
Posts: 64
Location: New York, USA

PostPosted: Mon Nov 22, 2004 8:07 pm    Post subject: Scripting [quote]

Scripting is as simple or as complex as you want it to be. A simple scripting engine could be made up in a few minutes, others could require days, weeks, or months. The more powerful a language is, the more difficult it is to implement it. Then again, sometimes it's easier to *not* reinvent the wheel. Sphere uses Mozilla's JavaScript engine directly, with minor builtin additions to support custom objects required by the engine itself.

Unfortunately, Sphere seems to run incredibly slow, probably due to the fact that it supports infinite layers, every popular music, sound, and graphics format known, and is running on an interpreted (versus compiled) scripting language... It's unbearable on even a 450mhz system.

On the other hand, OHR RPG CE has it's own language. Although it's not the best language out there, it's small, compact, and perfectly tailored to the engine in question. The engine is simple and runs on even a low-end system with a lot of speed. It's just not highly portable.

If you decide to write your own scripting language, I'd be willing to help out a bit with ideas and such. I'm not much into being able to integrate other languages into my own programs; it's not something I've really looked into. I find often that reinventing the proverbial wheel often leads to a "lighter wheel that turns faster."

~= PhyrFox =~
Back to top  
Mandrake
elementry school minded asshole


Joined: 28 May 2002
Posts: 1341
Location: GNARR!

PostPosted: Mon Nov 22, 2004 8:31 pm    Post subject: [quote]

Quote:

Unfortunately, Sphere seems to run incredibly slow, probably due to the fact that it supports infinite layers, every popular music, sound, and graphics format known, and is running on an interpreted (versus compiled) scripting language... It's unbearable on even a 450mhz system


Not true- I use Lua 5 (a pre-hatched scripting system) in Gia (soon to be renamed), and I have almost every popular music formatted supported, infinite layers, alot of graphics format and an interpreted scripting language and it runs *great* on my 350mhz pentium.

reinventing the wheel does not make a lighter wheel that runs faster. Since you are starting from scratch it will probably be a buggier and less mature wheel as well.
_________________
"Well, last time I flicked on a lighter, I'm pretty sure I didn't create a black hole."-
Xmark

http://pauljessup.com
Back to top  
janus
Mage


Joined: 29 Jun 2002
Posts: 464
Location: Issaquah, WA

PostPosted: Mon Nov 22, 2004 10:48 pm    Post subject: [quote]

Sphere is slow because it's over 6 years old, does rendering in pure software by default using code that isn't very optimized, and because you have a really old computer. :)

(You may also wish to note that OHRRPGCE does not have almost any of the multimedia features Sphere has, which makes the comparison a bit inadequate)
Back to top  
DanKirby
Monkey-Butler


Joined: 16 Jun 2004
Posts: 54

PostPosted: Tue Nov 23, 2004 9:17 pm    Post subject: [quote]

Right now, I'm working on the menu systems, anyway. I want more functionality in the engine before figuring out how to script it.
Back to top  
PhyrFox
Tenshi's Bitch (Peach says "Suck it!")


Joined: 19 Nov 2004
Posts: 64
Location: New York, USA

PostPosted: Tue Nov 23, 2004 11:04 pm    Post subject: [quote]

Mandrake wrote:
Quote:

Unfortunately, Sphere seems to run incredibly slow, probably due to the fact that it supports infinite layers, every popular music, sound, and graphics format known, and is running on an interpreted (versus compiled) scripting language... It's unbearable on even a 450mhz system


Not true- I use Lua 5 (a pre-hatched scripting system) in Gia (soon to be renamed), and I have almost every popular music formatted supported, infinite layers, alot of graphics format and an interpreted scripting language and it runs *great* on my 350mhz pentium.

reinventing the wheel does not make a lighter wheel that runs faster. Since you are starting from scratch it will probably be a buggier and less mature wheel as well.


Depends on the wheel, technically. If a library has over 150 functions, and you need only five of them, does it make sense to use the library? If you can write those five functions yourself (say, in five minutes) and reduce your overall executable by nearly 300k and shave off several million CPU cycles, then wouldn't it make sense to do it yourself?

Then again, if those five functions are already as optimized as you care for them to be, and disk space isn't a major consideration (and download limitation, etc), and the CPU cycles are actually saved elsewhere anyway (or maybe you just don't care and are willing to up the requirements), then a library is just the thing. Or maybe a library is better optimized than the code you can write, and it's worth using it because it actually makes your code faster (hardware accelleration maybe, or some other scheme). It's even possible that you need to use a library in the interest of saving development time.

If a tool fits, then by all means, use it. If it doesn't, then you have to build your own tools. A compiler isn't that big of a challenge if you consider the complexity of the script language when you make it. I personally would write my own language, but my language might not even be useful to other people. So there might not be a point for other people to use it. Then again, it might be useful, and other people might use it. But only if they had a certain need.

No matter the case though, it's up to each developer to decide what's right. The complexity required is solely dependant on the needs of the developer and the engine being written.

~= PhyrFox =~
Back to top  
Hajo
Demon Hunter


Joined: 30 Sep 2003
Posts: 779
Location: Between chair and keyboard.

PostPosted: Wed Nov 24, 2004 10:58 am    Post subject: [quote]

PhyrFox wrote:

Depends on the wheel, technically. If a library has over 150 functions, and you need only five of them, does it make sense to use the library? If you can write those five functions yourself (say, in five minutes) and reduce your overall executable by nearly 300k and shave off several million CPU cycles, then wouldn't it make sense to do it yourself?


It makes sense but this example implies a extremely bad linker - usually a linker links only those parts of the library to your code that are actually used - and an tremdously bad library - usually library writes aren't so unskilled that your own 5 minute implementation is a several million CPU cycles faster.

The other thing to consider is that libraries have thousands of users whom you can ask for help, and due to the large number of users bugs most likely have been found and fixed before you even discovered the library. If you're the first one to use the library, I can understand your hesitation to use it ;^)

One of my reasons not to use premade libraries overly is portability. Libraries may not be available on some of my target platforms, and libraries may go out of maintenence before a new platform comes to existence and then you'll have a hard time to replace the lib if you want to port your code to the new/unsupoorted platform.
Back to top  
tsb
I wanna be a ballerina!


Joined: 09 Oct 2004
Posts: 23

PostPosted: Wed Nov 24, 2004 1:57 pm    Post subject: [quote]

Sphere's slowness is entirely because of its software renderer. The speed problems tend to disappear when you use the sphere_gl driver.

On the other hand, VERGE v3 uses a home-cooked, compiled scripting language, not at all unlike OHRRPGE. This language runs about half as fast as Python and isn't anywhere close to the same level of expressivity. (FYI, Python isn't a terrifically efficient language from an execution standpoint: Java runs rings around it)

Verge as a whole runs at a healthy clip because it doesn't use alpha channels for anything by default, not because its scripting language was implemented from scratch. :)

Quote:
One of my reasons not to use premade libraries overly is portability. Libraries may not be available on some of my target platforms, and libraries may go out of maintenence before a new platform comes to existence and then you'll have a hard time to replace the lib if you want to port your code to the new/unsupoorted platform.
One of the biggest reasons I use third party libraries at all is because they get tested on platforms I care about without any overt effort on my part.
_________________
—andy
http://ika.sf.net
Back to top  
Mandrake
elementry school minded asshole


Joined: 28 May 2002
Posts: 1341
Location: GNARR!

PostPosted: Wed Nov 24, 2004 2:40 pm    Post subject: [quote]

Quote:

Sphere's slowness is entirely because of its software renderer. The speed problems tend to disappear when you use the sphere_gl driver.


Unless you don't have an OpenGL card. And some of us don't. Including me. Why should a 3d card be required to play a 2d game? It sounds like very bad inefficiancy IMHO.

Quote:

On the other hand, VERGE v3 uses a home-cooked, compiled scripting language, not at all unlike OHRRPGE. This language runs about half as fast as Python and isn't anywhere close to the same level of expressivity. (FYI, Python isn't a terrifically efficient language from an execution standpoint: Java runs rings around it)


And Lua runs rings around both of them. Of course I abhore Java because it's a interpretted language that still contains the compile-debug coding bottleneck. Scripting languages are good because they get rid of this bottleneck.

Quote:

Verge as a whole runs at a healthy clip because it doesn't use alpha channels for anything by default, not because its scripting language was implemented from scratch. :)


Actually, in Freya (ex Gia) I use alpha channels by default and do not use any 3d accell, and it gets mad speed on older systems (that support the MMX instructions- and very rarely is there a computer these days that does not have MMX instructions). Using Alpha channels by default does not necassarily mean any slowdown. I really think spehere's bad speed is due to poor programming. Not just in the rendering, but in the scripting interface and the way it handles it's memory collection for objects.
_________________
"Well, last time I flicked on a lighter, I'm pretty sure I didn't create a black hole."-
Xmark

http://pauljessup.com
Back to top  
DanKirby
Monkey-Butler


Joined: 16 Jun 2004
Posts: 54

PostPosted: Mon Nov 29, 2004 9:45 pm    Post subject: [quote]

I'm more than likely going back to Lua at this point. I would've used it anyway for scripting the battle engine, since I needed a more developed system for the calculations and stuff.
The only problem I have is unloading the old script set when the new one is loaded. (when the map changes) Not quite sure how to do that.

I just need to work on the main menu console, and then I can get to work on the scripting system.
Back to top  
Hajo
Demon Hunter


Joined: 30 Sep 2003
Posts: 779
Location: Between chair and keyboard.

PostPosted: Tue Nov 30, 2004 1:00 pm    Post subject: [quote]

You can instantiate several Lua interpreters in yopur program each one with it's own heap an stack. Unloading = destroy the old one, loading = instantiate a new one ?
Back to top  
DanKirby
Monkey-Butler


Joined: 16 Jun 2004
Posts: 54

PostPosted: Fri Dec 03, 2004 9:59 pm    Post subject: [quote]

I've considered that. There are a few issues, though.
I can't have the map loading routine do that automatically, if I'm in the middle of a cutscene script or something. I'd have to do something similar to what I did with ToL: save the name of the current map before entering the script area, then check it after, and load a new script if the map is different.

Anyway, I'm working on the main menu console right now. It looks kind of ugly, with everything printed in Arial font. I might have a picture up here when I'm done with it.
Back to top  
DanKirby
Monkey-Butler


Joined: 16 Jun 2004
Posts: 54

PostPosted: Mon Dec 06, 2004 6:29 am    Post subject: [quote]

Don't have a picture, but I've finished the menu system. Except for the Game Options section, but that's because I don't have any options to set...

So now, I can focus on the engine<->scripting system interface before I start on designing the battle system (ick).
Back to top  
DanKirby
Monkey-Butler


Joined: 16 Jun 2004
Posts: 54

PostPosted: Wed Dec 08, 2004 11:54 pm    Post subject: [quote]

Things are going well with the scripting engine except for one thing. I can't get my engine to call a Lua script function other than the main.

I try to push the function onto the top of the stack every way I can. But it keeps saying it's a nil value. I can call the function from within the script just fine, but from the engine it just doesn't seem to work.[/code]
Back to top  
DanKirby
Monkey-Butler


Joined: 16 Jun 2004
Posts: 54

PostPosted: Thu Dec 09, 2004 12:43 am    Post subject: [quote]

Never mind...I seem to have gotten it. I had to run lua_call just when the script was loaded...to register the functions in the global table, I guess.

Anyway, I can continue testing my script functions now.
Back to top  
Bjorn
Demon Hunter


Joined: 29 May 2002
Posts: 1425
Location: Germany

PostPosted: Thu Dec 09, 2004 7:57 pm    Post subject: [quote]

Yeah that's how it works. :-)
Back to top  
Post new topic Reply to topic Page 3 of 5 All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum