Lua vs cob - Page 3

Lua vs cob

Various things about Spring that do not fit in any of the other forums listed below, including forum rules.

Moderator: Moderators

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Lua vs cob

Post by Forboding Angel »

zwzsg wrote:
Tobi wrote:Yeah for next release I'll remove COB, even if it's just to pester you :twisted:
I wouldn't be the most pestered.

In fact I would welcome it, as that would mean the death of BA. :mrgreen:
I have to say, he has a compelling argument ;p
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Lua vs cob

Post by KDR_11k »

It's easier to learn the entirety of the BOS system compared to the entirety of the Lua system but that's just because BOS is so stupidly simple that trying to go beyond the simplest things will require a lot of hacking and ingenuity. It's like arguing Milkshape 3D vs Blender. MS3D has a much simpler GUI and everything but you'll run into the limits so fast you'll waste more time working against the GUI than with it.

Honestly the only reason I'm still using BOS is because I still haven't bothered to learn the Lua equivalents but if you look into my BOS code these days you'll rarely ever find a unit that does not have some extensive Lua hooks for things you can't do with BOS alone. With pure Lua the interface would be simplified, the number of files involved reduced and likely the workload for maintenance reduced (if you want to change e.g. the behaviour of the mass drivers perk in THIS you have to recompile almost every BOS in the game even though the values are centralized in a .h).
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Lua vs cob

Post by CarRepairer »

KDR_11k wrote:Honestly the only reason I'm still using BOS is because I still haven't bothered to learn the Lua equivalents
Are you familiar with the transformation mapping of the set of lowercase letters to uppercase letters? :P
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Lua vs cob

Post by zwzsg »

Code: Select all

Spring.UnitScript.Turn ( p, 1, 0)

turn p to x-axis <0> now;
Not just a case of case.

That is the second time you made snide remarks based on pure lies and disinformation.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Lua vs cob

Post by FLOZi »

zwzsg wrote:

Code: Select all

Spring.UnitScript.Turn ( p, 1, 0)

turn p to x-axis <0> now;
Not just a case of case.

That is the second time you made snide remarks based on pure lies and disinformation.

Code: Select all

Turn(p, x_axis, 0)
Most functions are pre-localised, and there are named variables for the axes.

Who is spreading disinformation again?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Lua vs cob

Post by zwzsg »

So,

Code: Select all

Turn(p, x_axis, 0)

Turn p to x-axis 0 now;
Still far from the transformation mapping of the set of lowercase letters to uppercase letters. :P
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Lua vs cob

Post by CarRepairer »

zwzsg wrote:So,

Code: Select all

Turn(p, x_axis, 0)

Turn p to x-axis 0 now;
Still far from the transformation mapping of the set of lowercase letters to uppercase letters. :P
Man you must think KDR is a complete moron to say this is too complex. I was making a little joke to illustrate the point that he could learn the lua formats in almost no time at all.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Lua vs cob

Post by Forboding Angel »

Code: Select all

Turn(p, x_axis, 0)
A perfect example of easy to read syntax!!!! Because well, that ^^ is so much easier to tell what it does than this:

Code: Select all

Turn p to x-axis 0 now;
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Lua vs cob

Post by Tobi »

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Lua vs cob

Post by Forboding Angel »

Nice, you forgot adding subsequent weapons and emitting weapons as well as ceg's though.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Lua vs cob

Post by Tobi »

A stumpy only has one weapon ...
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Lua vs cob

Post by zwzsg »

Nice tutorial! Image
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Re: Lua vs cob

Post by Das Bruce »

Tobi wrote:A stumpy only has one weapon ...
I think he means as lessons.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Lua vs cob

Post by Tobi »

zwzsg wrote:Nice tutorial! Image
Thanks.
Das Bruce wrote:
Tobi wrote:A stumpy only has one weapon ...
I think he means as lessons.
Yeah I know, that's for another time though.

He can't seriously expect me to cramp everything into a single tutorial :P

Maybe I'll make some example sometime where the power of Lua over BOS truely shines.

In the mean time I licensed the post as CC-BY-SA-3.0 so you may actually use the code or improve the tutorial. Also I would accept tutorial submissions if anyone is interested. They have to be written in markdown, sources are here.
User avatar
ScarySquirrel
Posts: 82
Joined: 29 Apr 2007, 04:25

Re: Lua vs cob

Post by ScarySquirrel »

Wait, coberrors are from *drumroll* COBOL?
As in, COBOL cobol?
Holy... the things you learn.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Lua vs cob

Post by Tobi »

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

Re: Lua vs cob

Post by AF »

COBOL is a ghastly language, here is Hello world in cobol:

Code: Select all

      IDENTIFICATION DIVISION.
      PROGRAM-ID. HELLO-WORLD.
      PROCEDURE DIVISION.
          DISPLAY 'Hello, world'.
          STOP RUN.
Here is hello world in DOS:

Code: Select all

echo Hello World
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Re: Lua vs cob

Post by Das Bruce »

AF wrote:DOS is a programming language
Whut.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Lua vs cob

Post by Forboding Angel »

Das Bruce wrote:
AF wrote:DOS is a programming language
Whut.
I suppose you could call batch scripts programming, in the absolute loosest(<-- fail grammar) form of the term.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Lua vs cob

Post by zwzsg »

Stumpy is the archetypal RTS unit. A generic bland tank, with a body, a turret, a gun. It's the perfect choice for a tutorial, with just a little animation to show turn and move in context, while staying very simple. And it's directly portable to 90% of units.

Adding more weapons "is left as an exercise for the readers". For weapons on separate turrets, I hope anybody can figure the 1 in function name becomes a 2 for the second weapon. Though some explanation for the signal would be useful. The bitmask thing is not obvious. For weapons sharing the same turret, they'd require advanced scripting. For one weapon spread over two parallel barrels on the same turret, hmm, yeah, it's common enough that you'd want a tutorial on that. But it would still be lesson 2. Lesson 1 has to be kept simple!

It's true that a new tutorial, on new unit scripting method, should not use a hide/show flare but a CEG. I guess Tobi wanted to stay close to the Cavedog scripts roots, or to avoid having to explain how to add CEG to a unit definition. Miss the hide in the create btw.

Well, in the end, praise upon Tobi for writing that tut, and shame upon me and other ranters for disparaging instead of feeding teh wiki.
Post Reply

Return to “General Discussion”