Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Dec 11, 2017 2:22 am

All times are UTC




Post new topic  Reply to topic  [ 321 posts ]  Go to page 1 2 3 4 517 Next
Author Message
PostPosted: Sun Nov 20, 2011 5:15 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Mon May 31, 2004 9:21 am
Posts: 1292
Today I present to you: NoGo.

Introduction:
NoGo is, like NoAI, a framework on which you can build script, called GameScripts. Where NoAI is specific build for AIs, NoGo is build to control the general flow of the game.

Although this framework is still very much a WIP, a small indication of what you can do:

- Control town growth
- Set custom texts in the Town GUI to indicate when growth should happen
- Custom news message
- Control the viewport of the player (singleplayer only)
- Change game settings
- Communicate freely with the AdminPort (bi-directional)
- Create your own subsidies
- Build stuff on behalf of a company. For example, you can build (or remove!) pieces of rail for a company. The money it costs (or is gained) is subtracted from the companies wallet.
- All (!) the functions an AI can do too. Most of them more powerful (see all companies, ...)

As you might understand, GameScripts are very powerful. Their main aim is to make Multiplayer servers fun, by setting conditions, goals, achievements and quests. Reward your best player with a subsidy, or make your own disaster by regular stopping random trains because the drivers are on strike. The sky is the limit, and you are in control!

Today I officially announce the project. It started out as a proof-of-concept, and it has proven itself. So it is time for you guys to give it a spin, and return with feedback.

How to get it:
Several locations that might be of importance to you:

Current Version: 1.5

HG prepatched: http://hg.openttd.org/developers/truebrain/nogo.hg/ (multiple heads, take the latest)
HG patchqueue: http://devs.openttd.org/~truebrain/nogo/
Binaries: http://www.openttd.org/en/download-nogo
Documentation: http://devs.openttd.org/~truebrain/nogo ... tated.html


How to play:
Xaroth is kindly hosting several NoGo servers for you to try it out. They are advertised, and you can join them after downloading the latest binary. It might happen he has not updated to latest version yet, but this is mostly done within 12h.

If you want to play it in singleplayer, navigate to your OpenTTD directory. Next to the 'ai' directory there should be 'game' (or create it). In there, make a directory 'test', and put there these two files:

http://devs.openttd.org/~truebrain/nogo/main.nut.txt (save under the name 'main.nut')
http://devs.openttd.org/~truebrain/nogo/info.nut.txt (save under the name 'info.nut')

Start the game. Go to AI Configuration, double click the top entry and select TestTest. Start a new game. And there you go.


How to write my own script:
NoGo works very much like NoAI. In many many many many many ways. The only real difference, is that the AI prefix is changed for a GS prefix in the NoGo framework. So instead of AITown, you use GSTown. The NoGo framework shares many functions with the NoAI framework, and I am sure we will enable many others in the future. Their parameters and return values are often identical. This hopefully makes it very easy to write in either one.

You place your scripts in the 'game' directory, instead of the 'ai' directory. The rest is, including the format of info.nut, identical.

To understand what is currently possible, it is best to just learn by example. Open up the above mentioned main.nut.txt, and flip through it. Installation of your GameScript is identical to that described above. Don't forget to select one before starting a new game!



What is next?
My personal list of things planned is rather large. It is of course unsure if any of them will be implemented, but to give you an idea where I want this framework to go, things that will be possible in the future:

- Allow 'storage' for town cargo, so you don't have to use tricks to supply the town sufficiently every month
- Per-company GUI with goals, quests, challenges, achievements, ...
- Global GUI with goals, quests, challenges, achievements, ...

I am sure I am forgetting many many things, but you get the idea.

At the moment I am very busy stabilizing the framework, finishing the GUI, and cleaning up the code. Many bugs have already been fixed in the last few days (when developers test, bugs get solved so much faster :P), so the current binary should be rather stable.



I would like to thank all the people on this forum (and beyond) for their great ideas (Korenn, you are full of great ideas!), patches, servers (luukland.net for example. You guys put the fun in multiplayer) and more. Together you gave me the idea for this implementation, and I hope it will be a platform for you all to continue working your awesomeness on!

Xaroth, tnx for all the feedback, testing, hosting, etc etc ;)

Developers, thank you very much for your patches, suggestions, proof-reading and what-not. It went so much faster with your feedback :D



To the rest: any feedback, suggestions, comments, questions, ideas, praise, ... please do post them here.

_________________
The only thing necessary for the triumph of evil is for good men to do nothing.


Top
   
PostPosted: Sun Nov 20, 2011 5:57 pm 
Offline
Engineer
Engineer

Joined: Wed Nov 07, 2007 10:04 am
Posts: 118
Great news, will be cool!
Thanks!!!


Top
   
PostPosted: Sun Nov 20, 2011 8:46 pm 
Offline
Tycoon
Tycoon

Joined: Sun Dec 16, 2007 10:24 pm
Posts: 1631
Location: Idaho, USA
Now, that's the kind of first post that properly shows off the excellent work that has clearly been done. :D
It looks like I'm going to have to figure out this scripting -- "squirrel", was it?
*Inspects AI-script documentation*

_________________
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton


Top
   
PostPosted: Sun Nov 20, 2011 8:55 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
Squirrel language: http://squirrel-lang.org/
NoAI API docs: http://noai.openttd.org/docs/


Top
   
PostPosted: Mon Nov 21, 2011 6:38 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
Supercheese wrote:
Now, that's the kind of first post that properly shows off the excellent work that has clearly been done. :D


It also proves what kind of first post gets more attention... Now I'm going to test NoGo again :)

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
PostPosted: Mon Nov 21, 2011 9:43 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4532
Location: /home/sweden
I played around a bit and came up with this NoGo-script.

It
  • takes a while to load on large maps
  • is based on the original script by TrueBrain
  • the cargo requirements of towns does additionally depend on the size of nearby towns - the larger the nearby towns are, the more cargo a town wants

(probably more weird than useful)


Attachments:
goal.zip [2.7 KiB]
Downloaded 150 times

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Top
   
PostPosted: Tue Nov 22, 2011 12:30 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed May 16, 2007 4:59 pm
Posts: 2789
This looks awesome!

_________________
GRVTS/eGRVTS --- Generic Tram Set --- UK Town Set --- zBase ---RichardWheeler.net


Top
   
PostPosted: Tue Nov 22, 2011 12:31 am 
Offline
Engineer
Engineer
User avatar

Joined: Mon May 01, 2006 9:09 am
Posts: 102
I currently have a modified version running of the original nut on my NoGo servers, with some changes.

- Towns (note, not cities) are claimable.. the claiming process takes a while (up to a minute), resulting in a sign being placed under the town name to identify as such.
- Requirements are harder than the original script, towns only slightly, but cities around 33% higher than before... thus enticing people to stick to towns for growing only.
- Claimed towns have 25% less requirements than normal towns, to make it somewhat easier in the long run for claimed towns, allowing them to surpass 100k citizens.
- Cities are identified so you can pick non-cities easier when zoomed out.

_________________
Lead Manager of OpenDUNE


Top
   
PostPosted: Tue Nov 22, 2011 8:52 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4532
Location: /home/sweden
I find it a bit troublesome that NoGo use a different prefix from AIs. And then I don't mainly focus on the issue of typing something else or that 'Goal' is longer than 'AI'. No, instead, the main problem is due to the fact that I miss my SuperLib functions.

One possible way for me to solve it would be to "compile" two editions of SuperLib, one for each framework where I replace "AI" with "Goal" or "GOAL" depending on context. I could also change my code base to use the meta-names "Api" and "API" to refer to the framework name. Doing that would be a fairly automatic task and not a big issue.

I also realize that not all parts of SuperLib would apply to NoGo, so I might not get away from creating a compiler/pre-processor that uses my common code base and create one AI edition and another Goal edition, but if OpenTTD would use the same prefix, at least it would reduce the amount of time I need to put into making a pre-processor - actually, it might be possible to even use the exact same code base and throw an error at run-time when functions not "available" in a framework is called.

I, myself don't mind if the common prefix is AI or eg. "Api" even if the later means changing a lot of code, it will still be possible to automate and just be a one-time investment. That said, I do very well understand that renaming all AI APIs would break all 20+ AIs that we have and is therefore not an option, unless we accept to have very large compat-files.


----

It appears that NoGo scripts are not given the TownFounded event which is documented for AIs.

New version of my silly NoGo-script that works with Found Town:
(It uses a bit lazy coding so when a new town is added, the entire town list is rebuilt unless OpenTTD provides an event with the actual town id of the new town)


Attachments:
test.zip [3.01 KiB]
Downloaded 109 times

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Top
   
PostPosted: Tue Nov 22, 2011 9:03 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Mon May 31, 2004 9:21 am
Posts: 1292
Events are not yet implemented in this version of NoGo. Of course this will be added in future additions, as there are many many events which are useful. Just .. not yet ;) If you look in the script/api/*.hpp files, you can see which functions have 'goal' at their @api line. If they don't, they are not (yet) available to NoGo. Many functions have to be investigated if they should (and can) be allowed for NoGo, which includes most of the events.

The issue about a prefix is one well talked about between developers. It is tricky. There are several functions, even classes, that are only available for either AI or Goal. And that might work confusing. I am not absolutely set that the current way is also the way to go, although it is most clean. It basically leans on the fact that there cannot be a library that works for AIs and Goals alike, as they both serve a different goal. It is said to be unlikely that you can develop AIs in the same way as Goal scripts, and they both will have their own set of documentation. Having one prefix for both would be more confusing. That said, this is still work in development, nothing set in stone. We will take your remarks regarding it with us next time I bring up prefixes :D

(PS: NoGo doesn't support libraries, and at the moment it is also not planned to add them. Any kind of library should be prepacked with the Goal script itself).

_________________
The only thing necessary for the triumph of evil is for good men to do nothing.


Top
   
PostPosted: Tue Nov 22, 2011 11:24 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4532
Location: /home/sweden
The parts of SuperLib that I found that I would like to use already are Tile, Direction and Helper. These could of course be packed in a NoGo script semi-automatic if OpenTTD will not support NoGo libraries.

But if a NoGo script later want to inspect orders or work with other things, I see that more parts would be useful.

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


Top
   
PostPosted: Wed Nov 23, 2011 1:40 pm 
Offline
Engineer
Engineer

Joined: Wed Nov 22, 2006 12:49 pm
Posts: 3
This is easily the greatest improvement to the base game of TTD i've seen added to OpenTTD. This needs to be stabilized ASAP, made configurable via the GUI and been included in the usual builds from now on. It's made the game fun without having to hack away for hours, or without having to go online. Once some rulessets have been created, perhaps we can have a section in Bananana so people can download new rulesets from the main game too.

Would love to help out on this project if I can! Anything to get this into the mainline codebase as quick as possible!!!

PS. Can you tell I LOVE this patch!


Top
   
PostPosted: Wed Nov 23, 2011 7:40 pm 
Offline
Tycoon
Tycoon

Joined: Tue Feb 22, 2011 6:34 pm
Posts: 2597
If I understand the changelog for r23310 correctly, it is now (partially) in trunk.

_________________
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML


Top
   
PostPosted: Wed Nov 23, 2011 7:44 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Mon May 31, 2004 9:21 am
Posts: 1292
Transportman wrote:
If I understand the changelog for r23310 correctly, it is now (partially) in trunk.

I am sorry, but it is not.

I did commit some updates for the TownGUI (it now shows a bit more information about what is going on), and also prepared it for a solution like NoGo (although it can also be used by anything else). And I added the long overdue ability for AIs to see if a town needs food or water (they couldn't so far).

As a nice side effect it did make my patch-queue a lot shorter, but there is no NoGo code yet in trunk.

_________________
The only thing necessary for the triumph of evil is for good men to do nothing.


Top
   
PostPosted: Wed Nov 23, 2011 11:20 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Mon May 31, 2004 9:21 am
Posts: 1292
Pushed a new version, and added the documentation (with a big hug to Yexo for supplying the script for it):

http://devs.openttd.org/~truebrain/nogo ... tated.html

_________________
The only thing necessary for the triumph of evil is for good men to do nothing.


Top
   
PostPosted: Thu Nov 24, 2011 1:52 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Fri Jan 19, 2007 7:26 pm
Posts: 326
I guess he wants you to be able to use your time for the patch itself. As does everybody. Can I do your dishes? ;)


Top
   
PostPosted: Thu Nov 24, 2011 6:29 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Mon May 31, 2004 9:21 am
Posts: 1292
I just pushed a new version. Some very important (breaking) changes:

Naming has changed. GoalScripts are now GameScripts, to represent more what this is. This means that all references to 'goal' are replaced by 'game', and you need to move your Goal (now Game) script to the 'game' folder.

Naming inside the script has also been changed. GoalNNN now is GSNNN, where GS stands for GameScript. This is done because writing GS 100 times is easier than writing Goal 100 times. It also matches better with AI, 2 letters, capital, clear, obvious, to the point.

Some other additions:

- Events now work (well, did yesterday already, but now I tell you about it). Not all events are added yet, check documentation about which event classes (not enums) are available.
- At mapgeneration, the GS is now also called. This is important: you can run for at most 2500 ticks (which is a very long time), but as soon as you execute 'this.Sleep(1)', your script aborts till the game starts up. It would be very wise to include this sleep, else map generation will take unneeded long. During those 2500 ticks you can do everything you like, including DoCommands. They are executed instantly (without the delay you normally experience), which should allow every GS to do the wildest things on map generation, and have the map ready to play as soon as that is all done.

I hope you all like these improvements. And for those who wonder, this project is still called NoGo ;)

Questions, comments, feedback: let me know!

_________________
The only thing necessary for the triumph of evil is for good men to do nothing.


Top
   
PostPosted: Thu Nov 24, 2011 7:07 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 21, 2007 11:47 am
Posts: 6559
Location: The Netherlands
TrueBrain wrote:
the 'game' folder

So now there's a "game" folder that doesn't contain the game itself... I understand the change, but this is confusing at best.

Apart from that I think this is going to prove an awesome feature! Great job!

_________________
FooBar's Tram Tracks | TransRapid Track Set | Metro Track Set | OpenGFX base graphics set | FIRS Industry Replacement Set
Dutch Tram Set | Dutch Trainset 2 | Dutch Road Furniture


Top
   
PostPosted: Thu Nov 24, 2011 7:22 pm 
Offline
Engineer
Engineer

Joined: Wed Nov 07, 2007 10:04 am
Posts: 118
I think its a very cool feature, keep up the goodwork.

If you want consistency in the naming, you could thank about using NG.

Just like AI.


Top
   
PostPosted: Thu Nov 24, 2011 7:25 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Mon May 31, 2004 9:21 am
Posts: 1292
FooBar wrote:
TrueBrain wrote:
the 'game' folder

So now there's a "game" folder that doesn't contain the game itself... I understand the change, but this is confusing at best.

Apart from that I think this is going to prove an awesome feature! Great job!

I don't think it is that confusing; at best people might thing the executable has to go there, and even then the game works :P But this is still WIP .. will have to see how I like this. At least it feels better than Goal so far :)


Valentijn wrote:
I think its a very cool feature, keep up the goodwork.

If you want consistency in the naming, you could thank about using NG.

Just like AI.

I totally fail to see the relation between NG and AI :P We have NoGo and NoAI framework ... NG and NA I can see ... ;)

_________________
The only thing necessary for the triumph of evil is for good men to do nothing.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 321 posts ]  Go to page 1 2 3 4 517 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-2017 phpBB Limited

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