Raising number of available engine types to 8192 per type

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

User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Raising number of available engine types to 8192 per type

Post by Bilbo »

I thought about a way to allow more engine types loaded via NewGRF's at once

Since GRF specs have engine ID as extended byte, theoretically nothing would limit having as much as 65536 engines of each type (road vehicle, aircraft, ...)

Problem is, there are only 255 usable slots, in them there are four ranges (116 trains, 88 road vehicles, 11 ships and 41 aircrafts)

Basically, you can only replace vehicles in these ranges and you cannot have more of them than is size of the range. You can't replace "empty slots" with some vehicle.

I thought of converting the common pool of 255 engines to separate dynamic pools, each of them would be preallocated to its 'default' size (116 items for trains, ....) and reallocated as necessary, having maximum of 8192 items in it.

Any vehicle could replace the empty slot with some vehicle (of course all of its properties hagve to be defined for the vehicle to be usable)

I set the new implementation limit to 8192 engine types per class (8192 road veh types, 8192 train types, ....), as this is quite enough (raising current limit almost 80 times for trains, even more for other vehicle types) and raising the limit further will make some things somewhat more complicated.

Advantages:
* Old GRF's will still work as usual.
* Old GRF's that can take advantage of variable vehicle ID's can work as usual, but it could be remapped from replacing default vehicles to replacing "empty slots", thus allowing combining vehicles in that GRF with other grf's vehicles or with default vehicles.
* New code fully aware of this change can use all the slots. 300 engine types in single GRF? no problem :)

(Variable vehicle ID's are described at http://wiki.ttdpatch.net/tiki-index.php ... eVehicleID )

Disadvantages:
* new code using this feature to the fullest extent (specifying too many engines) won't work currently in ttdpatch. Could be "solved" by detecting for ttdpatch or older openttd version and switching off the extra engines if this feature is not supported. That way GRF will still load, though only with subset of all its engines.
* The changes required for this to fully work are rather complex.

I decided to split the work into two phases:
Phase 1: replace the common static pool with 4 static pools of some "reasonably small size" (currently 512 vehicles)
Phase 2: make the pools really dynamic (upping the limit to 8192 engines)

I am attaching some preview of this patch (currently halfway to phase 1). In current state it is not even compilable, as in many places the old common pool is still used. But you can see the way in which the changes are to be taken.

I want some feedback from the people, especially from devs:
Would this feature be useful?
Would this be a good way to solve that limitation?
Attachments
engine_pool_rewrite-11939.diff
preview of the patch
(24.53 KiB) Downloaded 140 times
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1794
Joined: 30 Mar 2005 09:43

Re: Raising number of available engine types to 8192 per type

Post by peter1138 »

Sorry, but all the work to turn engines into a dynamic pool has already been carried out.
He's like, some kind of OpenTTD developer.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Raising number of available engine types to 8192 per type

Post by DaleStan »

*blink*
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Raising number of available engine types to 8192 per type

Post by michael blunck »

Yes, I saw it in the other thread:

Image

Problem is how to configure such a feature. Just (mis-)using it to load multiple vehicle sets in parallel wouldn´t be a good thing, IMO [*]. O/c, the audience will just demand it for that purpose - as usual.

[*] I´ll elaborate on this if/when needed.

regards
Michael
Image
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Raising number of available engine types to 8192 per type

Post by DJ Nekkid »

as earlier proposed, it should be devided into sections/tabs ... "DFLT" - "DBXL" - "UKRS" - "NARS" or something, but that _might_ need some kind of NEW action 4 property or something...
Member of the
ImageImage
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Raising number of available engine types to 8192 per type

Post by Bilbo »

peter1138 wrote:Sorry, but all the work to turn engines into a dynamic pool has already been carried out.
What? Where, in one of the branches?
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1794
Joined: 30 Mar 2005 09:43

Re: Raising number of available engine types to 8192 per type

Post by peter1138 »

michael blunck wrote:Problem is how to configure such a feature. Just (mis-)using it to load multiple vehicle sets in parallel wouldn´t be a good thing, IMO [*]. O/c, the audience will just demand it for that purpose - as usual.
Correct. The screenshot was just to show what is possible.

One of the main advantages is being able to have more earlier and later vehicles, as well as the much forgotten limit on the number of seafaring vehicles...

However, if you would like to elaborate on your own concerns and perhaps suggest a possible solution, let me know.
7of9 wrote:as earlier proposed, it should be devided into sections/tabs ...
Or just don't load so many contrasting sets. With a well design set of sets (as it were) it shouldn't be necessary.
Bilbo wrote:What? Where, in one of the branches?
In a local patch (distributed to some testers on IRC) that I updated from a patch that I originally made in June 2006.
He's like, some kind of OpenTTD developer.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Raising number of available engine types to 8192 per type

Post by Bilbo »

peter1138 wrote: One of the main advantages is being able to have more earlier and later vehicles, as well as the much forgotten limit on the number of seafaring vehicles...
11 ships is way too small amount .... while ships in general are not very good, having only 11 of them won't help that either.
peter1138 wrote: Or just don't load so many contrasting sets. With a well design set of sets (as it were) it shouldn't be necessary.
Some way to filter out the engines displayed could be done relatively easily later. Some way is already done now: http://tt-forums.net/viewtopic.php?f=33&t=35805 (build and refit patch able to filter out the vehicle list)

If you combine some reasonable sets (like UK, DB XL and CSD sets for europe scenarios), you could have well-looking railway scenario ... best would be to filter by sets, but that would probably require enhancing newgrf specs to support this.
peter1138 wrote:
Bilbo wrote:What? Where, in one of the branches?
In a local patch (distributed to some testers on IRC) that I updated from a patch that I originally made in June 2006.
Is that patch available somewhere?

Maybe it would be good to improve it so it would end up in trunk .. perhaps I can help with that :)
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Kumagoro
Engineer
Engineer
Posts: 58
Joined: 21 Oct 2004 15:29

Re: Raising number of available engine types to 8192 per type

Post by Kumagoro »

Any progres going on? That would be a nice feature neer-to-be-seen in TTDpatch ;)
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1794
Joined: 30 Mar 2005 09:43

Re: Raising number of available engine types to 8192 per type

Post by peter1138 »

Kumagoro wrote:Any progres going on?
It is being kept up-to-date.
He's like, some kind of OpenTTD developer.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Raising number of available engine types to 8192 per type

Post by chrissicom »

Do your efforts also take into account that the Japan set for example has a special track for the Shinkansen? Does it work to use the DB XL and Japan Set for example so the modified Shinkansen tracks are actually added as a new track instead or replacing an old one and thus making lots of the DB XL trains unusable due to track limitations.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1794
Joined: 30 Mar 2005 09:43

Re: Raising number of available engine types to 8192 per type

Post by peter1138 »

No. That is a totally separate feature and concept to just adding more engine types.

And yes, I do have some plans for that...
He's like, some kind of OpenTTD developer.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Raising number of available engine types to 8192 per type

Post by MagicBuzz »

peter1138 wrote:No. That is a totally separate feature and concept to just adding more engine types.

And yes, I do have some plans for that...
Hello,

I bump this thread as I don't know which "dynamic engine pool" is used in the Gonozal pack.
But I found a quite anoying bug in this , and another one that I think is related with.
- When you start using different vehicles of different sets, the "autoreplace" window is completely stuck. It looks like it recognize your vehicles only based on the firt (or last) GRF loaded. So you see trains you never built and you can't find the trains you actually uses. This make the feature totally useless.

- The other bug is about the "vehicle enters in depot". I'm not sure it's related, I can't find exactely which bug produce this. But it looks like it's a side effect of this patch. When a vehicle enters a depot for autorenew/autoreplace, if you have a window opened on the vehicle, then the game crash with a problem in the string.cpp file. It looks like it can't find the string to display. The bug doesn't happen if you close the vehicle window before it replaces itself.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1794
Joined: 30 Mar 2005 09:43

Re: Raising number of available engine types to 8192 per type

Post by peter1138 »

I don't experience those problems with just the engine pool patch applied. It could however be just a combination of vehicles which causes issues.
He's like, some kind of OpenTTD developer.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Raising number of available engine types to 8192 per type

Post by Bilbo »

MagicBuzz wrote: I bump this thread as I don't know which "dynamic engine pool" is used in the Gonozal pack.
Surely not my code from this thread, as it is not even compilable. Unless he managed to finish it. I looked at the http://fuzzle.org/o/ from where the enginepool code for gonozal pack was taken ans that is not my code (or if it ever was, it was changed beyond any recognition :)
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Raising number of available engine types to 8192 per type

Post by MagicBuzz »

peter1138 wrote:I don't experience those problems with just the engine pool patch applied. It could however be just a combination of vehicles which causes issues.
Is "http://fuzzle.org/o/" your patch ?

I experience the problem with UKRS + Add-on 4 and DBXL together.

I'll do some deeper tests and give you the exact configuration I use to reproduce the problem.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Raising number of available engine types to 8192 per type

Post by MagicBuzz »

Hmmm, quite strange...

I tried to reproduce the problem, but i'm unable to reproduce it again.
And the savegame where I found the problem... just work fine now !

Looks like the game got stuck after a moment, and repaired itself when reloading the game...
I hope it's just something wrong with my version, or the bug will be hard to find :(
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Raising number of available engine types to 8192 per type

Post by MagicBuzz »

It happens again on my favorite saved game :/

Here is a detailed post about the problem with a savegame, a screenshot, GRF settings and comments
http://www.tt-forums.net/viewtopic.php?p=672207#p672207
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Raising number of available engine types to 8192 per type

Post by Wolf01 »

another post in a row and you win a teddy bear :/


I have one little question: I think not all sets will be compatible, at least with the 'only' three available track types, I know the Japan set uses the maglev tracks for the Shinkansen, so the sets may look weird... how do you plan to handle this?
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Raising number of available engine types to 8192 per type

Post by MagicBuzz »

chrissicom already asked this (8 posts ago) and peter answered "And yes, I do have some plans for that...".

ps: and if you take a look at my posts, you'll see, there is an interval of more than 12 hours between the 2 first, and more than 24 hours with the next one. do you really think i should have a chance to get read if i edited posts 36 hours later ?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 5 guests