Page 9 of 22

Re: trAInsported: Alpha testers needed

Posted: Wed Feb 27, 2013 2:53 am
by substitute541
Germanunkol wrote: Edit: New animated auto-generated .svg files now display the results of every match! http://trainsportedgame.no-ip.org/index.php


Image Image

Edit 2: Tutorial 3 was broken (was using old ai functions). It's fixed in the new download.
My AI rivals Phoenix! Ironically, Phoenix is my real first name :P

Edit: When the passengers-time line of my AI (icrawler_test) levels out, it usually means it's stuck in a perpetual loop.

Re: trAInsported: Alpha testers needed

Posted: Wed Feb 27, 2013 5:12 am
by xXxMoNkEyMaNxXx
attempt to call a nil value

Code: Select all

		for i,_ in next,map do
Why is there no next function in the sandbox ._.
Be sure to include:
-pairs
-ipairs
-unpack
-next
-type
-loadstring
-select
-setmetatable
-getmetatable
-tonumber
-tostring
-getfenv
-coroutine
-newproxy
-table.concat

EDIT: I looked in the file and crossed out the ones you included, and you misspelt string.byte.

Thanks :I

Re: trAInsported: Alpha testers needed

Posted: Wed Feb 27, 2013 8:54 am
by Germanunkol
I can't include setmetatable and getmetatable. They're considered unsafe... sadly.
http://lua-users.org/wiki/SandBoxes
If you know of a workaround, please let me know! Because many modules use this function... and I wanted to be able to include modules as a player.
substitute541 wrote: Edit: When the passengers-time line of my AI (icrawler_test) levels out, it usually means it's stuck in a perpetual loop.
I saw that happen, yes. Maybe add a slight change of it going into a random direction? That's how my testAI does it.

Otherwise, you'd need to add a full-blown pathfinding I guess. Which would be the clean solution, of course :D

Re: trAInsported: Alpha testers needed

Posted: Wed Feb 27, 2013 9:15 am
by substitute541
Apparently, a new version of TestAI by Germanunkol has been released. Recently, it beaten both my new version of Dark_Blue -- Light_Cyan -- and phoenix.

Also, here's a suggestion for the brand logo stuff : Box matrix. By that I mean a grid of boxes, each with a certain color, which is contained in a matrix (color[x][y] == {255, 255, 255} for example). Of course, that would be more like pixel art, but atleast it's better. According to my calculations, the maximum amount of bytes that it can carry are 3*width*height, or, if it's a square, 3 * side^2.

Re: trAInsported: Alpha testers needed

Posted: Wed Feb 27, 2013 11:41 am
by Germanunkol
xXxMoNkEyMaNxXx wrote: Why is there no next function in the sandbox ._.
Be sure to include:
-pairs
-ipairs
-unpack
-next
[...]
I added many of the functions you wanted, though not all. As I said, getenv, setmetatable etc are considered unsafe, and at this point I don't know how to avoid that. New functions will be in the next update - I made a wiki page for this: http://trainsportedgame.no-ip.org/wiki/ ... =AISandbox
substitute541 wrote:Apparently, a new version of TestAI by Germanunkol has been released. Recently, it beaten both my new version of Dark_Blue -- Light_Cyan -- and phoenix.
It's the same one as before. TestAI does a lot of random stuff, that's why sometimes it does good and sometimes it does bad. Also, (and I think this is similar to your AI's approach) it does very good if there are a lot of connections between places. If there's only one path, then it often does poorly, because it won't find it and it'll get stuck in dead ends.
Hint: You can check out all AIs by appending /upload/ai to the end of the url: http://trainsportedgame.no-ip.org/upload/ai/
Leonard, Sheldon, Admin, Rajesh and Howard are all test users and all use the same AI.
substitute541 wrote: Also, here's a suggestion for the brand logo stuff : Box matrix. By that I mean a grid of boxes, each with a certain color, which is contained in a matrix (color[x][y] == {255, 255, 255} for example).
That's not a bad Idea, as it would be easy to send to the other players... I used this in my previous game, WikiBasedRPG
Even cooler would be, if this boxmatrix would automatically be generated from a 32 by 32 px image that the user uploads... Should be possible and not that hard to implement.

Re: trAInsported: Alpha testers needed

Posted: Wed Feb 27, 2013 12:47 pm
by substitute541
Working on a newer AI that incorporates Pathfinding called Dragonfly (as dragonflies can hover and choose the path they want to go precisely). As for the image-to-matrix conversion, that would be easy, just manipulate the imagedata or something.

Edit: Speaking of which, are you micha or something? Or is that a word in the dictionary.

Re: trAInsported: Alpha testers needed

Posted: Wed Feb 27, 2013 2:36 pm
by Germanunkol
substitute541 wrote:As for the image-to-matrix conversion, that would be easy, just manipulate the imagedata or something.
Yeah, I think that'll work.
substitute541 wrote: Edit: Speaking of which, are you micha or something? Or is that a word in the dictionary.
Uhm. I am... how do you know?

Re: trAInsported: Alpha testers needed

Posted: Thu Feb 28, 2013 2:27 am
by substitute541
Germanunkol wrote:
substitute541 wrote:As for the image-to-matrix conversion, that would be easy, just manipulate the imagedata or something.
Yeah, I think that'll work.
substitute541 wrote: Edit: Speaking of which, are you micha or something? Or is that a word in the dictionary.
Uhm. I am... how do you know?
I saw your name in the Ubuntu file explorer...* :P

Edit: *that is, in the introduction video.

Edit 2: And, here's my notes for Dragonfly.
https://dl.dropbox.com/u/105405645/Pict ... 0Notes.png

Edit 3: Could you add, in the next update, a tag for, not just rails, but junction points and corner tracks? I really find that useful for A* pathfinding (which I'm trying to implement >_>)

Re: trAInsported: Alpha testers needed

Posted: Thu Feb 28, 2013 10:40 am
by substitute541
OMG LOL, THIS HAS HAPPENED RECENTLY.

Image

Re: trAInsported: Alpha testers needed

Posted: Thu Feb 28, 2013 2:19 pm
by Germanunkol
Haha, yes, that happens. That's why there's the function ai.blocked so you can check if a train fails to continue. Say, for example, if the train is blocked for more than 10 seconds, you can decide to let it try another path (or not).

For the junction thing, you can easily do that yourself. Simply try something like this (code is untested!):

Code: Select all

-- return a table with all the junctions in the map:
function findJunctions(map)
	t = {}
	for i = 1, map.width do
		t[i] = {}
		for j = 1, map.height do
			if map[i][j] == "C" then
				if map[i-1][j] == "C" or map[i+1][j] == "C" or map[i][j-1] == "C" or map[i][j+1] == "C" then
					t[i][j] = true
				end
			end
		end
	end
	return t
end
Note that this only works safely because the map actually goes from i = 0 to map.width+1 (so there's an empty space on the left and right, as well as on the top and bottom of the map). Otherwise, map[i-1][j] or map[i+1][j] etc. could give you problems.

Does this help?