Why don't large UFO's ever land on the AI's tracks?

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Xandros
Engineer
Engineer
Posts: 8
Joined: 23 Jun 2009 10:18

Why don't large UFO's ever land on the AI's tracks?

Post by Xandros »

Maybe they do, but I've never seen them do it, since I have the newspaper tell me about disasters, whenever the "UFO lands near Wossname!" article comes up the damn thing has always picked my track to land on even though I generally always play with the AI. Not only that but it always seems to land on the exact same section of track (having rebuilt it the last time). Once, I even completely reshaped the land and moved the entire track into a tunnel thinking it would fly right over the top of it. You know what it did? It changed direction and landed at the mouth of the tunnel!

Couldn't it be made to land on any random bit of track regardless of who owns it? It would probably be a bit much to ask for it to randomly land anywhere since on larger maps it would probably keep landing in the middle of nowhere and I expect some would argue "where's the fun in that".

I know I could just turn disasters off but I like to have a bit of disaster every now and then to give me something to quickly fix or what have you (seeing as most of the other disasters are somewhat benign and involve you just replacing a destroyed vehicle or bit of track/road), however the LUFO's seem to be too predictable and repetitive... Landing on the same bit of my track over and over...
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Yexo »

It doesn't land on AIs tracks because the AI can't handle it. About it being predictable, seems you just have bad luck, as the tile chosen is random.
Xandros
Engineer
Engineer
Posts: 8
Joined: 23 Jun 2009 10:18

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Xandros »

Well now you have NoAI surely the AI developers could accommodate in their code for the AI to rebuild destroyed track?

And are you sure the code for making it random isn't broken, I really doubt the UFO landing on exactly the same piece of track every single time it spawns is just down to my bad luck.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Yexo »

Xandros wrote:Well now you have NoAI surely the AI developers could accommodate in their code for the AI to rebuild destroyed track?
It's still hard, it probably comes down to storing every piece of track you ever build, so when it's destroyed you can rebuild it.
And are you sure the code for making it random isn't broken, I really doubt the UFO landing on exactly the same piece of track every single time it spawns is just down to my bad luck.
Can you show a savegame where the UFO lands on the same piece of track every time?
Xandros
Engineer
Engineer
Posts: 8
Joined: 23 Jun 2009 10:18

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Xandros »

Yexo wrote:It's still hard, it probably comes down to storing every piece of track you ever build, so when it's destroyed you can rebuild it.
Well, if it were too difficult to implement it that way you could just make it so AI's know when a vehicle is lost or in negative profit and simply deletes the problem vehicle long with any stations tied to that vehicle assuming any other vehicles also tied to it aren;'t also in negative profit or lost. At least then it doesn't have to save every track location into a reference file.
Can you show a savegame where the UFO lands on the same piece of track every time?
I could have done, had I not deleted all the autosaves all and started fresh the other day. I never thought this was a bug I just thought it was by design otherwise I would have kept a save. I'll run another game and post back with it.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Yexo »

Xandros wrote:
Yexo wrote:It's still hard, it probably comes down to storing every piece of track you ever build, so when it's destroyed you can rebuild it.
Well, if it were too difficult to implement it that way you could just make it so AI's know when a vehicle is lost or in negative profit and simply deletes the problem vehicle long with any stations tied to that vehicle assuming any other vehicles also tied to it aren;'t also in negative profit or lost. At least then it doesn't have to save every track location into a reference file.
So if the AI had constructed a small network, and 10 from it's total of 20 trains couldn't find a route anymore, it should just remove half it's trains?
Xandros
Engineer
Engineer
Posts: 8
Joined: 23 Jun 2009 10:18

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Xandros »

Well, yea, if they go into negative profit for a few years consecutively. Would you leave half your trains running forever more if they were lost and kept procuring negative profits?

Edit: alternatively, if a UFO lands on the AI's tracks when it gets blown up the coordinates of any track/road owned by an AI competitor that was destroyed could be recorded and the AI could then be fed those coords so it could rebuild the lost track/road.

Therefore no need for the AI to memorize every track placement, just the ones that got destroyed by the UFO, or for that matter any other possible disaster that would cause destruction of surround area like mine subsidence. No need for it to go into complex decisions about what to do with negative income vehicles (although to be honest that is something it should still deal with but, that's a topic for the NoAI forum I figure).
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Eddi »

Yexo wrote:About it being predictable, seems you just have bad luck, as the tile chosen is random.
back when i played with disasters (long time ago... something 0.4-ish) i also had the ufos repeatedly land on the same spot... maybe the chosen destination is not as random as you'd like it to be.

i don't know how the tile is chosen, but given that only a minority of tiles is rail, there must be some correction going on to weed out "empty" tiles, maybe that one is broken (e.g. if it choses a random tile, and then searches for the "nearest" rail tile, that would very likely hit the same border tile if only a minority of the map is connected.)
User avatar
RAMMAR
Engineer
Engineer
Posts: 74
Joined: 06 Feb 2009 19:06
Location: Riga, Latvia - Рига, Латвия

Re: Why don't large UFO's ever land on the AI's tracks?

Post by RAMMAR »

In a lot of my games, I've seen this "feature" - even there was a record UFO has landed at the same place six times in a row...
Also, I've noticed that UFO have some special places/points for it to land and it just choose randomly to land between those points (with repeat) - they are always the same (if the tracks aren't changed)... For example:
UFO1 has choosed point 1 (it is making a long trip to it, by a random (is some way) flying)... During this period UFO2 has choosed point 6... UFO3 has choosed point 4... UFO4 has choosed point 2... UFO5 has choosed point 1... UFO6 has choosed point 7... UFO7 has choosed point 5... UFO8 has choosed point 3... etc. The bigger quantity of lines means the bigger quantity of these points...

P.S. UFOs are more like to land near the station entry/exit, then on the usual track... The UFO landing statistics has told/shown me so...
Life is the moving train on the tracks...
(Transport Tycoon Deluxe for the real)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Yexo »

RAMMAR wrote:In a lot of my games, I've seen this "feature" - even there was a record UFO has landed at the same place six times in a row...
Also, I've noticed that UFO have some special places/points for it to land and it just choose randomly to land between those points (with repeat) - they are always the same (if the tracks aren't changed)... For example:
UFO1 has choosed point 1 (it is making a long trip to it, by a random (is some way) flying)... During this period UFO2 has choosed point 6... UFO3 has choosed point 4... UFO4 has choosed point 2... UFO5 has choosed point 1... UFO6 has choosed point 7... UFO7 has choosed point 5... UFO8 has choosed point 3... etc. The bigger quantity of lines means the bigger quantity of these points...

P.S. UFOs are more like to land near the station entry/exit, then on the usual track... The UFO landing statistics has told/shown me so...
Where are those games? Please upload one (and if possible, indicate those locations with signs).
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Bilbo »

Well, AI can receive events, like "first train arrived in station X" or "Vehicle X is not making profit", perhaps adding "Ufo landed at coordinates X,Y" would be sufficient (AI can then examine the area to remember the tracks there and rebuild them once the UFO explodes)
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Yexo »

Bilbo wrote:Well, AI can receive events, like "first train arrived in station X" or "Vehicle X is not making profit", perhaps adding "Ufo landed at coordinates X,Y" would be sufficient (AI can then examine the area to remember the tracks there and rebuild them once the UFO explodes)
The problem is that AI events are asynchronous, so by the time the AI reads the event the ufo may already have been exploded.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Bilbo »

But there is quite large delay before ufo landing down and ufo actually exploding, so AI have quite a big chance to know about it before it is "too late".

In worst case (AI finds out after ufo explosion) it can at least try to repair by examining surroundings of the explosion and re-connecting the track (would work fine for straight line, could be worse for junction).

Well, the original aim of NoAI is to be fair and have same condition for humans and for AI's - so I think we should be fair with disasters too.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Yexo »

Bilbo wrote:But there is quite large delay before ufo landing down and ufo actually exploding, so AI have quite a big chance to know about it before it is "too late"
It might be a 'large time' for you, but if the AI just started pathfinding it might take a while before it checks the events. So let's consider the worst case:
In worst case (AI finds out after ufo explosion) it can at least try to repair by examining surroundings of the explosion and re-connecting the track (would work fine for straight line, could be worse for junction).
Now we are back to were we were originally, it's very hard for the AI to repair the damage (straight lines are doable, junctions are not).
Well, the original aim of NoAI is to be fair and have same condition for humans and for AI's - so I think we should be fair with disasters too.
At this moment the only way to be fair is disable this disaster (so all disasters, since you can't disable them individually).

Of course, if someone can prove me wrong (by writing a squirrel function that repairs the damage after an ufo explosion), I'll be happy to enable this disaster for AIs.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Why don't large UFO's ever land on the AI's tracks?

Post by frosch »

Eddi wrote:
Yexo wrote:About it being predictable, seems you just have bad luck, as the tile chosen is random.
back when i played with disasters (long time ago... something 0.4-ish) i also had the ufos repeatedly land on the same spot... maybe the chosen destination is not as random as you'd like it to be.

i don't know how the tile is chosen, but given that only a minority of tiles is rail, there must be some correction going on to weed out "empty" tiles, maybe that one is broken (e.g. if it choses a random tile, and then searches for the "nearest" rail tile, that would very likely hit the same border tile if only a minority of the map is connected.)
Correct. The choosen tile is random, but the probability is by far not the same for every tile.
It just picks a random tile and then lineary scans the map for the first railtile. I.e. if you have a 2048x2048 map with only two rail tiles which are next to each other in a NW-SE direction, it will prefer the NW tile above the SE tile with a chance of (2048*2048):1

If someone cares, provide a patch that makes it scan the map non-lineary, maybe like the tileloop.

Btw. I would suggest AIs to build dummy tracks in NW direction of the real track to make ufos prefer to land there :p
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: Why don't large UFO's ever land on the AI's tracks?

Post by maquinista »

Some time ago, I discovered that if You open the cheats menu, and manages other company when the UFO is destroyed, your rails will remain untouched, but... this is a cheat. :P
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Bilbo »

Yexo wrote:
Bilbo wrote:But there is quite large delay before ufo landing down and ufo actually exploding, so AI have quite a big chance to know about it before it is "too late"
It might be a 'large time' for you, but if the AI just started pathfinding it might take a while before it checks the events. So let's consider the worst case:
Could the AI system be changed to use some interrupt mechanism for the events? AI would set which events are so important, that they would be handled as "interrupt" - like Save() is called as interrupt, no matter where the code is currently running - and AI then would be able to quickly react for important events. This could pose some problems (what if the interrupt handler is interrupted by a Save()? ) but could solve the problem nicely - if human is doing some long job (building large route), he can interrupt it and do something else if he receive some news message that requires the attention somewhere else. AI's would be able to do the same (without having to explicitly check events every moment in the pathfinder).
Yexo wrote:Of course, if someone can prove me wrong (by writing a squirrel function that repairs the damage after an ufo explosion), I'll be happy to enable this disaster for AIs.
For AI that remember everything it builds, then it is easy. For AI that does not - you can write function that will guess what was there and try to re-create it, in most cases it could work, but it will never be 100%.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Yexo »

Bilbo wrote:
Yexo wrote:
Bilbo wrote:But there is quite large delay before ufo landing down and ufo actually exploding, so AI have quite a big chance to know about it before it is "too late"
It might be a 'large time' for you, but if the AI just started pathfinding it might take a while before it checks the events. So let's consider the worst case:
Could the AI system be changed to use some interrupt mechanism for the events? AI would set which events are so important, that they would be handled as "interrupt" - like Save() is called as interrupt, no matter where the code is currently running - and AI then would be able to quickly react for important events. This could pose some problems (what if the interrupt handler is interrupted by a Save()? ) but could solve the problem nicely - if human is doing some long job (building large route), he can interrupt it and do something else if he receive some news message that requires the attention somewhere else. AI's would be able to do the same (without having to explicitly check events every moment in the pathfinder).
The library pathfinders are written in such a way that it's easy for the caller to specify the number of tiles searched before the pathfinder returns. After that you can easily resume pathfinding. By using this, AIs can check their events during pathfinding wihtout too much work. I'm not sure which AIs use this mechanism at the moment, but it certainly is possible.
Yexo wrote:Of course, if someone can prove me wrong (by writing a squirrel function that repairs the damage after an ufo explosion), I'll be happy to enable this disaster for AIs.
For AI that remember everything it builds, then it is easy. For AI that does not - you can write function that will guess what was there and try to re-create it, in most cases it could work, but it will never be 100%.
The memory requirements for remembering are way too high. There are already people complaining that the AIs are too slow, let's not make the problem worse by also using a lot of memory.
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Why don't large UFO's ever land on the AI's tracks?

Post by Eddi »

frosch wrote: If someone cares, provide a patch that makes it scan the map non-lineary, maybe like the tileloop.
i have thought a little about this, and i have 4 possible solutions, that could provide more uniform distribution.
  • Variant 1
    chose a rail tile monte-carlo-style (i.e. repeatedly try until you hit one)

    problem with this is that this performs worse on practically empty map, so if you limit it to something like 1000 tries, there might not have been found a target, even though one exists
  • Variant 2
    when a UFO appears, scan the whole map for rail tiles, make a list of those tiles, and then randomly choose an index in that list.

    problem with that approach is that scanning the whole map may take very long, so this must be broken up into small chunks similar to the tile loop, which might be difficult to implement (values must be stored somewhere, tiles can change before the loop is finished, second UFO may appear, etc.)
  • Variant 3
    in the tile loop, when touching a rail tile, there is a chance to set "make this the next target for a possible UFO"

    problem here is that the tile loop is run much more often than UFO generation, so this might create some overhead
  • Variant 4
    choose a station, and then use variant 1 limited to the area around this station. (fixed radius?)

    problem with this variant is that rail tiles far away from stations would be "secure"
sean16
Engineer
Engineer
Posts: 61
Joined: 07 Feb 2009 21:05

Re: Why don't large UFO's ever land on the AI's tracks?

Post by sean16 »

Regarding the fixing/repairing of the track, why not just let the AI get away with no damage, because surely enough, when a solution is found, every AI will use it. This would just save the CPU/Memory problems it would otherwise run in to.
formerly known as seandasheep
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 7 guests