CPU usage and (rail) network optimization

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Post by Wolf01 »

get a faster computer
that is not a solution, i bought this laptop a year and some monts ago and it can run new games very well
a solution is to optimize the code instead!
the map is already auto-generated with small number of towns, those games on large maps starts well, when towns start to grow, the game starts to slow down
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

Wolf01 wrote:
get a faster computer
that is not a solution, i bought this laptop a year and some monts ago and it can run new games very well
a solution is to optimize the code instead!
the map is already auto-generated with small number of towns, those games on large maps starts well, when towns start to grow, the game starts to slow down
you missed out the :P in the quote. It was not a serious statement.

I didn't learn what needed to calculate the distance to the town all the time, and that is a must before we can do anything about this. The distance calculation on it's own can't be made any faster, so a speedup can only be to call it less times.
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2567
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Can't the distance to the town be cached in the map array?
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

Brianetta wrote:Can't the distance to the town be cached in the map array?
it needs a pointer to the nearest town, not just a distance and the current map array haven't got room for a whole pointer.
I did wonder about adding more room for such a pointer, but I didn't get past the "starting to wonder" stage.
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 5 guests