Jump to content

Script core improvements


nevelis

Recommended Posts


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  4
  • Reputation:   5
  • Joined:  02/06/12
  • Last Seen:  

I'm embarking on a quest to improve the script engine :D

I think a sensible thing to do is to use flex & bison to do the parsing. I'm going to guess at the near 18,000 lines in script.c, about 3000 of them are involved in parsing, and I think we can reduce that to maybe 100-200. This would simplify the file a lot, it'll help compile times and most importantly: it'll help us extend the language easier.

Work has been done recently (recently being in terms of the project but this was a few months ago :D) to add an assignment operator... I would've thought any language would've added this in the beginnings of its life would've opted to use an operator instead of a keyword to set variables, so I can only guess it took so long because its too damned complicated.

There was also work done on the Lua project to replace the script engine with Lua... I really love the idea but I think it's just completely unrealistic. There are tens of thousands of lines of script source that will probably never be updated, because it works fine the way it is. So if we can decouple the parser, we can improve the language a lot easier and not have to resort to something as drastic as a complete rewrite.

I'm posting here to gauge feeling from the dev team. The idea is to write another parser equal to the current parser, so all existing scripts will function correctly. Does this subproject interest anyone out there?

Cheers!

  • Upvote 4
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   101
  • Joined:  11/13/11
  • Last Seen:  

I always wanted to do this, together with this we could rewrite the script VM in a more prettier way(example: https://github.com/KainEmulator/libadreno/tree/master/src/vm, I created this and it's very similar with eA VM) and maybe use a JIT engine(like Chrome's V8).

I never created a patch for this cause I hate creating parsers :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  4
  • Reputation:   5
  • Joined:  02/06/12
  • Last Seen:  

Bahaha yeah dolan!! Love the avatar. And hell yes, your VM code is easy on the eyes :) really readable, good stuff!

I think we're both in luck :D I've got plenty of experience writing parsers and compilers, so I could definitely write a parser/compiler for eAscript & generate bytecode run on your VM.

Want to team up on this one? :D I'm keen on giving this a decent crack. I'm about halfway through the lexer now, I'll have something up on github soon. I'll PM you my contact details if you want to chat.

LEGENDARY!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

What improvements would this provide for scripts in the game? Or would this just be stability/speed improvements unknown to the user?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  4
  • Reputation:   5
  • Joined:  02/06/12
  • Last Seen:  

@Vach - this is an improvement firstly to the parser (the code that reads script files), and soon the compiler (uses the parser to generate bytecode) & virtual machine (executes the bytecode). It won't change the way your scripts are written and it won't change any of the existing script commands.

It should make it easier for developers to maintain the part of rA that executes scripts though, there may or may not be performance gains. And stability is definitely more important than speed, so if it's easy enough to keep stable then we can tune it for speed later :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

Oh yea, I definitely agree about the stability... I would love that more than anything when I write complicated multi-function depth scripts.

In that case... MORE POWAAAA!!!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

yeah, I have been scripting in this eathena ... rathena crappy script engine for years

I just rep_up.png up <3

gogogo ~

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  112
  • Reputation:   89
  • Joined:  11/12/11
  • Last Seen:  

There was also work done on the Lua project to replace the script engine with Lua... I really love the idea but I think it's just completely unrealistic. There are tens of thousands of lines of script source that will probably never be updated, because it works fine the way it is.

Easier than you would think~

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...