i need trains.. lots of trains..

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
User avatar
PDsiRF
Engineer
Engineer
Posts: 73
Joined: 28 May 2004 13:35

i need trains.. lots of trains..

Post by PDsiRF »

i changed the number of maximum vehicles to 4096 (obviously 2048 is not enough) and now with 2200 vehicles in game some trains are skipping orders (never know wich train).

for example train going from station A to D via B,C and back suddenly skips rest of its orders and is going back to station A without unloading at station D (they usually reach D station and drive straight trough) i think orders of the another train is affecting to orders of the skipping train. These problem trains are using shared orders, though it does not change the situation when i just copy them. Setting pathfinding to new / old does not affect. i'm not sure if some single train (using its own special orders) is doing this.

Has anyone else had this kind of problem before or am i just doing something wrong (except building too many trains)

edit: increasing order_array to 10000 did not solve this problem.
i started a new game (with edited version) and built couple of maglevs and they were skipping orders..
i also loaded the game with 2200 vehicles with non edited openttd and it works exactly the same... except i cant build more vehicles.

I think theres something in the order handling, it was not in "cmd skip orders".

edit2: i started a new game, with game modified only on factory starting production levels, and for a change the trains were skipping orders (maglev-trains), i havent seen a normal train skipping orders, so could it be maglev related?

things that i edited was:
- changed max vehicles to 4096 first, later 3072 and special vehicles to 1024 first, later 768.
- Doubled industry starting production rates (messed it a bit to make factories / sawmills produce valuables)
- Disabled decrease industry production, by making it as a comment.
Attachments
here is screenshot from the game, featuring two trains (with shared orders) wich just have skipped orders and are heading back to station A.
here is screenshot from the game, featuring two trains (with shared orders) wich just have skipped orders and are heading back to station A.
ordersnotworking.png (128.55 KiB) Viewed 739 times
savegame.zip
savegame. including about 2200 vehicles. meanin that it does not load with non-edited openTTD.
(154.5 KiB) Downloaded 262 times
it wasnt me..
User avatar
dominik81
OpenTTD Developer
OpenTTD Developer
Posts: 768
Joined: 16 Aug 2003 12:55
Location: Bonn, Germany

Post by dominik81 »

That's the reason why you can't build that many vehicles in any official release, not even in SVN. You are welcome to fix this issue though and we'll happily apply it to the current SVN. :D
"There's a readme that comes with the source. I suggest you read it."
- Korenn
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

I am looking in to the problem, and as far as I can see, it has NOTHING to do with the changes you made. Even an unchanged 0.3.2.1 game has that effect.. it has to do with the nonstop TTDPatch option. If you had used checkpoints instead of the nonstop TTDPatch option it worked perfectly. Now you use normal stations and non-stop, it is kind of failing..

For your information: I increased the max vehicles to 4096 and started your game without the nonstop TTDPatch and it worked perfectly. I don't see why this can't be changed in SVN (max vehicles to 4096 or something). The only limit is created by the savegame, the << 14, which makes a max of 2^14, which is 16384. You can't increase the amount of vehicles above that number, without altering the savegame routine.

Just my two pennies..

(ps: looking into the problem of nonstop TTDPatch..)
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

Okay, found and solved the problem. Why it happened randomly I don't know, possibly a glitch in the function calls (e.g. if VehicleEnter_Station() is called twice for one train before it moved, such glitches can happen..)

I don't know if this is the place to post some code, but here it goes.

In station_cmd.c, change in VehicleEnter_Station():

Code: Select all

				if (_patches.new_nonstop && (v->next_order & OF_NON_STOP)) {
					v->cur_order_index++;				
				} else if (v->next_order != OT_LEAVESTATION && v->last_station_visited != station_id) {
to

Code: Select all

				if (_patches.new_nonstop && (v->next_order & OF_NON_STOP)) {
// A non-stop station with nonstop TTDPatch enabled should feel like a checkpoint.. so moved to train_cmd.c in ProcessTrainOrder().				
//					v->cur_order_index++;				
				} else if (v->next_order != OT_LEAVESTATION && v->last_station_visited != station_id) {

In train_cmd.c, change in ProcessTrainOrder():

Code: Select all

	// check if we've reached the checkpoint?
	if ((v->next_order & OT_MASK) == OT_GOTO_CHECKPOINT && v->tile == v->dest_tile) {
		v->cur_order_index++;
	}


	// Get the current order

to

Code: Select all

	// check if we've reached the checkpoint?
	if ((v->next_order & OT_MASK) == OT_GOTO_CHECKPOINT && v->tile == v->dest_tile) {
		v->cur_order_index++;
	}
	// check if we've reached a non-stop station while TTDPatch nonstop is enabled..
	if (_patches.new_nonstop && v->subtype == 0 && (v->next_order & OF_NON_STOP) && v->next_order_param == _map2[v->tile]) {
		v->cur_order_index++;
	}


	// Get the current order

This way the problem is gone. Maybe someone wants to optimalize is, or post it to SVN, see what you want to do with it, and good luck!
User avatar
PDsiRF
Engineer
Engineer
Posts: 73
Joined: 28 May 2004 13:35

Post by PDsiRF »

woohoo... thanks man. :) Seems to work ok now ... until i come up with another jackass bug.. ;)
it wasnt me..
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

Challange me ;)
Greeny
Engineer
Engineer
Posts: 102
Joined: 14 Apr 2004 02:17
Location: Australia

Post by Greeny »

How can i get this game to work?? only tell me if it's not to hard

If possible could you tell me in english
User avatar
PDsiRF
Engineer
Engineer
Posts: 73
Joined: 28 May 2004 13:35

Post by PDsiRF »

you can make this game to work. :P

but what seems to be the problem?

edit: :oops: you mean loading that savegame?
you need to alter the sourcecode for that and compile it.

theres these lines in vehicle.h in line number 344 and 345
NUM_NORMAL_VEHICLES = 2048,
NUM_SPECIAL_VEHICLES = 512,

change them to (for example):

NUM_NORMAL_VEHICLES = 4096,
NUM_SPECIAL_VEHICLES = 1024,

that should do it.
it wasnt me..
the_marshal
Engineer
Engineer
Posts: 36
Joined: 15 Mar 2004 17:08

Post by the_marshal »

Or if you want to do it the easy way just dl a nightlybuilds... the savegame does load with it ;)

http://openttd.rulez.org/download/nightlybuilds/

BTW the savegame is simply impressive !
User avatar
PDsiRF
Engineer
Engineer
Posts: 73
Joined: 28 May 2004 13:35

Post by PDsiRF »

actually i managed to load that savegame too with non-edited version.. not sure if it works as it should (all vehicles loaded?), but at least there was no way to build more vehicles.

and you also have to change the lines TrueLight mentioned so the trains will work as they should.

maybe i can upload or email fixed .exe if somebody needs it.
it wasnt me..
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

In the latest SVN the problem is also fixed. So fetching the nightly build should be enough :)
User avatar
PDsiRF
Engineer
Engineer
Posts: 73
Joined: 28 May 2004 13:35

Post by PDsiRF »

i compiled the latest svn but it crashed before it even got started...

btw: that savegame does not load with svn, vehicles are still limited to 2048 (and you still need to compile it).

what comes to compiling the source, i just amaze myself being a moron.
it wasnt me..
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 25 guests