Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed May 22, 2019 5:53 pm

All times are UTC




Post new topic  Reply to topic  [ 167 posts ]  Go to page Previous 14 5 6 7 8 9 Next
Author Message
PostPosted: Sat Jul 06, 2013 6:38 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Kogut wrote:
SuperLib 28 is not appearing in BaNaNaS for r25561 and 1.3.2-RC1. 27 appears to be the top available version.


Strange. I can find version 28 in 1.3.2-RC1 (see attachment, assuming you refer to the AI edition).

If I look at the Banans manager, the only restriction set is that at minimum OpenTTD 1.1 is required.


Attachments:
SuperLib 28 in 1.3.2-RC1.png
SuperLib 28 in 1.3.2-RC1.png [ 26.42 KiB | Viewed 3697 times ]

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Top
   
PostPosted: Sun Jul 07, 2013 12:02 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
It is appearing in "main menu|check online content" list, it is not appearing in "main menu|AI/game scripts settings|check online content" list.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
PostPosted: Sun Jul 07, 2013 5:27 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Kogut wrote:
It is appearing in "main menu|check online content" list, it is not appearing in "main menu|AI/game scripts settings|check online content" list.


I haven't checked the source code, but my guess is that "main menu|AI/game scripts settings|check online content" will filter on AI/GSes and only include other content if it is a dependency for an AI or GS.

Edit: To clarify, my guess is that there is no AI yet that depend on SuperLib 28.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Mon Jul 08, 2013 8:25 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
I discovered that in current OpenTTD demolishing a demolished tile is free. Therefore _SuperLib_Money::BurnMoney is not working properly. Here is a fixed version (unfortunately the new one affects multiple tiles, not only single one :( ).

Code:

function _SuperLib_Money::BurnMoney()
{
   while(true)
   {
      local empty_tile = _SuperLib_Tile.GetRandomTile();
      if(AITile.IsBuildable(empty_tile))
      {
         if(!AITile.DemolishTile(empty_tile)) break;
      }
   }
}


_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
PostPosted: Tue Jul 09, 2013 9:09 pm 
Offline
Engineer
Engineer

Joined: Sun May 12, 2013 10:28 pm
Posts: 94
Location: Argentina
You can still use a single tile by alternating demolition and building (a single tree is enough) :?


Top
   
PostPosted: Wed Jul 10, 2013 4:00 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
That is a great idea, thanks! This version includes this idea, handles next game mechanics change (loan, negative bank balance and bankruptcy) and fixes situation where money spending was interrupted.

Code:
function _SuperLib_Money::BurnMoney()
{
   AICompany.SetLoanAmount(AICompany.GetMaxLoanAmount());
   local empty_tile = null;
   while(true)
   {
      for(local i = 0; i < 1000; i++)
      {
         empty_tile = _SuperLib_Tile.GetRandomTile();
         if(AITile.IsBuildable(empty_tile))
         {
            while(true)
            {
               if(!AITile.DemolishTile(empty_tile))
               {
                  if(AIError.GetLastError() == AIError.ERR_NOT_ENOUGH_CASH) {
                     return;
                  }
                  break;
               }
               if(!AITile.PlantTree(empty_tile))
               {
                  if(AIError.GetLastError() == AIError.ERR_NOT_ENOUGH_CASH) {
                     return;
                  }
                  break;
               }
            }
         }
      }
      AIController.Sleep(500);
   }
}


Note:

Code:
   /*
    * Wastes money (may be used to ensure bankruptcy)
    * Note that this function will probably not return until your AI
    * has wasted all its money.


may now be

Code:
   /*
    * Wastes money (may be used to ensure bankruptcy)


as it always will waste all money before returning.

EDIT: It would be a good idea to add documentation of returned value to BuildNextToRoad (it seems to be null on failure, tile index of constructed structure on success).

EDIT2: I just discovered that Squirrell includes enums - http://www.squirrel-lang.org/doc/squirrel2.html#d0e925 (what seems a proper solution for "what" parameter in BuildNextToRoad)

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
PostPosted: Mon Jul 15, 2013 11:50 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Kogut wrote:
EDIT: It would be a good idea to add documentation of returned value to BuildNextToRoad (it seems to be null on failure, tile index of constructed structure on success).

This has been fixed in the next version that will shortly be announced.

Kogut wrote:
EDIT2: I just discovered that Squirrell includes enums - http://www.squirrel-lang.org/doc/squirrel2.html#d0e925 (what seems a proper solution for "what" parameter in BuildNextToRoad)

I suspect that enums fail to work for the same reason that consts don't work. At least in SuperLib, I have settled for using static members to emulate enums. See for example direction.nut. In this case, the "what" string is just not a simple enum. For MagicDTRS, it is also used to specify the length of the DTRS to build. That said you can use the named methods declared above BuildNextToRoad for possible more pretty code to call construction of a specific thing in situations when you don't need to handle the things in a generic way.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Mon Jul 15, 2013 11:52 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Version 30

changelog wrote:
Feature:
  • Story.NewStoryPage2 - returns an array with both page id and page elements

Fix:
  • Airport::GetNumAircraftInAirportQueue didn't support heliports. (HGus)
  • Use improved Money::BurnMoney by Kogut
  • Document return value of BuildNextToRoad



Thanks to Kogut and HGus for the contributions included in this release.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Mon Jul 15, 2013 12:29 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Update - Version 31

Sorry, I found a problem in version 30 just after releasing it. This update ensure that the StoryBook API is not reported to be existing in eg. 1.3.2-RC2 and other 1.3.x RCs.

changelog wrote:
Fix:
  • Detection of if StoryBook API exist gave false positives on 1.3.x RCs
    released later in time than the introduction of StoryBook. Now look for
    cargodist as a sign that StoryBook also exist. (a check for the revision
    when StoryBook and CargoDist was introduced in trunk filters out old patch
    CargoDist builds)

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Mon Jul 15, 2013 1:02 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
Unfortunately there is problem also with v31.


Attachments:
Bez tytułu.png [54.22 KiB]
Downloaded 7 times

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Top
   
PostPosted: Mon Jul 15, 2013 1:25 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Kogut wrote:
Unfortunately there is problem also with v31.


Hmm, it appears that what triggers it is that GSGoal is used as default arg parameters and therefore is evaluated at compile time.

I'll figure out a solution on how to bend the packaging to solve this. (one is to use a compiler also for the AI edition, but that slows down development)

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Mon Jul 15, 2013 1:56 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Update - Version 32

changelog wrote:
Fix:
  • AI version of SuperLib 30 and 31 was not working because OpenTTD interpreted
    GSGoal in story.nut too early (and killed the AI because of that)

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Thu Jul 18, 2013 8:16 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Mon Mar 18, 2013 10:22 pm
Posts: 165
Pretty awesome set of scripts. I'm taking a shot at writing an AI to expand my programming knowledge :)

Anyway, maybe I am doing something dense, but I am getting the same crash you reported fixed in version 32 ?(


Attachments:
Crash.png [18.36 KiB]
Downloaded 6 times
Top
   
PostPosted: Fri Jul 19, 2013 5:52 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
This one is a different one, 31 would crash before "RadAI Started". But anyway - thanks for report!

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
PostPosted: Fri Jul 19, 2013 8:09 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
AI Update - Version 33

This update is only for AIs. For GSs version 32 is still the last version.

Changelog:
Code:
Fix:
- The NoBuild custom RPF had usage of GS API (roadpathfinder.nut)
- Fix: Station.IsCargoSupplied used GS API calls (station.nut)


(The now only remaining location where GS API is used explicitly is in story.nut, which is not included in the AI edition - as those includes are commented out in the AI/master version and only activated by the GS edition compiler)

Thank you for the report.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Sun Jul 21, 2013 8:47 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
There is a report about a bug in SimpleAI. It appears in GetInflationRate function that was imported to SuperLib.

viewtopic.php?p=1087476#p1087476

So once new version of SimpleAI will be released also SuperLib should be updated.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
PostPosted: Sun Jul 21, 2013 3:46 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Thanks Kogut for the reminder. I've fixed this locally and will include it in the next release.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Sun Jul 21, 2013 4:13 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Update - Version 34

Changelog:
- Fix: Reduce risk of overflow in money.nut
- Feature:Allow clearing all signs except one tile

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Sun Jul 21, 2013 6:39 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4552
Location: /home/sweden
Update - Version 35

Sorry for the version spam today. I hope this is the last version.

Changelog:
Code:
Change:
- Require minimum r25621 to consider StoryBook existing. r25620 and r25621
fixes two important bugs of the StoryBook. Before that it is better to fall
back to GSGoal.Question than annoying users with these known bugs.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Sun Jul 21, 2013 10:25 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
Code:
   return (money / 100) * _SuperLib_Money.GetInflationRate();


I am not sure whatever it is OK that money%100 is ignored (for example Inflate(90) will always return 0).

Maybe

Code:
   return (money / 100) * _SuperLib_Money.GetInflationRate() + (money % 100) * _SuperLib_Money.GetInflationRate();


?

On the other hand - it is hard to imagine that such amount of money will be used in AI code.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 167 posts ]  Go to page Previous 14 5 6 7 8 9 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.
Hosted by Zernebok Hosting.