Mythruna
March 28, 2024, 07:18:47 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the new forums. See "Announcements" for a note for new users.
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: Scripting: Getting Started (WIP)  (Read 27656 times)
Sunjammer
Newbie
*
Posts: 16



View Profile
« Reply #15 on: February 07, 2012, 02:32:40 PM »

Re: Scripting: Getting Started (WIP)


Agreed.  The console was just about getting ones' groovy feet wet without necessarily having to pull up a big IDE.  That is also the same console that I will launch "in game" in a script-developer mode when I get to that point.  So some familiarity is probably a good thing.
That's a good point. Rethinking the progression it might be better to start off with notepad and some simple "copy and paste" style examples to whet the appetite. We can use them to explain some of the bigger concepts (like "event-driven", "scripting", etc.) then introduce the Groovy Console and script-builder mode (once ready) and finally recommend Java SDK/IDE etc.

I'm wondering now if the whole Java SDK/IDE thing is even necessary? I assumed it would be but if there's no real benefit to Johnny Modder then we can leave that for the advanced/die-hard modders.

There will be ways to have all of the following:
-global variables available to all scripts  (only exists in a hacky way but I may decide this is too dangerous anyway)
-global variables available to a specific script (any variables defined in the script are global to the script, ie: same variable for all players)
-in-memory data associated with a player/connection (this requires more code than it should and is what I talk about above.  This data only lasts while the player is logged in)
-persistent data associated with a player (in multiplayer this already exists for string, int, etc... primitive types.  playerData.someValue = "foo"; playerData.save())

One I'm on the fence about:
-persistent data associated with any entity (the entity system supports this but it's not as straight forward as the playerData example above)

In Neverwinter Nights, we could have any local variable we wanted on any object.  I can make some nice functions for doing this within the entity system but I have to see how well it performs.  One thing you couldn't easily do in NWN was have random objects just to stick things on (well, you could but they cost you)... In Mythruna's entity system, an entity is free (literally costs nothing) until it has data associated with it.
My NWN roots make me want to say "local variables for the win" but back then (before campaign variables, NWNX and the various database add ons) that was really all we had for transferring data between scripts or making it persist. I wrote a bank system for the PW I played on at the time (just before local variables were patched in) and it used an item's tag to encode the bank balance!

I'm sure if you add "entity variables" people will find ways to use them where it makes sense to add persistent data to something other than the player, for example, I can't imagine trying to make TileMagic without them! Mmm ... BlockMagic ... that sounds like a good name for a mod ...

*wanders off thinking*
« Last Edit: February 07, 2012, 02:34:44 PM by Sunjammer » Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #16 on: February 07, 2012, 05:34:29 PM »

Re: Scripting: Getting Started (WIP)


Agreed.  The console was just about getting ones' groovy feet wet without necessarily having to pull up a big IDE.  That is also the same console that I will launch "in game" in a script-developer mode when I get to that point.  So some familiarity is probably a good thing.
That's a good point. Rethinking the progression it might be better to start off with notepad and some simple "copy and paste" style examples to whet the appetite. We can use them to explain some of the bigger concepts (like "event-driven", "scripting", etc.) then introduce the Groovy Console and script-builder mode (once ready) and finally recommend Java SDK/IDE etc.

I'm wondering now if the whole Java SDK/IDE thing is even necessary? I assumed it would be but if there's no real benefit to Johnny Modder then we can leave that for the advanced/die-hard modders.

You technically already have the Java runtime or you wouldn't be able to run Mythruna.  The JDK is only needed if you want to write your own Java classes... there is no requirement to do so, though.

If you want to be able to run groovy scripts outside of Mythruna (or the groovy console you can launch through it)... then you will need at least groovy.

There will be ways to have all of the following:
-global variables available to all scripts  (only exists in a hacky way but I may decide this is too dangerous anyway)
-global variables available to a specific script (any variables defined in the script are global to the script, ie: same variable for all players)
-in-memory data associated with a player/connection (this requires more code than it should and is what I talk about above.  This data only lasts while the player is logged in)
-persistent data associated with a player (in multiplayer this already exists for string, int, etc... primitive types.  playerData.someValue = "foo"; playerData.save())

One I'm on the fence about:
-persistent data associated with any entity (the entity system supports this but it's not as straight forward as the playerData example above)

In Neverwinter Nights, we could have any local variable we wanted on any object.  I can make some nice functions for doing this within the entity system but I have to see how well it performs.  One thing you couldn't easily do in NWN was have random objects just to stick things on (well, you could but they cost you)... In Mythruna's entity system, an entity is free (literally costs nothing) until it has data associated with it.
My NWN roots make me want to say "local variables for the win" but back then (before campaign variables, NWNX and the various database add ons) that was really all we had for transferring data between scripts or making it persist. I wrote a bank system for the PW I played on at the time (just before local variables were patched in) and it used an item's tag to encode the bank balance!

I'm sure if you add "entity variables" people will find ways to use them where it makes sense to add persistent data to something other than the player, for example, I can't imagine trying to make TileMagic without them! Mmm ... BlockMagic ... that sounds like a good name for a mod ...

*wanders off thinking*

Well, we have a lot more options is all.  NWN you couldn't even nest structs and now you can write entire classes if you want.

So I could add things like SetLocalInt but maybe we find that it's not used so much.  I try not to over engineer too much before we have real use-cases.  I think a lot will be clearer when we have NPCs wandering around.
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!