Author Topic: Planeshift scripting in java  (Read 1450 times)

bagna

  • Wayfarer
  • *
  • Posts: 7
    • View Profile
Planeshift scripting in java
« on: April 05, 2004, 08:57:15 pm »
I\'m here for a \"tecnical\" request. I know that planeshift is all done in C/C++, but why don\'t made scripting in Java? Yes, the graphics and the network/resource manager must be done in C/C++ for best performance, but i think scripting can be done in a language such as java. For example Vampire : The Masquerade is done exactly in this way, and it\'s a vary good game, with no performance problem.Also Star Wars : Galaxies (is a MMORPG) is done this way. And was a very old version of java for the first one (i think 1.1). I think that many java developers (included me) will give their help if this will be made possible. With \"scripting\" i mean \"monster AI\", but also quests \"creation\" and other things at a high level.
Please consider this request and reply! Thanks!
Bye bye!

« Last Edit: April 05, 2004, 11:30:59 pm by bagna »

Moogie

  • Forum Legend
  • *
  • Posts: 4551
  • Artist/Flash Animator
    • View Profile
(No subject)
« Reply #1 on: April 06, 2004, 02:05:27 am »
Afaik, the devs use their own scripting language, and I highly doubt they\'d re-write their entire 13+ million lines in another scripting language just for the hell of it. :)



(Okay, so maybe they don\'t have 13 million lines of code... or do they? ?( )
« Last Edit: April 06, 2004, 02:06:03 am by Moogie »

Grakrim

  • Hydlaa Citizen
  • *
  • Posts: 468
    • View Profile
(No subject)
« Reply #2 on: April 06, 2004, 03:44:36 am »
I believe they use Python, although I might be mistaken there.  Python is just as established as Java, generally easier to use, learn, and bind to C; and is generally preferred over Java.
\" I think you should just follow Grakrim\'s advice ;)\"

\"A universe is enough for more than one opinion.\" - Maxximus

dfryer

  • Veteran
  • *
  • Posts: 1070
    • View Profile
(No subject)
« Reply #3 on: April 06, 2004, 04:07:56 am »
I don\'t think they even use Python- they do use CEL (the crystal entity layer) which can optionally be used by python for things like monster behaviours etc., but as far as I know everything is done in C++.

I\'m only basing this on an informal search through the source directories for files ending in .py, and finding none.
Quidquid latine dictum sit, altum sonatur.

Vengeance

  • Veteran
  • *
  • Posts: 1452
    • View Profile
(No subject)
« Reply #4 on: April 06, 2004, 06:04:46 am »
We have made a number of mini languages for different features of the game--all highly tuned for their exact role, which makes them take less memory, parse faster and run faster than generic scripts.

bagna

  • Wayfarer
  • *
  • Posts: 7
    • View Profile
(No subject)
« Reply #5 on: April 06, 2004, 01:51:07 pm »
Many languages?
Is there a language specification somewhere for this languages?
I\'m intrested in making monster ai scripting :) if i can contribute.
Thank you.

orogor

  • Hydlaa Resident
  • *
  • Posts: 99
    • View Profile
(No subject)
« Reply #6 on: April 06, 2004, 02:11:05 pm »
look in npcbehave.xml and npcdef.xml for exemples , perhaps  devs have more infos , but i do not.
I did finaly found a work :))

bagna

  • Wayfarer
  • *
  • Posts: 7
    • View Profile
(No subject)
« Reply #7 on: April 06, 2004, 08:02:03 pm »
First thing : sorry for my English, free feel to correct :)

Well, i downloaded the source code from the cvs and have a look on some xml files. I looked the files you have mentitioned for npc.
Well, now you have 10 npc, you put 10 entries in the xml files.
But when you have 1000 npc, what you will do? You will put 1000 entries in your xml file? It seem not to be a good solution.
Now there are three solution :

a) ignore this comment, and send me a \"xxxx you\" :) hehehehe

b) create a STRONG xml specification for planeshift scripting, and when i mean strong i mean
-> npc global variables
-> npc local variables
-> sensors
-> events
-> actions
-> npc classes and instances
ecc ecc
but also
-> loops
-> conditionals
-> data structures ?
... and i can help writing and coding the specification and the xml for it ...
c) keep ai calcs in another \"server\", call it the \"AI server\" which can stay on the same machine or in another machine of course.
The AI server simply communicates with the planeshift server what ACTIONS should be done on the world (quest creation, creatures behaviour, ecc). With this separation of concerns you keep in the planeshift player server the player accounts and the full resource handling (net,zones, ecc), and the AI server (which communicates with xml with the planeshift player server) keep calcs of npc and world behaviour.
In this way we can see the planeshift server as a scriptable device.
Ok, now there are only npc. But think of levers, traps, and things like this. This can be done well with a good scripting/AI solution.
Tip : games like Dark age of camelot has three servers and about 3000 simultaneous players. Very often the server crashes, and they have 3 servers. How many players will have planeshift? Only 1000 ? No i don\'t think so. Looking at enemy territory stats you can see how many people play good free games, so when i say \"another server\" or \"more then one server\" and \"separation of concerns\" please think about it :) .

EDIT :

d) keep things as they are if you want to have a very rigid but simple  ai for monsters. But why have 10 little xml language when you can have one good? :)
Loading a resource from the disk (a texture for example) is an action for the engine, but also describe a piece of gui is an action, and also \"start rain in zone x\" is an action, and also \"npc id 3455 engage fight with npc id 5677\". Think about a big interpreter which executes actions in the server, not 10 interpreters for 10 types of thing. For types there are tags, or not? :)

Bye bye!
« Last Edit: April 06, 2004, 08:09:19 pm by bagna »

Androgos

  • Guest
(No subject)
« Reply #8 on: April 06, 2004, 09:02:41 pm »
We are doing C since a time ago

Really, everything you said in C are already being or is implanted
« Last Edit: April 06, 2004, 09:04:02 pm by Androgos »

bagna

  • Wayfarer
  • *
  • Posts: 7
    • View Profile
(No subject)
« Reply #9 on: April 06, 2004, 09:14:31 pm »
C is surely a great language for performance, but is not much scalable.
For a good ai system java is well suited. But anyway, ok C.
But consider the scalability problem : 3000 players with 3 servers, and server crashes. You must consider this issue : is important.
Today xml is the bridge for different languages. Consider distributing the work of the server.

:)

EDIT :

\"We are doing C since a time ago\"
I have not said throw everything away, i said, watching your files (xml only...hahaha), if you want to restructure a part of your architecture, consider one of these ways. :)

Anyway, i\'ll have a look to the code :)

Edit : me stupid ...
« Last Edit: April 07, 2004, 11:43:36 am by bagna »

Vengeance

  • Veteran
  • *
  • Posts: 1452
    • View Profile
(No subject)
« Reply #10 on: April 07, 2004, 07:47:53 am »
It is clear that you do not understand anything you have just read in those files, or in Androgos\' post above.  He said we are already doing YOUR OPTION \"C\" not using C language.

After you read the npcclient code and understand it, please post again and we can try the discussion again.

- Vengeance

bagna

  • Wayfarer
  • *
  • Posts: 7
    • View Profile
(No subject)
« Reply #11 on: April 07, 2004, 11:11:28 am »
Hahahahahah ok sorry :) i\'ll read it :)

EDIT :

i readed the xml files that orogor mentition in his post, but i not the code.

first impression of the code : mmm ... intresting ... :)
« Last Edit: April 07, 2004, 11:42:09 am by bagna »

bagna

  • Wayfarer
  • *
  • Posts: 7
    • View Profile
(No subject)
« Reply #12 on: April 07, 2004, 01:56:51 pm »
Ok :)

Looked at the code in npcclient and header files in net directory.
Now i must write some (personal) impressions, but first define the main actors in my view :

we can distinguish four main types of pc :
PC : real people playing planeshift. Stats, inventory, (position) is kept on the db.

MASTER NPC : they are exactly like pc so their stats, inventory, ecc is kept in the db. They are very important, legendary and powerful (eg. a great evil mage or a king for example).They have a STORY (the evil mage is like saruman for example, is trying to conquer the world for example).They move great forces and they are unique.

MAIN NPC : clan bosses, own groups of \"normal npc\", or a guard general for example. They\'re also kept on the db (with stats and inventory), but have no story.They are not unique.

NORMAL NPC : they have no inventory, common stats for all, and should NOT be saved on the db. The position is kept in memory ONLY and is lost in server crashes. They are usually \"around\" main npc.

----
Three types of network entities :

clients (many) : much cpu, should know HOW to render a mesh , which texture, how much detailed rendering must be, and how to render effects (a spell or an atomical part of it). Use a 3d engine (crystalspace).

player server : one cpu, should keep in a database PC and NPC stats (as described). Should also calculate paths for npc and do math stuff. Should not use engine for rendering but it can use for math.

ai server : one cpu, should tell to the player server what npc do, and what events occur in the planeshift world. Should NOT do math stuff or keep splines for path, should not say where a walking npc is at time x with spline y! Should only say : npc id A move to target B, or npc id R follow path W, and then the server do math calcs.
ai server also assign treasures, handle quests, ecc...
Of course ai ai server send messages to player server and player server send messages to ai server. Ai server should be completely indipendend from 3d engines.

What do you think about these things? Please reply i\'m very intrested in you comments :).
« Last Edit: April 07, 2004, 01:58:40 pm by bagna »

bagna

  • Wayfarer
  • *
  • Posts: 7
    • View Profile
(No subject)
« Reply #13 on: April 13, 2004, 10:07:14 am »
Why no reply? :(

dfryer

  • Veteran
  • *
  • Posts: 1070
    • View Profile
(No subject)
« Reply #14 on: April 14, 2004, 02:23:27 am »
It seems like it is already a solved problem - by using the same interface as npcclient, a java or python based system could be used to handle AI.  I don\'t really understand the appeal of Java in this case- the only thing it really provides over C++ is automatic garbage collection, and that is at a *huge* speed cost.  Other high level languages or specialised languages might be more useful.

I\'m not sure what I think of your divisions of NPC types - I\'m not a dev, but to me it makes sense to have \"general\" AI code (moving around efficiently, fighting) which would be used for any NPC as well as random monsters, and then specifics (like conversation data) for specific instances of NPCs.
Quidquid latine dictum sit, altum sonatur.