Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 05-05-2009, 03:56 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Inverness View Post
Says the person who only knows GScript.
Quite wrong.

Also, very well said Skyld!
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #17  
Old 05-05-2009, 04:08 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by xXziroXx View Post
Quite wrong.

Also, very well said Skyld!
Way to latch on to Skyld's post to defend your substance-less ****posting
Reply With Quote
  #18  
Old 05-05-2009, 06:03 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Well all the more reason to have private variables. I don't think actual static function variables would work to well with the way GScript is right now.

And another thought, there isn't really a way to list global variables, so it would be possible to hide some value as a global variable assuming noone else can see the script. Though I think doing that would be a bit funky.
Quote:
Originally Posted by Skyld View Post
WILL NOT HAPPEN.

Now that we've cleared that up, please move on with your life.
Don't raise your voice at me young man.
Quote:
Originally Posted by xXziroXx View Post
Quite wrong.

Also, very well said Skyld!
Loriel put it better than I could have.
__________________

Last edited by Inverness; 05-05-2009 at 06:14 PM..
Reply With Quote
  #19  
Old 05-06-2009, 12:47 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Actually you can display global variables now with /memstats full.

I didn't want discussion about lua or so because it's more philosophical, better to open a new thread for speaking about what stuff graal script should borrow from other languages or so.
Reply With Quote
  #20  
Old 05-06-2009, 11:27 AM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Isn't LUA harder?

Note: I don't know anything about LUA, but since it's used in WoW it should be a little harder than a language for a 2D game oO
And isn't LUA only used to do visual stuff?

Ah crap, someone tell me what LUA is all about :f
Reply With Quote
  #21  
Old 05-06-2009, 11:55 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Pelikano View Post
Isn't LUA harder?

Note: I don't know anything about LUA, but since it's used in *** it should be a little harder than a language for a 2D game oO
And isn't LUA only used to do visual stuff?

Ah crap, someone tell me what LUA is all about :f
no it is actually easier

Lua is a language specifically designed to be easy to pick up and to be embedded into applications. It has nothing to do with "visual stuff", but since the entire point of a programming language is to do new stuff with it, it does not have to. Blizzard did not write their 3d engine in lua, they just embedded the lua runtime into their (C++) application and defined a huge number of additional functions that lua code can use to interact with the user interface. That has obviously no effect on the language itself.

At the danger of risking Stefan's wrath: I think the lua language and compilation model is easier to understand than gs2. There are fewer concepts you need to grasp in order to reason about the behaviour of a lua program because there is plain less magic going on, and there is a small number of language features that are extremely powerful (thinking of lexical closures for all kinds of crazy functional programming things, and composing arbitrary data structures from simple tables). Of course, this might as well be a downside to the whole thing, since the parts of gs2 that are more complicated are mostly that way because Graal's game world is directly integrated with the gs2 "object space"

The thing that sold me on lua is that there is a single reference manual that explains absolutely everything that is in the language, and is relatively easy to read and comprehend.
Reply With Quote
  #22  
Old 05-06-2009, 03:46 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Stefan View Post
Actually you can display global variables now with /memstats full.

I didn't want discussion about lua or so because it's more philosophical, better to open a new thread for speaking about what stuff graal script should borrow from other languages or so.
Oh dear, there are so many more global variables than I thought. There is also alot of uknown_object. Stefan could you change it so unknown_objet is simply not added to global variables?

By the way, I've also wondered if global variables and object variables are stored using hash tables?
__________________
Reply With Quote
  #23  
Old 05-06-2009, 03:49 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Lua is much much simplier than languages like Graal Script, Flash etc., and is easier to optimize. However there are few things that make it not good for our use: the syntax is very different to C/C++/Java/JavaScript/Flash/Graal Script, and of course most Graal stuff is not existing or at least not in the extend we are using them (join/leave classes, sleep/waitfor, variable scope, dynamic allocation of variables, automatic event binding etc. etc.). So it's quite interesting, but not a drop-in replacement. If we ever switch to another language or system then only for speed (e.g. a just-in-time compiler which exist for all platforms, including iphone, llvm might be the light at the end of the tunnel) or for better compatibility with code from other platforms, including Flash and Java programs.

All variables are stored in hash tables yes.
"unknown_object"s are mainly GUI objects or so which don't have a name. They still exist in the global variable space though.
Reply With Quote
  #24  
Old 05-06-2009, 06:40 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Stefan View Post
Lua is much much simplier than languages like Graal Script, Flash etc., and is easier to optimize. However there are few things that make it not good for our use: the syntax is very different to C/C++/Java/JavaScript/Flash/Graal Script, and of course most Graal stuff is not existing or at least not in the extend we are using them (join/leave classes, sleep/waitfor, variable scope, dynamic allocation of variables, automatic event binding etc. etc.). So it's quite interesting, but not a drop-in replacement. If we ever switch to another language or system then only for speed (e.g. a just-in-time compiler which exist for all platforms, including iphone, llvm might be the light at the end of the tunnel) or for better compatibility with code from other platforms, including Flash and Java programs.
I think a GScript's problem is consistency. It has alot of quirks like I dislike:
  • Dynamic variables are case-sensitive, yet static variables aren't.
  • Object-oriented design, yet lack of actual user-defined classes.
  • A whole range of global variables and functions, yet an inability to create your own.
I think we need a GS3 which is a more refined an object-oriented version of GS2, with full support for classes and stuff like that. For example, providing a script for a weapon should involve subclassing the weapon class and overriding the event functions in the weapon class.

Quote:
Originally Posted by Stefan View Post
All variables are stored in hash tables yes.
"unknown_object"s are mainly GUI objects or so which don't have a name. They still exist in the global variable space though.
__________________
Reply With Quote
  #25  
Old 05-06-2009, 06:44 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Inverness View Post
For example, providing a script for a weapon should involve subclassing the weapon class and overriding the event functions in the weapon class.
Can we just pretend it actually does this already?
Reply With Quote
  #26  
Old 05-06-2009, 06:46 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Inverness View Post
I think a GScript's problem is consistency. It has alot of quirks like I dislike:
  • Dynamic variables are case-sensitive, yet static variables aren't.
  • Object-oriented design, yet lack of actual user-defined classes.
  • A whole range of global variables and functions, yet an inability to create your own.
I think we need a GS3 which is a more refined an object-oriented version of GS2, with full support for classes and stuff like that. For example, providing a script for a weapon should involve subclassing the weapon class and overriding the event functions in the weapon class.
Agreed.
Reply With Quote
  #27  
Old 05-06-2009, 07:06 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Loriel View Post
Can we just pretend it actually does this already?
__________________
Reply With Quote
  #28  
Old 05-06-2009, 07:53 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Graal uses a more dynamic class system instead of a compiler-based class system, those things cannot be mixed easily. Graal demands objects to be dynamic, you can create and modify the objects at any time.

On the other side you have languages like C++ and Java which are basicly providing a class system which restricts the programming to a certain set of class functionality which are only useful at compile-time. When the program is compiled and running then the "class" system is just a chunk of memory and a list of functions attached to each object. These are quite different concepts.

See the idea of "static" variables: it is a restriction, you are basicly using global variables but when compiling the script the compiler ensures that you can only access it from a certain piece of code. The variable is however still accessible from the other code, with some tricks.
Reply With Quote
  #29  
Old 05-06-2009, 08:09 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Stefan View Post
Graal uses a more dynamic class system instead of a compiler-based class system, those things cannot be mixed easily. Graal demands objects to be dynamic, you can create and modify the objects at any time.
Perhaps you should use Python as a reference for how you would want to improve GScript, it has a dynamic class system where classes (types) can be created dynamically and objects can optionally have dynamic variables using a hash table. The same type objects are used for static (built-in) types as with dynamic types.

I'm a person who dislikes reinventing the wheel, which is why I always make suggestions about using Python, because I think while it make take alot of effort (binding using Boost.Python, applying security changes to Python source, converting scripts) to convert in the short term, it would be better for the longevity of Graal if you want Graal to continue for years to come.
__________________

Last edited by Inverness; 05-06-2009 at 08:25 PM..
Reply With Quote
  #30  
Old 05-06-2009, 10:45 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Inverness View Post
I'm a person who dislikes reinventing the wheel, which is why I always make suggestions about using Python, because I think while it make take alot of effort (binding using Boost.Python, applying security changes to Python source, converting scripts) to convert in the short term, it would be better for the longevity of Graal if you want Graal to continue for years to come.
I think the Wesnoth guys came to the conclusion that they could not safely run arbitrary python scripts in their game client because it could not be made secure.
Reply With Quote
Reply


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

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

Forum Jump


All times are GMT +2. The time now is 03:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.