Page 11 of 17

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

Posted: 17 Dec 2011 18:50
by macee
I had a crash. I attached the crash.* files. The crash occured when I tried to clone a train with shared orders.

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

Posted: 18 Dec 2011 00:18
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.

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

Posted: 18 Dec 2011 00:29
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

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

Posted: 18 Dec 2011 00:53
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).

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

Posted: 18 Dec 2011 14:12
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.

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

Posted: 18 Dec 2011 15:18
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

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

Posted: 18 Dec 2011 15:20
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 :)

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

Posted: 18 Dec 2011 15:43
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)

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

Posted: 18 Dec 2011 16:33
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 :)

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

Posted: 18 Dec 2011 19:58
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

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

Posted: 18 Dec 2011 20:34
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.

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

Posted: 18 Dec 2011 20:55
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.

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

Posted: 18 Dec 2011 22:34
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, ...

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

Posted: 19 Dec 2011 00:45
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.

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

Posted: 19 Dec 2011 11:39
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 :)

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

Posted: 19 Dec 2011 16:43
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.

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

Posted: 19 Dec 2011 20:29
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).

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

Posted: 19 Dec 2011 20:43
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

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

Posted: 19 Dec 2011 21:15
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.

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

Posted: 19 Dec 2011 21:33
by bokkie
NICE!

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