Patch: Found a town

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

Post Reply
Kikisss
Engineer
Engineer
Posts: 16
Joined: 24 Aug 2008 11:03
Skype: kikis-007
Location: Latvia

Re: Patch: Found a town

Post by Kikisss »

Hi i have problem with that compiled patch it say -

Code: Select all

Error!
Failed to find graphic set. Please acquire a graphic set for OpenTTD
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Patch: Found a town

Post by burty »

Kikisss wrote:Hi i have problem with that compiled patch it say -

Code: Select all

Error!
Failed to find graphic set. Please acquire a graphic set for OpenTTD
Can someone please verify this error?
If i am thinking right you need the latest nightly data folder but can some please check this for me, many thanks,
Ben (Burty)
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Found a town

Post by belugas »

SirXavius wrote:Gentlemen, i would like to motion that this patch be inducted into the trunk.
I should deny the trunk inclusion at present stage.
The basics of that patch has not yet been proven (as far as i know and am concerned) been tested against desynchs.
As I mentioned before, the prices have not been discussed and adjusted, if ever required.
The gui is still yurk (in my mind, at least).

And i'm sure almost no one really tested it.

And for those who wish some more features ALREADY, please, refrain your envy before the patch becomes a monster.
Let's concentrate on the basics of it.
And remember, I am not working on it anymore, it's up to the users to take the helm.
IT MEANS YOU ALL!! :twisted:
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Found a town

Post by Roujin »

belugas wrote: And remember, I am not working on it anymore, it's up to the users to take the helm.
IT MEANS YOU ALL!! :twisted:

Good, then I'm gonna jump in here and see what I can do.

Just tried it out and noticed two things.

1) There still seem to be some issues with town name generation. Out of ten or so consecutively founded towns, I got five called "Invenville".
2) In my opinion, it shouldn't be possible to found big towns. How funny is that? Suddenly a big city pops out of nowhere? Nah... you can still found a small one and then grow it by providing good transportation.

Okay, that's it for now, going to test some more soon..

edit:

3) Multiplayer currently desyncs as soon as one player presses the "Found town" button. Yes, not as soon as he actually founds the town, but as soon as he clicks the button. That probably means that still a town name is generated in the GUI code.
edit²: ah, now I understand the intention with the town names... but still it desyncs, so I'll have to do something about that later. Got to get some food now first, though ;)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Found a town

Post by Roujin »

I have solved Problem 3) in my local copy by using InteractiveRandom instead of Random in the town name generation code. I guess that was also belugas' intention but he forgot to change it ;)

Now, it works in multiplayer if it's the server who founds a town. Other players are getting kicked for it :twisted: because the command is marked as "offline only". I'll look into this now and next look at the "Invenville" issue.

What do others think about my point 2)?
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Patch: Found a town

Post by burty »

Roujin wrote:I have solved Problem 3) in my local copy by using InteractiveRandom instead of Random in the town name generation code. I guess that was also belugas' intention but he forgot to change it ;)

Now, it works in multiplayer if it's the server who founds a town. Other players are getting kicked for it :twisted: because the command is marked as "offline only". I'll look into this now and next look at the "Invenville" issue.

What do others think about my point 2)?
I agree with you that a big town just appearing is weird even medium towns just popping up is possibly pushing it.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Found a town

Post by Roujin »

burty wrote:I agree with you that a big town just appearing is weird even medium towns just popping up is possibly pushing it.

I thought so too. Then again, placing small towns often results in something like two houses, which is not even enough to accept passengers or mail. (Heck I just got one with only a church oO)...


---
Well, made the command non-offline-only and now other players can too found towns.
Unfortunately it's still not absolutely multiplayer safe. Got a "network synchronisation failed" after some time now :/
Maybe it's related to the "Invenville" mystery... gotta investigate a bit more.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
SirXavius
Transport Coordinator
Transport Coordinator
Posts: 302
Joined: 28 Jun 2006 18:25
Location: Florida

Re: Patch: Found a town

Post by SirXavius »

belugas wrote:
SirXavius wrote:Gentlemen, i would like to motion that this patch be inducted into the trunk.
I should deny the trunk inclusion at present stage.
The basics of that patch has not yet been proven (as far as i know and am concerned) been tested against desynchs.
As I mentioned before, the prices have not been discussed and adjusted, if ever required.
The gui is still yurk (in my mind, at least).

And i'm sure almost no one really tested it.

And for those who wish some more features ALREADY, please, refrain your envy before the patch becomes a monster.
Let's concentrate on the basics of it.
Thanks belugas, for a reasoned approach. I was under the assumption it was ready to go. But no new feature should risk the stability of even the nightlies, much less the trunk.... I may have seemed a bit impatient because i'm unable to build anything with patches due to memory and emulation constraints....


And thanks Roujin for testing it, and determining what important things need to be done before proceeding.
I agree, small towns should be the only ones popping up. Even if a major corporation started a "work village" it would start out as a small camp.
Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

Re: Patch: Found a town

Post by Vikthor »

SirXavius wrote:But no new feature should risk the stability of even the nightlies, much less the trunk....
You should know that nightlies are being created automatically from trunk, therefore you can not risk stability of nighlies without risking stability of trunk :wink:
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Patch: Found a town

Post by burty »

Vikthor wrote:
SirXavius wrote:But no new feature should risk the stability of even the nightlies, much less the trunk....
You should know that nightlies are being created automatically from trunk, therefore you can not risk stability of nighlies without risking stability of trunk :wink:
i believe he means the trunk official releases 0.4.7, 0.6.0 as opposed to nightlies!
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Found a town

Post by belugas »

Roujin wrote:
burty wrote:I agree with you that a big town just appearing is weird even medium towns just popping up is possibly pushing it.
I thought so too. Then again, placing small towns often results in something like two houses, which is not even enough to accept passengers or mail. (Heck I just got one with only a church oO)...
We do share the same impression. That is good :D
As for the desynchs happening after town is created, i'd go searching in the roads layout mechanism.
But somehow, i doubt it's that, since townds can grow safetly in MP mode...
One thing for sure, town creation was never meant to be MP safe, so it's expected to find multiple desynch causes.

As for the size of the town, maybe a minimum size can be specified, since the size (apart from small-medium-big) is actually a random value

Good Job Roujin, by the way :mrgreen:

[Edit]This code, in DoCreateTown, might very well be another subject of desynchs [/Edit]

Code: Select all

/* Random town size. */
int x = (Random() & 0xF) + 8;
[Edit-1]Same funciton, just a few lines after: [/Edit-2]

Code: Select all

case TSM_FIXED:
		x = size * 16 + 3;
		t->larger_town = false;
		break;
The variable size, in here, could be clamped to a certain minimum/maximum while funding a town, so your chuch-only town would not be available anymore IN GAME MODE, as it should not be changed in SCENARIO EDITOR mode.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Found a town

Post by Roujin »

belugas wrote: We do share the same impression. That is good :D
As for the desynchs happening after town is created, i'd go searching in the roads layout mechanism.
But somehow, i doubt it's that, since townds can grow safetly in MP mode...
One thing for sure, town creation was never meant to be MP safe, so it's expected to find multiple desynch causes.
Hmm.. the desync didn't happen to me since the one time I mentioned :| seems to be a rare occasion. Then again, I only tested it with two instances of OpenTTD running on the same machine, so...
As for the size of the town, maybe a minimum size can be specified, since the size (apart from small-medium-big) is actually a random value

Good Job Roujin, by the way :mrgreen:

[Edit]This code, in DoCreateTown, might very well be another subject of desynchs [/Edit]

Code: Select all

/* Random town size. */
int x = (Random() & 0xF) + 8;
[Edit-1]Same funciton, just a few lines after: [/Edit-2]

Code: Select all

case TSM_FIXED:
		x = size * 16 + 3;
		t->larger_town = false;
		break;
The variable size, in here, could be clamped to a certain minimum/maximum while funding a town, so your chuch-only town would not be available anymore IN GAME MODE, as it should not be changed in SCENARIO EDITOR mode.
Well, to me it looks like the Random call in here is totally irrelevant for ingame calls to this function, since they are always TSM_FIXED. I'll rewrite this here a bit so the Random() function won't get called for TSM_FIXED...
But hey - shouldn't Random() be safe anyway if it's used in commands?

---
Now let's look again at that x:
For small, medium, large towns respectively, it is 3, 19 and 35.

Now the magic starts happening.
First, the num_houses attribute of the town is increased by x (to x, obviously).
Then, the function GrowTown gets called 4*x times.
And then, num_houses is decreased by x again. o_O

Well, my guess is that GrowTown needs some kind of town radius to work... so num_houses is first artificially increased (and UpdateTownRadius called) and later decreased again.

---
If it were for me, I'd just introduce a new TownSizeMode called TSM_INGAME or something like that and set my x to ... well let's say 10 or so. That way nothing is changed for town creating in the scenario editor...
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Found a town

Post by Roujin »

Well, I've done the mentioned changes. Also, the new price entry wasn't actually used (but something like 16*base cost of industries), I've changed that too.

Here's my current version of the patch.

It has no size setting anymore, but will use something inbetween the "small" and "medium" settings of the scenario editor. The base price is 30.000.000 pounds now (I'm open for suggestions on this one).

I've also fixed the "Invenville" mystery. Turns out the generated number for name parts was dismissed (= set to 0) too easily, e.g. if trying to place the town in a wrong place (resulting in an error message). This way, you could click again in a better place, and the town would get placed; but always with the name resulting out of 0 as parameter for the name parts - which was "Invenville" (at least for me).
Attachments
Town_funding_Roujin_r14536.diff
(20.49 KiB) Downloaded 186 times
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
technosnorunt58
Engineer
Engineer
Posts: 79
Joined: 09 Nov 2008 00:59

Re: Patch: Found a town

Post by technosnorunt58 »

My friend and I think that you should be able to found a town by making a airport, dock, tram, bus, train, ect.
and have a road sprout out of it and it will form a town based on the station name without the cost.
(My friend thinks he can alredy. :lol: )
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Patch: Found a town

Post by NekoMaster »

technosnorunt58 wrote:My friend and I think that you should be able to found a town by making a airport, dock, tram, bus, train, ect.
and have a road sprout out of it and it will form a town based on the station name without the cost.
(My friend thinks he can alredy. :lol: )
LOL! Hey i think your on to something, maybe make it so taht for stations near a industry can produce a town by making some roads coming away from it (at least 5 squares or so) and then eventualy the game will ask, would you like this area to become a town and it would show in a little dialog box the picture of the area to become a town. That way random towns wont get generated, oh, and a town cant be made if there are other town(s) near by (using the same Minimum from normall placement)
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
SirXavius
Transport Coordinator
Transport Coordinator
Posts: 302
Joined: 28 Jun 2006 18:25
Location: Florida

Re: Patch: Found a town

Post by SirXavius »

Hold on guys. Mind what Belugas said in a previous post. Let's get a nice stable working patch before thinking about possible features. Save those good ideas for later. Give Roujin a chance to set up the basic implementation; he's coming along nicely....:wink:
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Patch: Found a town

Post by burty »

Talking of which.


Roujin do you wish me to compile a Win Binary for the users when you release updates or are you able to do it?
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Found a town

Post by Roujin »

Well I am basically _able_ to do it, but I wouldn't bother unless someone actually requests it. So if you want to provide winbin of this patch, I'm fine with it.

By the way, only 4 people seem to have downloaded the latest version.. maybe mainly people who aren't able to compile themselves are interested in this. So if you could provide a winbin maybe more people would test it.


It would also help if some of you tried it out and told me if you encountered any bugs, or desynchs in multiplayer... or have any suggestions regarding pricing or anything else. Other than that I don't know what else to do with this patch.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Patch: Found a town

Post by NekoMaster »

Roujin wrote:Well I am basically _able_ to do it, but I wouldn't bother unless someone actually requests it. So if you want to provide winbin of this patch, I'm fine with it.

By the way, only 4 people seem to have downloaded the latest version.. maybe mainly people who aren't able to compile themselves are interested in this. So if you could provide a winbin maybe more people would test it.


It would also help if some of you tried it out and told me if you encountered any bugs, or desynchs in multiplayer... or have any suggestions regarding pricing or anything else. Other than that I don't know what else to do with this patch.
Ya I would like the Win32 Binary, so can somebody post it? And also, I would play Multi player but the problem is, Im on Wireless and since I rearranged my room my signal hasn't been the best (Low to (not often) good strength) so it would desync even if I didnt have this patch.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
technosnorunt58
Engineer
Engineer
Posts: 79
Joined: 09 Nov 2008 00:59

Re: Patch: Found a town

Post by technosnorunt58 »

NekoMaster wrote:
technosnorunt58 wrote:My friend and I think that you should be able to found a town by making a airport, dock, tram, bus, train, ect.
and have a road sprout out of it and it will form a town based on the station name without the cost.
(My friend thinks he can alredy. :lol: )
LOL! Hey i think your on to something, maybe make it so taht for stations near a industry can produce a town by making some roads coming away from it (at least 5 squares or so) and then eventualy the game will ask, would you like this area to become a town and it would show in a little dialog box the picture of the area to become a town. That way random towns wont get generated, oh, and a town cant be made if there are other town(s) near by (using the same Minimum from normall placement)
Well you could also make a airport, dock, and train and build roads around it. It would use the passengers you sent there.

My point: Industrys are not the only things you can build a city with.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 2 guests