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

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

Re: NoGo - A Scriptable Game Framework

Post by TrueBrain »

Hyronymus wrote:
Alberth wrote:If one interprets gameplay as everything outside graphics, then your settings of vehicle speed/cost/cargoes are already gameplay. I doubt however that you want to drop those from the NewGRF :p
Gameplay to me is how the game is designed to work - independent of which vehicle sets you use.
I think it was generally understood that you meant that ;) And this is the 'issue' with NewGRFs. Because it was the only available tool a lot of features are put inside there: because you can. But now with this alternative coming up, it is hard to redefine such line. At least we have to be gentle with it :)

But let the ideas coming, in the worst case it is helping :)
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
Expresso
Tycoon
Tycoon
Posts: 1760
Joined: 09 Aug 2004 00:14
Location: Gouda, the Netherlands

Re: NoGo - A Scriptable Game Framework

Post by Expresso »

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.
bokkie
Transport Coordinator
Transport Coordinator
Posts: 327
Joined: 19 Jan 2007 19:26

Re: NoGo - A Scriptable Game Framework

Post by bokkie »

Could a script detect industry NewGRF's and act accordingly? Such as: disable its industry-related parts, show a red box with a warning (now that always works like a charm doesn't it? ;)), disable the NewGRF, ... ?
User avatar
Dave
Moderator
Moderator
Posts: 17243
Joined: 26 Dec 2005 20:19
Location: North London

Re: NoGo - A Scriptable Game Framework

Post by Dave »

Expresso wrote:It's disturbing to me that newGRF seems to be considered holy for some reason.
It has its flaws, but let's not forget how kind the NewGRF system has been in improving the game over the last few years, from way back when with the patch.

Although I'm not adverse to change, I think it would be dangerous to not hand the GRF system some standing, merely for the impact it has had on the game. Overhauling the system in a serious way would not sit well with me (not that my opinion counts).
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework

Post by TrueBrain »

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.
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.
bokkie wrote:Could a script detect industry NewGRF's and act accordingly? Such as: disable its industry-related parts, show a red box with a warning (now that always works like a charm doesn't it? ;)), disable the NewGRF, ... ?
I am considering adding an API to query which NewGRFs are active. And we have some solution under review which might solve some things .. time will tell ;)

That all said and done, there are some solutions to these problems under review, and I would like us to continue this thread coming up with other stuff we need / want / could use :)
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

Post by TrueBrain »

Dave W wrote:
Expresso wrote:It's disturbing to me that newGRF seems to be considered holy for some reason.
It has its flaws, but let's not forget how kind the NewGRF system has been in improving the game over the last few years, from way back when with the patch.

Although I'm not adverse to change, I think it would be dangerous to not hand the GRF system some standing, merely for the impact it has had on the game. Overhauling the system in a serious way would not sit well with me (not that my opinion counts).
Part of OpenTTD is NewGRF, and that is unlikely to change. It has a huge impact on the game and its gameplay. Which makes it awesome. As far as NoGo goes, there will be no serious overhauling of NewGRFs, as that is not the goal of this project. In contrary, NewGRF will most likely get some extensions to communicate at a few places more clear information to OpenTTD, and with that, to NoGo. It is in nobodies interest to change NewGRF, as it is already a proven solution.
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
Dimme
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 30 Jul 2008 12:42
Location: Trondheim, Norway

Re: NoGo - A Scriptable Game Framework

Post by Dimme »

dihedral wrote:Why tamper with the amount of cargo an industry produces - i'd rather want to influence how much of that produced cargo goes to a certain player
that way the newgrf has no issue, as it still controlls its cargo as it should, and the script can still influence the game play
+1 :D

I'd suggest starting by adding in the effects that currently cannot be controlled by newGRF's, like the above and:
  • Subsidies
  • Which players get the opportunity to test new vehicles, and possibly change when (other than just one year ahead).
  • Some variables that are currently game settings, like the interest rate, and how much loan can be taken.
Try my modular airports minigame!

Image
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: NoGo - A Scriptable Game Framework

Post by Hyronymus »

In which direction are you looking, TrueBrain? We don't mind giving suggestions but they may be more easily applicable if we get an idea where this script is going to / what it is trying to regulate.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework

Post by TrueBrain »

That is exactly what we are trying to establish here :) In the first post are a few things I would like to be done, but of none I am sure if it will or can :)
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
Dave
Moderator
Moderator
Posts: 17243
Joined: 26 Dec 2005 20:19
Location: North London

Re: NoGo - A Scriptable Game Framework

Post by Dave »

Well as I didn't in my first post in this thread, congratulations on realising the potential of this idea, I will follow it with great interest!
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: NoGo - A Scriptable Game Framework

Post by Hyronymus »

What kind of news messages do you foresee being trighered by NoGo? What would be fun is:
- new speed record per vehicle class (upon highest reached speed)
- crowded vehicles on station 1 (upon consecutive vehicles stopping at a station and fully loading x times in a row)
- signal failure (upon a signal showing red for a given time)
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework

Post by TrueBrain »

Today I present to you a new version of NoGo. It is getting pretty finished, as far as the framework itself goes.

Via the AI Configuration window in the main menu you can now select which GameScriptshould be used. Default is none. It is the entry above "Human player", but hopefully that is obvious enough (for now anyway). The GUI needs a bit of work to make it more clear what is going on, but at least you can select a GameScript and configure it (GetSetting now works too!). With this, GameScript now works the same as AIs. Everything is nicely stored in the configuration file, and saving a game also saves which GS was active, and saves his Save() result.

Check my http://devs.openttd.org/~truebrain/nogo/main.nut.txt how to safely Save/Load. My script atm only initializes once, and after that it just keeps updating the goals. Works pretty smooth as far as I can see :)

I have plugged a bunch of bugs, holes and crashes. This build should not crash or give you any problem (except for possibly a somewhat unclear GUI). Any issues you notice, please let me know ASAP, as I am most likely unaware of them.

As far as I am concerned, there is only little work left (except of course adding API functions ;)). BaNaNaS is not made aware of GameScripts yet, and that won't be done till this is included in trunk (note: this is no promise it will be included in trunk, just giving the indication of timeline here ;)). Most of the code is (correctly) re-factored, and the real patch is rather small (which is always a good thing).

Questions / problems / crashes, let me know!
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

Post by TrueBrain »

A critical bug prevented network clients from joining. New release is being build as we speak (and most likely ready by the time you read this). Tnx to Xaroth for noticing :)
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

Post by TrueBrain »

And today, like I have no life, another version. This time the GUI is completely patched up, and a few bugs and holes are plugged once more. Code has been proof-read by a few, so it should be very stable by now.

Please do let me know if you experience any crashing of any kind.
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

Post by TrueBrain »

To finish my reply-spree, yet another version. Lots of little (non-coding) tweaks, to make things pixel perfect :)
The only thing necessary for the triumph of evil is for good men to do nothing.
Xaroth
Engineer
Engineer
Posts: 103
Joined: 01 May 2006 09:09

Re: NoGo - A Scriptable Game Framework

Post by Xaroth »

Nice work, TrueBrain.. already updated my servers to the latest, loving it :)
Lead Manager of OpenDUNE
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: NoGo - A Scriptable Game Framework

Post by Hyronymus »

Just saw Michi updated the Infrastructure Cost patch against trunk. Is that an example of things can (also) be achieved with NoGo, TrueBrain?
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework

Post by TrueBrain »

Not really my aim atm. But influencing how much it costs, that would be possible. In general, influencing the inflation would be nice I would guess.
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

Post by TrueBrain »

A quick update (this is become a blog :P):

Today I added bi-directional communication to (and from) the AdminPort. There is no new binary yet which has this feature, as I need someone to validate my work on security, but initial tests works great :D

From Squirrel you do:

GSAdmin.Send(<Squirrel Table>), for example:

GSAdmin.Send({ param1 = false, param2 = 2, param3 = "param3", param4 = {param4a = 10, param4b = "string"}, param5 = [b, 56] });

This is then received by the connectors on the AdminPort (who registered for GAMESCRIPT) as a JSON string. All modern languages know how to convert a JSON string to their native structure, so you should be fine there.

The other way around works too. On the AdminPort you send a JSON string, and the GS receives:

Code: Select all

			switch (e.GetEventType()) {
				case GSEvent.ET_ADMIN_PORT:
					local ec = GSEventAdminPort.Convert(e);
					local data = ec.GetObject();
					GSLog.Info("Admin Port:");
					foreach (key, value in data) {
						GSLog.Info("  " + key + ": " + value);
					}
					break;
			}
to just put it in plain code.


I am sure this will make many many many many people really really really happy, so I do accept kudos :) I cannot imagine how this will be used, but I am sure it will be in ways I did not intend :D And it will be ... EEEPPPIIICCCCCC
The only thing necessary for the triumph of evil is for good men to do nothing.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: NoGo - A Scriptable Game Framework

Post by Eddi »

wait... no XML?!? :p
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 46 guests