NoAI Branch - An AI Framework
Moderator: OpenTTD Developers
Re: NoAI Branch - An AI Framework
Swallow,
I just tried your Apollo in the first zip you posted, but I did not see your problem. Lots of signs were build, and they all were correct. ( I am using a self compiled NoAI version, on Gentoo Linux)
Maybe there's a problem with your installation.
I just tried your Apollo in the first zip you posted, but I did not see your problem. Lots of signs were build, and they all were correct. ( I am using a self compiled NoAI version, on Gentoo Linux)
Maybe there's a problem with your installation.
Re: NoAI Branch - An AI Framework
Just had a look at Convoy - does perform quite well with all its buses. A couple of the times it attempted a route were abandoned in the last 10 tiles or so due to running out of funds.
It got confused by slopes once or twice too. ^ Seemed a pity it didn't make it
It got confused by slopes once or twice too. ^ Seemed a pity it didn't make it

This is my sig
Re: NoAI Branch - An AI Framework
It tried to do turn on slope, which is not possible... (well, it is, but in the other direction)
Re: NoAI Branch - An AI Framework
Works flawless here and on any other computer I tried... make sure you have the most recent binaries.Swallow wrote:attached is a zip file containing a WIP info.nut and main.nut. The sign is placed at line ~57.
After some more testing the problem doesn't seem to occur always. In a small test 10 signs were placed. 7 of them showed the correct text, while 3 incorrectly displayed "Apollo". Kinda strange![]()
Tomorrow I will do some further testing....
The only thing necessary for the triumph of evil is for good men to do nothing.
Re: NoAI Branch - An AI Framework
I updated my scource to rev 13265. I had installed a program however that made itself the default program to open .vbs files, so the version detection failed. I changed some settings so MSVC++ 2008 opens them, but i'm not sure whether this is correct. Compiling succeeded, but it was labeled rev 13197-noai (my previous rev) instead of 13265. This should not affect the game though, I guess ?! (i'm far from experienced with this)TrueLight wrote:make sure you have the most recent binaries.
The sign problem still persists, but because a) I seem to be the only one experiencing it, b) it is not the most life-threatening thing and c) most of the signs are correct I decided to drop the issue. It may be better to stop focusing on signs and make an AI that builds something useful

(Note: this may be fixed in r13268, haven't had the time to recompile and test yet)
Also I'd like to report a bug. (As a side note, should I report them here or at bugs.openttd.org ?) I did the following:
- start a new random map game
- start my AI
- 'abandon game'
- start a new random map game again
- start my AI. <<Here the game crashes to desktop. Crash log attached
- Attachments
-
- bug report.txt
- (6.73 KiB) Downloaded 152 times
Create your own NewGRF? Check out this tutorial!
Re: NoAI Branch - An AI Framework
i had the same problem...
Re: NoAI Branch - An AI Framework
So did I, but since today it's solved (see details in the checkin log).Swallow wrote:[
Also I'd like to report a bug. (As a side note, should I report them here or at bugs.openttd.org ?) I did the following:
- start a new random map game
- start my AI
- 'abandon game'
- start a new random map game again
- start my AI. <<Here the game crashes to desktop. Crash log attached
Re: NoAI Branch - An AI Framework
Both problems are indeed fixed. The sign-problem was because of some internals of Windows builds. That is fixed now. Strangely enough, it never appeared on the tests I did on the windows builds. Lucky for you, glx could reproduce is
The sign-problem is fixed after the binaries were produced for today, so you have to wait an other 18 hours (from this post-time), or compile it yourself, to benefit from the fix 
Btw, the revision SVN indicates is rarely the revision OpenTTD displays for the NoAI branch. This is because for the revision OpenTTD displays, that revision is used which had the last change in the NoAI branch, and not the latest revision in SVN (which has many more commits
).


Btw, the revision SVN indicates is rarely the revision OpenTTD displays for the NoAI branch. This is because for the revision OpenTTD displays, that revision is used which had the last change in the NoAI branch, and not the latest revision in SVN (which has many more commits

The only thing necessary for the triumph of evil is for good men to do nothing.
Re: NoAI Branch - An AI Framework
Just a quick one... the build of r13265 isn't saving my changes to game options, which makes it difficult to test the AI. Is this a bug or just me being dumb?! It worked fine in r13057.
There is also a crash if I open the "Configure Patches" window. I have logged a bug for that one (#2044).
Cheers.
Edit: Oh dear god, my productivity has been completely annihilated with r13265. It never saves my settings, so it takes 5 times as long to reload when changing the code (and no I can just use the AI Debug window as I rely heavy on signs for tile based debugging, which aren't removed).
Edit: ARGH! Sorry it was crashing when the AI started too, but because of my code! I think there might be a problem with the Squirrel engine. I'll make a post about that later.
There is also a crash if I open the "Configure Patches" window. I have logged a bug for that one (#2044).
Cheers.
Edit: Oh dear god, my productivity has been completely annihilated with r13265. It never saves my settings, so it takes 5 times as long to reload when changing the code (and no I can just use the AI Debug window as I rely heavy on signs for tile based debugging, which aren't removed).
Edit: ARGH! Sorry it was crashing when the AI started too, but because of my code! I think there might be a problem with the Squirrel engine. I'll make a post about that later.
PathZilla - A networking AI - Now with tram support.
Re: NoAI Branch - An AI Framework
Hi guys, I'm now hooked on NoAI aswell 
Actually I haven't made any serious attempt to make a whole, complete AI yet, but rather a .nut file with various helper functions, like e.g. a wrapper function for functions like SetCompanyName, which may fail; the wrapper function will then try again with a number appended until it succeeds
(xy #2, xy #3, ...)
For now, I've got some feedback for the devs..
First I must say that the Framework until now is very clear and understandable, congrats on that!
It's very easy to get into this 
Now something I've noticed, a little inconsistent: AIRoad.BuildRoad(...) is supposed to build from the middle of the start tile to the middle of the end tile. But if one of them is a slope, it will be fully built on (of course, slopes don't have half road tiles). BUT - if I now use RemoveRoad, which is also only supposed to remove from the middle of the starttile to the middle of the endtile, I have some artifact on the upper part of the slope left.
I think that's not right.. BuildRoad(a, b) and then RemoveRoad(a, b) should result in the same state as it was before building.
Oh, and I'm really looking forward to the TransactionMode.
I wanted to try it out, only then noticed in the API that it's not finished yet 
Well for now I've written my own workaround function for that

Actually I haven't made any serious attempt to make a whole, complete AI yet, but rather a .nut file with various helper functions, like e.g. a wrapper function for functions like SetCompanyName, which may fail; the wrapper function will then try again with a number appended until it succeeds

For now, I've got some feedback for the devs..
First I must say that the Framework until now is very clear and understandable, congrats on that!


Now something I've noticed, a little inconsistent: AIRoad.BuildRoad(...) is supposed to build from the middle of the start tile to the middle of the end tile. But if one of them is a slope, it will be fully built on (of course, slopes don't have half road tiles). BUT - if I now use RemoveRoad, which is also only supposed to remove from the middle of the starttile to the middle of the endtile, I have some artifact on the upper part of the slope left.
I think that's not right.. BuildRoad(a, b) and then RemoveRoad(a, b) should result in the same state as it was before building.
Oh, and I'm really looking forward to the TransactionMode.


Well for now I've written my own workaround function for that

Re: NoAI Branch - An AI Framework
How do you guys use try/catch in squirrel?
Re: NoAI Branch - An AI Framework
Roujin wrote: like e.g. a wrapper function for functions like SetCompanyName, which may fail; the wrapper function will then try again with a number appended until it succeeds(xy #2, xy #3, ...)
Mine uses two arrays, and randomly chooses words from them to form a two part company name. So no numbers attached, as there are far more possible combinantions, than possible players

Re: NoAI Branch - An AI Framework
Woops, I didn't add an identifierRoujin wrote:Tried Squirrel Manual?

Re: NoAI Branch - An AI Framework
Hey hey
I found this today, far too much time and about 200 lines of code later, I had a bus finally make some money. Is there any kind of library around with extra helper functions? Things like returning the direction with GetNeighbourRoadCount and finding Adjacent/Offset tiles would be very helpful.
Can't wait to try my hand at railways.
-R
I found this today, far too much time and about 200 lines of code later, I had a bus finally make some money. Is there any kind of library around with extra helper functions? Things like returning the direction with GetNeighbourRoadCount and finding Adjacent/Offset tiles would be very helpful.
Can't wait to try my hand at railways.
-R
Re: NoAI Branch - An AI Framework
I have looked at the Squirrel manual and there is just about no information there. What is there is VERY difficult to understand.Roujin wrote:Tried Squirrel Manual?
-
- Engineer
- Posts: 72
- Joined: 09 Apr 2006 23:49
- Location: UK
- Contact:
Re: NoAI Branch - An AI Framework
I think it lacks some examples but it's pretty much core programming material which doesn't require much in the way of examples (try/catch, loops, statements, returns, functions, classes...).
Will be worth expanding on the wiki in time though.
Will be worth expanding on the wiki in time though.
Finaldeath
Re: NoAI Branch - An AI Framework
Yeah the Squirrel documentation is sparse. I agree with Finaldeath that it would be to perhaps expand the Wiki with our observations about Squirrel, so we can help each other understand it.paullb wrote:I have looked at the Squirrel manual and there is just about no information there. What is there is VERY difficult to understand.Roujin wrote:Tried Squirrel Manual?
I haven't tried exception handling yet, but it says "Any value can be thrown.". I'd imagine you can so something like this...
Code: Select all
/* THIS IS JUST A SUGGESTION - I HAVE NO IDEA IF THIS WILL EVEN WORK! */
// Integer constants for reference - These should ideally be class members
EXC_N_TOO_SMALL <- 1
EXC_N_TOO_BIG <- 2
function NastyFunction(n) {
if(n < 0) throw ::EXC_N_TOO_SMALL;
if(n > 5) throw ::EXC_N_TOO_BIG;
return n/2;
}
function InnocentBystander(in) {
try {
NastyFunction(in);
} catch(exc) {
if(exc == ::EXC_N_TOO_SMALL) {
print("Please choose a bigger number");
} else if(exc == ::EXC_N_TOO_BIG) {
print("Please choose a smaller number");
}
}
}
PathZilla - A networking AI - Now with tram support.
Re: NoAI Branch - An AI Framework
I have a separate, simple question about the API.
I finally have my AI running services and turning a small profit. There's a long way to go yet, but its looking good! I'd also like to say a huge thank you to the devs for the NoAI branch! It really is a pleasure to work with.
My question is about orders. When I want to create a fleet of N vehicles I start with a prototype and then just clone it N-1 times with shared orders. The trouble is that the vehicles all go to the same station, which leads to poor utilisation of resources on the service as a whole. I'd like to be able to balance the load to make the service more efficient, but still be able to use shared orders. The way I do this when playing is just just tell half the vehicles to skip the first station, that way they keep the exact same list of orders.
Is there some way to tell a vehicle to skip an order with the API, and if not do you think it would be possible to implement it (I'd put in a feature request)?
Thanks.
I finally have my AI running services and turning a small profit. There's a long way to go yet, but its looking good! I'd also like to say a huge thank you to the devs for the NoAI branch! It really is a pleasure to work with.

My question is about orders. When I want to create a fleet of N vehicles I start with a prototype and then just clone it N-1 times with shared orders. The trouble is that the vehicles all go to the same station, which leads to poor utilisation of resources on the service as a whole. I'd like to be able to balance the load to make the service more efficient, but still be able to use shared orders. The way I do this when playing is just just tell half the vehicles to skip the first station, that way they keep the exact same list of orders.
Is there some way to tell a vehicle to skip an order with the API, and if not do you think it would be possible to implement it (I'd put in a feature request)?
Thanks.
PathZilla - A networking AI - Now with tram support.
Re: NoAI Branch - An AI Framework
AIVehicle.SkipToVehicleOrder(vehicle_id, order_id);Zutty wrote: Is there some way to tell a vehicle to skip an order with the API, and if not do you think it would be possible to implement it (I'd put in a feature request)?
Reading is challange



The only thing necessary for the triumph of evil is for good men to do nothing.
Who is online
Users browsing this forum: No registered users and 9 guests