Progress on scripting engine

Everything related to the code /
Tout ce qui touche au code
Post Reply
User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Progress on scripting engine

Post by zuzuf » Sun Jun 07, 2009 1:51 am

So how is this going ? Well, we have support for both COB and Lua scripts.

You can script AIs, missions and units. There is now a console interface for debugging mission and AIs scripts (Lua only but COB scripts are not applicable to those kinds of scripts anyway).
This new scripting engine introduced a big performance loss because of the abstraction layer lacking some optimizations. Good news, it's been fixed in last revision (along with lots of other bugs in LuaThread).

So what's the secret of speeding up those scripts ? In fact scripts run quite fast, what was slow was starting a script because it involved creating a new ScriptInterface object which is slow for COB scripts and much worse for Lua scripts since it almost creates a new VM. So finally recycling our garbages solved the problem :D. Instead of creating and releasing those threads, they are only created when needed, once they're useless they're removed from the execution stack and stored into a freeThread queue where we'll take them later when we need some ScriptInterface thread to run a script function.

I can now run a game with hundreds units fighting at 10x speed !! (before this optimization it slowed down to 1x or lower :( - those results are with a binary built without optimization in a debugger :P ).

Performance is back :twisted:
=>;-D Penguin Powered

xpoy
Posts: 669
Joined: Mon Sep 22, 2008 3:55 am

Re: Progress on scripting engine

Post by xpoy » Sun Jun 07, 2009 5:38 am

Performance is back :twisted:

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Re: Progress on scripting engine

Post by Balthazar » Sun Jun 07, 2009 7:10 am

Perfomance is back!

:P

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests