NoGo - A Scriptable Game Framework - v1.5

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

macee
Engineer
Engineer
Posts: 19
Joined: 20 May 2011 20:14

Re: NoGo - A Scriptable Game Framework - v1.1

Post by macee »

I had a crash. I attached the crash.* files. The crash occured when I tried to clone a train with shared orders.
Attachments
crash.zip
(385.68 KiB) Downloaded 49 times
Torrasque
Engineer
Engineer
Posts: 94
Joined: 19 Aug 2004 13:33
Contact:

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Torrasque »

Kogut wrote:Probably it is not a bug as AIIndustry::GetLastMonthTransported and value visible for humans in industry details window is single variable for industry, without separate data for companies.
I'll wait on Truebrain opinion. If it's a bug I gladly write a simple GS example.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.1

Post by TrueBrain »

Basic rule of thumb: if a human can see it, so can an AI/GS. In the same way and method. Same holds for here. The production and amount transported is per Industry, not per company/industry. So yeah, not a bug.

That said, I can see why you would want to know this information per company, but atm it is not possible. Guess it should go on my wish-list. Not sure if it is something we would really want you to want :D
The only thing necessary for the triumph of evil is for good men to do nothing.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.1

Post by TrueBrain »

macee wrote:I had a crash. I attached the crash.* files. The crash occured when I tried to clone a train with shared orders.
Bug in trunk. Will be fixed in next NoGo sync (tomorrow-ish).
The only thing necessary for the triumph of evil is for good men to do nothing.
bokkie
Transport Coordinator
Transport Coordinator
Posts: 327
Joined: 19 Jan 2007 19:26

Re: NoGo - A Scriptable Game Framework - v1.1

Post by bokkie »

Probably the same for me, see attachments. A shame, it looked like it would be fun but I didn't even get to grow a city once before crashing :D

Other than that there were two things that struck me:
- the error says the generated file(s) are in c:\users\(etc) , but since my Windows is localised, it is not. Not NoGo related but... still.
- the line with "xx city xx" underneath the city name, sometimes is too close to the city name: in the screenshot there's not even a row between them.
Attachments
crash.png
(216.31 KiB) Downloaded 1 time
crash.dmp
(2.15 MiB) Downloaded 52 times
screenshot.png
screenshot.png (78.96 KiB) Viewed 1793 times
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Michi_cc »

bokkie wrote:the error says the generated file(s) are in c:\users\(etc) , but since my Windows is localised, it is not. Not NoGo related but... still.
They are, actually. The name translation is a special Explorer thingy that doesn't change the file/folder names on disk. If you simply paste "C:\Users" into the explorer address bar or the text field in the start menu it will open the proper folder.

-- Michael Lutz
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.1

Post by TrueBrain »

bokkie wrote:Probably the same for me, see attachments. A shame, it looked like it would be fun but I didn't even get to grow a city once before crashing :D

Other than that there were two things that struck me:
- the error says the generated file(s) are in c:\users\(etc) , but since my Windows is localised, it is not. Not NoGo related but... still.
- the line with "xx city xx" underneath the city name, sometimes is too close to the city name: in the screenshot there's not even a row between them.
Cloning with shared orders is a trunk bug yes.

I have no clue what you mean with the last one. "a row between them". I have no clue what you mean. If you mean that when zooming out the town sign and a sign on the exact same tile as the town center creep closer and closer together, yes, that is how signs work in general :) You can change your font and font-size to correct for that, but it will most likely become unreadable too :)
The only thing necessary for the triumph of evil is for good men to do nothing.
bokkie
Transport Coordinator
Transport Coordinator
Posts: 327
Joined: 19 Jan 2007 19:26

Re: NoGo - A Scriptable Game Framework - v1.1

Post by bokkie »

Apparantly, I'm not clear :). How do you call it... spacing? padding? It looks odd because both lines of text touch each other. Usually, there's at least a line (row) of pixels between.

(Dutch is easier :P)
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.1

Post by TrueBrain »

bokkie wrote:Apparantly, I'm not clear :). How do you call it... spacing? padding? It looks odd because both lines of text touch each other. Usually, there's at least a line (row) of pixels between.

(Dutch is easier :P)
Well, if that is what you meant, I already replied :) In the normal zoom you will always see the same spacing, but when zooming you you will see that all signs and text creeps up on each other. This is because you want to keep text readable. It is btw unrelated to NoGo, as this is trunk code :)
The only thing necessary for the triumph of evil is for good men to do nothing.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.2

Post by TrueBrain »

New Release (1.3). Big changelog (well, not in size, but in patch-size):

- Added a info.nut setting called: IsDeveloperOnly. When defined, and returning true, the GS will only show up in the GUI when the AI Developers tool is active. Loading a saved game with a GS will always load the GS, whatever this flag returns.
- Added lots of small fixes and stability issues.
- Updated to latest trunk.
- With great help from mostly Rubidium: translation support.

To talk a bit about the last entry:
If your GS now has a directory called 'lang', in which you put a file 'english.txt', in the same format as OpenTTD's language files (STR_YOURNAME :<a string>), you can now allow translation of such strings, even over the network. For example, if you make a file 'dutch.txt', which has the same STR_YOURNAME entry, but with a different translation, it will show the translation on clients that selected dutch, and english for all the others.

To use this string in your GS, you have to use GSText. It is pretty documented, but to give you a small summary: GSTown.SetText(0, GSText(STR_YOURNAME)).

I enabled it for most functions that accept 'const char *', now called 'Text *'. Let me know if I forgot one you think should have it.

Translations are saved in the savegame, so if you load the savegame without the GS, you still see all translated stuff.

Bugs, problems. Let me know. The promised GUI with buttons like yes/no/cancel/etc got sidetracked because of translation stuff. Will do that tomorrow, and hopefully finish it ;)

PS: there is no 1.2. I f*** up a tag, and had to skip a version :D
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: NoGo - A Scriptable Game Framework - v1.3

Post by Zuu »

When starting a new game I had OpenTTD crash on me. It is possible that there is a bug in my GS code as I did some coding before starting OpenTTD to test my GS code.
Attachments
crash.dmp
(1.4 MiB) Downloaded 46 times
crash.png
crash.png (12.12 KiB) Viewed 292 times
crash.log.txt
(10.31 KiB) Downloaded 54 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: NoGo - A Scriptable Game Framework - v1.3

Post by Zuu »

By setting AI count to zero, I can postpone the crash to after the world has been generated, but it still happens and with a similar stack trace (looks the same, but have not verified it).

Edit: Sorry, the world generation was not done. It was at step 57 / 96 in town generation. Or at least that is what was displayed in the GUI at the time when the crash happened.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.3

Post by TrueBrain »

Another update (1.4):

- Fixes crash when no language files are available
- Fixes crash when going back to the main menu (under almost all conditions)
- Many coding style fixes, small bugs, typos, ...
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: NoGo - A Scriptable Game Framework - v1.4

Post by MinchinWeb »

I'm trying to get my Road Pathfinder to work, however, if seems to be hung up on GSTile.IsBuildable(next_tile). The function requires, as a precondition (as noted here), that a company is in scope, however, I'm trying to build as the 'game', so no company is in scope.

Is there a way around the precondition, or could the condition be removed (does 'build-ability' change depending on what company is in scope?), or an alternate function be provided when trying to build as the 'game'?

As well, when trying to build roads as the 'game,' I don't seem to be able to build bridges...feature or bug? I haven't tried, but I imagine tunnels work the same way.
Last edited by MinchinWeb on 19 Dec 2011 05:59, edited 1 time in total.
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.4

Post by TrueBrain »

You have to look at this the other way around. I blocked all functions from being able to build anything as GameScript owner, with a small list that form the exceptions. Atm this is only BuildRoad. We will have to look function by function if it should be opened more. Basically, the API is too big for me to oversee all functions and possibilities. For that I have you guys :D

So best is, instead of wondering if it is a bug or anything, just ask yourself: would it be fair if a GameScript can build this free of charge. And just let me know what you think should be opened. I will review them and let you know ;)

In this case, IsBuildable, Build(Road)Bridge and Build(Road)Tunnel are no problem, and should indeed be opened up. For 1.5 ;)

If you find others, please do let me know :)
The only thing necessary for the triumph of evil is for good men to do nothing.
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: NoGo - A Scriptable Game Framework - v1.4

Post by Eddi »

everything that's possible in the scenario editor is a good hint. i.e. placing/removing road (bridges, tunnels), founding towns (possibly removing towns? that may be tricky with all the references), terraforming, placing objects.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: NoGo - A Scriptable Game Framework - v1.4

Post by MinchinWeb »

TrueBrain wrote:You have to look at this the other way around. I blocked all functions from being able to build anything as GameScript owner, with a small list that form the exceptions. Atm this is only BuildRoad. We will have to look function by function if it should be opened more. Basically, the API is too big for me to oversee all functions and possibilities. For that I have you guys :D

So best is, instead of wondering if it is a bug or anything, just ask yourself: would it be fair if a GameScript can build this free of charge. And just let me know what you think should be opened. I will review them and let you know ;)
Ok, I put my thinking cap on, and the functions I need/would like right now are:
My Wish List:
  • GSRoad.BuildRoad
    GSRoad.BuildOneWayRoad
    GSRoad.BuildRoadFull
    GSRoad.BuildOneWayRoadFull
    GSRoad.RemoveRoad
    GSRoad.RemoveRoadFull
    GSBridge.BuildBridge
    GSBridge.RemoveBridge
    GSTunnel.BuildTunnel
    GSTunnel.RemoveTunnel
    GSTile.IsBuildable
    GSTile.IsBuildableRectangle
Tunnels and bridges should be restricted to roads. Removals should maybe be restricted to non-owned or town-owned roads (as the GameScript anyway). I would be happy with the above :D

As a thought exercise:
A reasonable expansion might be canals. Then the following functions would make the list. Again, maybe removals should be restricted to non-owned or town-owned canals.
  • GSMarine.BuildBuoy
    GSMarine.BuildLock
    GSMarine.BuildCanal
    GSMarine.RemoveBuoy
    GSMarine.RemoveLock
    GSMarine.RemoveCanal
I've never done it, but I think you can build 'canal bridges', and so the bridge functions should be opened up to canals as well.
Eddi wrote:everything that's possible in the scenario editor is a good hint. i.e. placing/removing road (bridges, tunnels), founding towns (possibly removing towns? that may be tricky with all the references), terraforming, placing objects.
This is probably reasonable. With this power you could turn a GameScript into a sort of dynamic scenario maker and manager. The additional functions involved:
  • GSIndustryType.BuildIndustry
    GSIndustryType.ProspectIndustry
    GSTile.RaiseTile
    GSTile.LowerTile
    GSTile.LevelTile
    GSTile.DemolishTile
    GSTile.PlantTree
    GSTile.PlantTreeRectangle
To work properly, the BuildIndustry/ProspectIndustry functions would need to work regardless of the game settings that bind players.

DemolishTile would be a lot of power. I think a good way to counterbalance most abuses would be to only allow destruction of non-owned and town-owned squares without explicitly moving to an active company mode. It would be handy too if this function (or one like it) could be used to remove industries too.

The other functions that the scenario manager would be that a GameScript wouldn't at this point would be the ability to found a town or directly set industry production levels.

Other (useful?) functions:
Other additions to the GameScript framework that might be useful is the ability to deny the player to do certain actions. For example, when running the train section of the tutorial, they can only build trains. Or to restrict a player to certain regions of the map: in the tutorial you could force them to build a station where it will gather/accept cargo or maybe in a head-to-head situation (one player can only build on one side of the map).
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.4

Post by TrueBrain »

Ah! Useful list :D Tnx :)

Oneway road I considered, but dismissed. It is not something for a GS to build as super-user in my opinion. Feel free to convince me otherwise with a clear usecase :)

BuildBridge / BuildTunnel (for road) is done, will be in next update.

Marine stuff ... I need to think about that for a bit :)

Tile manipulation sounds like a good idea too yeah, will see what I can do.

Industry: I can see the pros/cons. Have to think about it a bit :)

Trees: ugh, we already have enough trees in the game as it is :P
The only thing necessary for the triumph of evil is for good men to do nothing.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.4

Post by TrueBrain »

I bring you a new update: 1.5.

Changelog:

- Add: BuildBridge / BuildTunnel for GS
- Add: disable highlight of widget you click on, when it is being highlighted
- Fix: many small fixes and bugs.
- Fix: document WindowClass much better
- Fix: make sure WindowNumber in a WindowClass is unique, and it links to a single Widget array

Most likely more I forgot about.

PS: I committed NoGo to trunk ;) 1.5 will be last custom build, tomorrow night you can just download the latest nightly.
The only thing necessary for the triumph of evil is for good men to do nothing.
bokkie
Transport Coordinator
Transport Coordinator
Posts: 327
Joined: 19 Jan 2007 19:26

Re: NoGo - A Scriptable Game Framework - v1.5

Post by bokkie »

NICE!

Not too much of a surprise but somehow you were a bit careful yourself :)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 28 guests