Loading...
  OR  Zero-K Name:    Password:   

train your LUA skills

16 posts, 1255 views
Post comment
Filter:    Player:  
sort

9 years ago
Still bad in writing LUA code? Or you just want to improve?
There you go:
TrAInsported

quote:
TrAInsported is a game about trains, Artificial Intelligence and lots and lots of passengers.


language is LUA. have fun.
+8 / -0
Skasi
Looks cute and really lövely. I'm at Tutorial 2 and already reported two game bugs. I should probably fix them and open Pull Requests, but writing LUA to play the game is more fun than writing LUA to fix the game's bugs. :-|

Isn't it dangerous for people to be running over rails like this? Someone could get hurt!
+0 / -0
9 years ago
Awesome!
+0 / -0


9 years ago
Next step: ZK finally gets the long-awaited train factory!
+3 / -0
Nice find.

It sounds a lot like RoboCode, which I really liked and which made me learn Java the first time.
(RoboCode is quite old programming game where you write Java AI to control a simple robotank)


PS. I like the pun in the thread title :D
+2 / -0
This gave me laugh while watching a live match:


:D
+1 / -0

9 years ago
This looks really neat!

Also:
quote:
You can currently play the game in English, German, Spanish, Finnish, Portuguese, Russian, Turkish and Estonian!

Lol.
+0 / -0
9 years ago
Duh, this is discrimination... I can't write in LUA, so I can't play the game.

I can't... I lack skills... To play... A game...
+0 / -0
Skasi
9 years ago
PLrankFailer, it comes with a tutorial.
+0 / -0
It comes with easy tutorial for all the basics. Even epic PLrankFailer's can learn it.
+0 / -0

9 years ago
looks neat
+0 / -0
After experimenting with it a bit I see its potential, but unfortunately it also has some flaws that make it teach people to write bad Lua code.

It limits the execution of each callin function to a certain number (usually 5000) of lines of code. You can check how much lines you have left using builtin getNumberOfLines() function. The problem is that counting of executed lines of code is implemented in the most braindead way possible and is very abusable.

Some examples:
(it is long) [spoiler]
This counts as 2 lines of code:
quote:
a = 1
b = 2


But at the same time this counts as only one:
quote:
a

1; b

2

Or using nice Lua syntax:
quote:
a, b = 1, 2


From here it only gets worse. These also count as 1 line of code:
[quote]a

{ b

1, c

2, d

{ e

3, f

4}, g = 6 }[/quote]
quote:
if (a == 1) then b

2 else b

3 end

You see where this is going...


The only bottleneck seem to be function calls (which count as 2 lines + whatever is in function body) and loops which count as at least as much as number of iterations they do.
(in the following code I am using triangle brackets instead of square ones to avoid breaking the forum formatting)

So a loop like this:
[quote]for i

1, 5 do a<i>

2 * i end[/quote]Counts as 5 lines of code, which is the minimum.

But you must be careful with these, because:
[quote]for i = 1, 5 do
a<i> = 2 * i
end[/quote]already counts as 10 lines.

While the noob way:
quote:
a<1>

2; a<2>

4; a<3>

6; a<4>

8; a<5> = 10
counts as only one!
[/spoiler]

All of this leads the code of top-performing bots to look like this:

Which doesn't really help code readibility and reusability...
+3 / -0

9 years ago
Imagine all those unused Free Line Break Coupons!
+2 / -0


9 years ago
Finished the three town challenges, but my primitive navigation code can't deal with dead ends. At all.
Do the pros secretly all have an A* implementation or something?
+0 / -0
I have implemented Flood Fill Dijkstra's algorithm so far :P
+0 / -0
quote:
I have implemented Dijkstra's algorithm so far :P

then you are 75% done with A*. Just add a heuristic so it checks through the unvisited nodes in proper order and you're done.
+1 / -0