NoGo - A Scriptable Game Framework - v1.5
Moderator: OpenTTD Developers
Re: NoGo - A Scriptable Game Framework
You already got my kudos on IRC, but to re-state:
<3 <3 <3 <3 <3 <3 <3 <3
<3 <3 <3 <3 <3 <3 <3 <3
Lead Manager of OpenDUNE
Re: NoGo - A Scriptable Game Framework
Haha, no. Rather: hell noEddi wrote:wait... no XML?!?

http://www.json.org/
Clear state diagram ftw. No confusion. No misunderstanding. 'Strong' typed. f*** XML

The only thing necessary for the triumph of evil is for good men to do nothing.
Re: NoGo - A Scriptable Game Framework
To state the obvious, I agree that a line needs to be drawn somewhere to avoid conflicts.TrueBrain wrote:You cannot have 2 separated systems do identical things. There will be conflicts between data if you do, which have to be resolved. Resolving such conflicts is hard, if not impossible. This will in the end work against you, and so a line is needed. The line will also constantly move, and as everything evolves, it might even jump from time to time.Expresso wrote: It's disturbing to me that newGRF seems to be considered holy for some reason. Sure there are already quite a bunch of newGRFs out there and it runs faster then a script (depends on how things are treated, though).
But drawing a line? I don't see a point in that other then obstructing (possible future) innovation.
If this line gets drawn, chances are there will be forks in the future or the line gets moved again and again.
OpenTTD is a great game. Whether the mods are written using NFO or squirrel, I don't care.
IMHO, from my, very limited in regards of NewGRF, point of view:
NoGo should override town growth without a doubt ... everything else, eg. acceptance of goods by houses and industry production levels, is up to the NewGRF authors.
EDIT:
Which does not mean that there could not be a goal like eg. boost all industry production levels above level x.
Also as this is my first post in this thread ... /me is looking forward to this addition in trunk very, very much.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: NoGo - A Scriptable Game Framework
But what happens if a game script says that you need to deliver goods to a town when it reaches X population but the town newgrf doesn't have any buildings which accept goods by then. What happens then?ChillCore wrote:To state the obvious, I agree that a line needs to be drawn somewhere to avoid conflicts.TrueBrain wrote:You cannot have 2 separated systems do identical things. There will be conflicts between data if you do, which have to be resolved. Resolving such conflicts is hard, if not impossible. This will in the end work against you, and so a line is needed. The line will also constantly move, and as everything evolves, it might even jump from time to time.Expresso wrote: It's disturbing to me that newGRF seems to be considered holy for some reason. Sure there are already quite a bunch of newGRFs out there and it runs faster then a script (depends on how things are treated, though).
But drawing a line? I don't see a point in that other then obstructing (possible future) innovation.
If this line gets drawn, chances are there will be forks in the future or the line gets moved again and again.
OpenTTD is a great game. Whether the mods are written using NFO or squirrel, I don't care.
IMHO, from my, very limited in regards of NewGRF, point of view:
NoGo should override town growth without a doubt ... everything else, eg. acceptance of goods by houses and industry production levels, is up to the NewGRF authors.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)

OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone

OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone







Re: NoGo - A Scriptable Game Framework
Why would a GRF do that? That would be stupid no? (*)XeryusTC wrote: But what happens if a game script says that you need to deliver goods to a town when it reaches X population but the town newgrf doesn't have any buildings which accept goods by then. What happens then?
Towns have more than one cargo type they react to (mail, passengers) and even if that type is changed to something else sometimes by GRF, (eg. FIRS requiring petrol and ECS something else in Toyland) there is still an acceptance of the new type of cargo, although OpenTTD still counts it as "goods".
IMHO, if one does prevent acceptance of everything at some point, that then that GRF is "kaka" and you should really play with another one as that one would be a major game breaker.
(*) I have also changed "my" version of the town growth patch to never drop below 1% growth for exactly this reason -> read: for very small towns to still be able to grow until they do accept all requirements.

Last edited by ChillCore on 28 Nov 2011 21:53, edited 1 time in total.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: NoGo - A Scriptable Game Framework
You learn that it was a bad choice of newgrfXeryusTC wrote:But what happens if a game script says that you need to deliver goods to a town when it reaches X population but the town newgrf doesn't have any buildings which accept goods by then. What happens then?

I can't discover many newgrf properties or callbacks that it would be safe for NoGo to have access to. Newgrfs need to be a closed box to NoGo; there are far too many easily triggered unintended consequences if NoGo scripts are allowed to directly adjust newgrf.
However it's quite easy to think of ways for NoGo and newgrfs to co-operate, via existing frameworks, or those that might be added (town control).
A NoGo script needs to be either very generic, so it will work with a wide range of newgrfs, or very tightly bound to a specific set of newgrfs (even to specific newgrf versions).
FWIW I had lots of ideas for interesting ways to allow NoGo to modify newgrfs, but it was quite easy to show they had problems

FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: NoGo - A Scriptable Game Framework
Good one. Perhaps a validity check for town buildings accepting cargo types being available before offering the goal?XeryusTC wrote:But what happens if a game script says that you need to deliver goods to a town when it reaches X population but the town newgrf doesn't have any buildings which accept goods by then. What happens then?
EDIT: @andy
Specific may be cool but you don't want multiple versions of NoGo, that'll confuse people. A "NoGo plugin" or "NoGo Modmod" might be far more interesting and efficient: you downlaod the plugin for the proper NewGRF and that plugin overrides/changes only the necessairy parts of the default NoGo framework.
Re: NoGo - A Scriptable Game Framework
the same thing that happens right now e.g. when you play the alpine climate grf. the towns need food above snow line, but there is no food cargo. tough luck getting towns above snowline to grow at all. (pro tip: try the "fund new buildings" option in the town window, it overrides the food/water requirements)XeryusTC wrote: But what happens if a game script says that you need to deliver goods to a town when it reaches X population but the town newgrf doesn't have any buildings which accept goods by then. What happens then?
Re: NoGo - A Scriptable Game Framework
Not sure if you are aware of this but ... you (or anyone else) will be (are already) able to write your own script ... exactly in the same way you can write an AI.Hyronymus wrote: EDIT: @andy
Specific may be cool but you don't want multiple versions of NoGo, that'll confuse people. A "NoGo plugin" or "NoGo Modmod" might be far more interesting and efficient: you downlaod the plugin for the proper NewGRF and that plugin overrides/changes only the necessairy parts of the default NoGo framework.
There can and will be as many different script as people are willing to write.
NoGo will only provide the hooks just like NoAi does already for AIs.

-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: NoGo - A Scriptable Game Framework
To dance or not to dance:
tralalalaaaaa!
(for some reason I have a feeling this will be abused more than used for good; but time will tell if this was the worst mistake thinkable, or the best thing ever
)
Code: Select all
{
local company = GSCompanyMode(0);
GSSign.BuildSign(GSTown.GetLocation(1), "Test Test");
}
GSSign.BuildSign(GSTown.GetLocation(2), "Test Test");
(for some reason I have a feeling this will be abused more than used for good; but time will tell if this was the worst mistake thinkable, or the best thing ever

The only thing necessary for the triumph of evil is for good men to do nothing.
Re: NoGo - A Scriptable Game Framework
this is probably really evil, but to mimic the original tutorials, moving the mouse cursor to an interface element (e.g. "rail construction"-button) would be needed.
Re: NoGo - A Scriptable Game Framework
One could include a bit field with flags for some extended authority that a GS can have. Executing actions as player could be one of those. An other way would have a script type property: "Goal script", "Observer script", "Tutorial" etc. with different permissions.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: NoGo - A Scriptable Game Framework
Perhaps some things on the edge of what the purpose is of GS, but here are some suggestions for GS.
1) phoenix areas, when certain conditions are met.
2) production cap of local industries dependent on town size.
3) (in combination with some cargodest patch) increase the likelyhood of certain cargoes wanting to go somewhere... or decrease the likelyhood.
4) alternative growth patterns for towns.
5) maintenance and/or construction costs dependent on the local authorities.
1) phoenix areas, when certain conditions are met.
2) production cap of local industries dependent on town size.
3) (in combination with some cargodest patch) increase the likelyhood of certain cargoes wanting to go somewhere... or decrease the likelyhood.
4) alternative growth patterns for towns.
5) maintenance and/or construction costs dependent on the local authorities.
Re: NoGo - A Scriptable Game Framework
Today a new version of NoGo. I am starting to run out of easy things to do here
A changelog since last release:
- Communication (bi-directional) with AdminPort. For that 2 new packets are created, both called GAMESCRIPT, on Receive, on Send. In Squirrel you can send via SQAdmin::Send, and receive via the ADMINPORT Event. See a post above for more information
- Get a vehiclelist of every company in the game, or from 1 specific company
- Build on behalf of a company (with great power comes great responsibility!), by create an instance of GSCompanyMode(<value>) in a scope. It works identical to TestMode and ExecMode, only it changes the current company.
- Open up 90% of the AI API for GS too. The only exceptions atm are setting companyname, presidentname, and looks of the president, as well as all Group related settings, and changing autorenew settings. To me it feels like a GS should never be touching those things. But I can be convinced to open them up too, if you can give me a good reason to
Other stuff includes some stability fixes, comply with OpenTTD coding style, and some better refactoring (there is no include of any AI file in the script/* files no, which means the refactoring is 100% done, and ScriptEngine no longer depend on the AI (but the AI does depend on the ScriptEngine).
It is now possible to make a Tutorial, although it is still hard to communicate with the client.

- Communication (bi-directional) with AdminPort. For that 2 new packets are created, both called GAMESCRIPT, on Receive, on Send. In Squirrel you can send via SQAdmin::Send, and receive via the ADMINPORT Event. See a post above for more information
- Get a vehiclelist of every company in the game, or from 1 specific company
- Build on behalf of a company (with great power comes great responsibility!), by create an instance of GSCompanyMode(<value>) in a scope. It works identical to TestMode and ExecMode, only it changes the current company.
- Open up 90% of the AI API for GS too. The only exceptions atm are setting companyname, presidentname, and looks of the president, as well as all Group related settings, and changing autorenew settings. To me it feels like a GS should never be touching those things. But I can be convinced to open them up too, if you can give me a good reason to

Other stuff includes some stability fixes, comply with OpenTTD coding style, and some better refactoring (there is no include of any AI file in the script/* files no, which means the refactoring is 100% done, and ScriptEngine no longer depend on the AI (but the AI does depend on the ScriptEngine).
It is now possible to make a Tutorial, although it is still hard to communicate with the client.
The only thing necessary for the triumph of evil is for good men to do nothing.
Re: NoGo - A Scriptable Game Framework
Is it possible to include this in NoAI API?TrueBrain wrote:- Get a vehiclelist of every company in the game, or from 1 specific company
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: NoGo - A Scriptable Game Framework
All NoAI actions are restricted to their own company only. This is unlikely to change, and for sure outside the scope of NoGo
Sorry 


The only thing necessary for the triumph of evil is for good men to do nothing.
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: NoGo - A Scriptable Game Framework
This is desirable functionality. Two ways it could be achieved:Expresso wrote:2) production cap of local industries dependent on town size.
1. allow GS to modify ottd behaviour when handling the production change callbacks (29 and 35). This will work for any industry newgrf that (a) uses those callbacks and (b) allows the game to control the production change (i.e. returning 04h to the cb). It may also work for default industries. It wouldn't work for most of FIRS, probably not ECS either from what I know of ECS.
2. store values on the registers for the town. The industry newgrf would then control production, but would pay attention to the register values. There has been some discussion of this on irc. By agreeing conventions on which registers and values to use, industry newgrfs could offer predictable behaviour with GS. It would need quite a lot of agreement.
It won't work to allow GS to modify production multiplier directly on an industry. This would likely conflict with what the newgrf does and cause problems (examples could include: incorrect text information on industries; unexpected industry behaviour such as closure, or refusal to accept / produce cargos, or unexpected consumption or non-consumption of inputs).
Basically there needs to be a clean API between GS and items controlled by newgrf, and in many cases existing frameworks can provide that (like cb handlers or subsidies); or town control (work in progress) can provide it, with some conventions needed.
This is also desirable. If GS could modify the town zones on demand, that would be one way to provide some control. Using registers to communicate with house newgrf is another. Controlling the building of street grids, and the demolition / construction of buildings might also offer some possibilities.4) alternative growth patterns for towns.
cheers,
Andy
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: NoGo - A Scriptable Game Framework
What I'm a bit concerned about is performance impact. On a small map it won't be much of a problem... but what will be/can be the impact of GS on a large map late game?
Re: NoGo - A Scriptable Game Framework
Nothing more (or less) than an AI can do. The GS is, like the AI, restricted in an amount of opcodes it can perform every tick. So it will be almost the same (load-wise) in the begin as at the end of a game, with a small or a large map. I even think you will hardly notice that it is active tbh.
So performance wise is, as far as I know a non-issue. I am sure the future will tell, and as always: you can always opt-in to not pick a GS
So performance wise is, as far as I know a non-issue. I am sure the future will tell, and as always: you can always opt-in to not pick a GS

The only thing necessary for the triumph of evil is for good men to do nothing.
Re: NoGo - A Scriptable Game Framework
i disagree with this decision, since it's a deviation from "AI can see everything that a player can see", because players can get vehicle and station lists for each company.TrueBrain wrote:All NoAI actions are restricted to their own company only. This is unlikely to change, and for sure outside the scope of NoGoSorry
this is kind of an elementary feature to get AIs, especially two companies of the same kind of AI, to not interfere with each other as much, if they could factor in "there is already another company with this route" or "there are already 3 companies at this industry" into their decision whether to start servicing an area.
Who is online
Users browsing this forum: No registered users and 13 guests