Lua as replacement for BOS/COB

Lua as replacement for BOS/COB

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Projectiles

Post by AF »

tbh a full lua solution would be best if only so that oneday when lua animation is possible, we need not bother with cob at all
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Projectiles

Post by Tobi »

AF wrote:tbh a full lua solution would be best if only so that oneday when lua animation is possible, we need not bother with cob at all
will be in 0.80
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Projectiles

Post by AF »

aha =) What details or APIs can be expected and how can we expect lua animations to be structured? Will it basically eb a cob/bos clone mish-mashed with a gadget? Or is there room for a different paradigm (not referring to IK)

A design if you will

edit:: and perhaps a thread fork too
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Projectiles

Post by Pxtl »

iirc, they already said it will be totally unrelated with the gadget handler - it will not run inside the same Lua instance. It will just be COB written in Lua of BOS.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Projectiles

Post by Tobi »

Don't know who said that but he's wrong.

It will run in LuaRules Lua state. However, it will not use the gadget handler for callIns.

I plan to provide docs at some point, don't feel like typing them out in this post, but in very short I refactored Spring so there's a CUnitScript which can have any implementation.

I created three, CCobInstance, CLuaUnitScript and CNullUnitScript. LuaRules code can then replace a unit's script with a CLuaUnitScript.
(a framework is to be written for this, because with Lua unit scripts, the engine does not manage threads, but the framework should manage them, using coroutines.)

Callouts are very similar to COB although I removed all WTFs I found. (inverted X axis, TA angles (now radians), etc.)

For more either ask specific questions or just wait a bit till I made more documentation.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Lua as replacement for BOS/COB

Post by Tobi »

Split from projectile discussion.

Feel free to ask questions about this new feature, which will be in 0.80 if it's up to me.
User avatar
thesleepless
Posts: 417
Joined: 24 Oct 2007, 04:49

Re: Lua as replacement for BOS/COB

Post by thesleepless »

this sounds great, and long overdue for spring.
finally we'll be able to develop units on linux natively =)
looking forward to it.
User avatar
Agon
Posts: 527
Joined: 16 May 2007, 18:33

Re: Lua as replacement for BOS/COB

Post by Agon »

I plan to provide docs at some point, don't feel like typing them out in this post, but in very short I refactored Spring so there's a CUnitScript which can have any implementation.
Cool, Does this mean I can make a Mono implementation for C# ?
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Lua as replacement for BOS/COB

Post by Pxtl »

Agon wrote:
I plan to provide docs at some point, don't feel like typing them out in this post, but in very short I refactored Spring so there's a CUnitScript which can have any implementation.
Cool, Does this mean I can make a Mono implementation for C# ?
iirc, Mono is really hard to sandbox. So if you did, it would be a security issue.
User avatar
Agon
Posts: 527
Joined: 16 May 2007, 18:33

Re: Lua as replacement for BOS/COB

Post by Agon »

Yeah, seems so :cry:
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Lua as replacement for BOS/COB

Post by Tobi »

I would highly doubt the use of mono for unit scripting.

I meant it should be easier now to plug in entirely new ways to animate units. (e.g. skeletal animation, inverse kinematics)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Lua as replacement for BOS/COB

Post by Argh »

Yay!
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Re: Lua as replacement for BOS/COB

Post by jcnossen »

I would highly doubt the use of mono for unit scripting.
If someone wants to make it, what's the point of blocking?
BTW, Unity is using mono commercially as its primary scripting platform, so some people find it good enough...
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Lua as replacement for BOS/COB

Post by Tobi »

jcnossen wrote:
I would highly doubt the use of mono for unit scripting.
If someone wants to make it, what's the point of blocking?
BTW, Unity is using mono commercially as its primary scripting platform, so some people find it good enough...
I wouldn't block it but IMO it's a total waste of time.

Just consider, all LuaRules/LuaGaia code can _not_ be written in mono, and then you start making unit animation scripts in mono? It's the wrong tool for the wrong job...

If anything I'd first make it possible to write AIs in mono (or did we have that already?)

When that has stabilized one could redo LuaUI, LuaRules and LuaGaia in mono (boring pointless work but I won't block it), and only then it makes sense to do unit animations in mono too.

(But IMO time is far better spent actually making better ways to animate units then manually typed move and turn commands in yet another language.)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Lua as replacement for BOS/COB

Post by Argh »

But IMO time is far better spent actually making better ways to animate units then manually typed move and turn commands in yet another language.
+ 1
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Lua as replacement for BOS/COB

Post by bobthedinosaur »

Are there any lua text editors that can run a bug check since there is no compiling? Im just imagining the transition to be hard from working with scriptor for so long.
User avatar
thesleepless
Posts: 417
Joined: 24 Oct 2007, 04:49

Re: Lua as replacement for BOS/COB

Post by thesleepless »

bobthedinosaur wrote:Are there any lua text editors that can run a bug check since there is no compiling? Im just imagining the transition to be hard from working with scriptor for so long.
just run it through the lua commandline interpreter and it'll tell you whether there are any syntatical errors
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Lua as replacement for BOS/COB

Post by Tobi »

This is merged in master now.

Framework and documentation still needs to be written so it can not easily be used currently, but it gives nice opportunity to see if it happens to break COB or other things as side effect.

For the brave/curious people, in this file there is a big comment that could be considered prototype documentation :-)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Lua as replacement for BOS/COB

Post by FLOZi »

Why number axes?
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Lua as replacement for BOS/COB

Post by yuritch »

You can define some vars like x_axis=1, y_axis=2, z_axis=3 and use those instead. Everything being numbers is good, now it's possible to loop through them for ex. (though I don't know why one would want to do this).
A sample tank script (so it's not very complex) using this new system would be good, I'm still not sure how exactly I should do wait-for-turn with it based on those comments.
Post Reply

Return to “Engine”