
A TT game online?
Moderator: General Forums Moderators
Re: A TT game online?
I like treating waste to build something else 

Social Maps will revolutionize your way of interacting with your social network online but also in your realife! Make sure to check it out to be able to see where your friends are in real time and plan for your next night out!
- Zhall
- Tycoon
- Posts: 1237
- Joined: 17 Jul 2007 01:36
- Skype: moonray_zdo
- Location: Teh matrix, duh.
- Contact:
Re: A TT game online?
Recyling is a majorly under represented aspect of a lot of different business sims.
Capitalism 2 doesn't take it into account, nor does openttd. We could pioneer this by having industrial and post consumer recylable wastes.
Capitalism 2 doesn't take it into account, nor does openttd. We could pioneer this by having industrial and post consumer recylable wastes.
Formerly known as Sapphire United.
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Re: A TT game online?
But FIRS does.Sapphire united wrote:Recyling is a majorly under represented aspect of a lot of different business sims.
Capitalism 2 doesn't take it into account, nor does openttd. We could pioneer this by having industrial and post consumer recylable wastes.
Maybe we can save time by following either one of available OpenTTD Industries NewGRF scheme...
There are 3 :
- FIRS
- ECS Vector
- PBI (and TaI Industries, as Pikka changed it)
The difference isn't much, apart from PBI and TaI which seems only account for industries in UK.
Thoughts ? (Of course we will modify them probably)
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
「ヨーッスノットマイン」もと申します。
- Zhall
- Tycoon
- Posts: 1237
- Joined: 17 Jul 2007 01:36
- Skype: moonray_zdo
- Location: Teh matrix, duh.
- Contact:
Re: A TT game online?
Saving time isn't as fun as making your own, being unique is always funner.
Besides, i can pump them out of illustrator in 20 mins.
Besides, i can pump them out of illustrator in 20 mins.
Formerly known as Sapphire United.
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Re: A TT game online?
No, using a base for the industry scheme just give us the base layout. Modification, of course, would go so far from the originals.Sapphire united wrote:Saving time isn't as fun as making your own, being unique is always funner.
Besides, i can pump them out of illustrator in 20 mins.
Say, how about if we add radioactive materials in ?
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
「ヨーッスノットマイン」もと申します。
- Zhall
- Tycoon
- Posts: 1237
- Joined: 17 Jul 2007 01:36
- Skype: moonray_zdo
- Location: Teh matrix, duh.
- Contact:
Re: A TT game online?
Sounds like railroad tycoon 2. 

Formerly known as Sapphire United.
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Re: A TT game online?
Few... it's been a while, between business trips and holiday, it was not easy to work on this BUT, now I have completed the full loading of the map and dynamique scrolling (to avoid loading everything at once but only what you see (+ a bit more))
It works but it is slow due to all of the read and write actions to add elements to the map... I need to optimize it at some point down the road
=> I understand now why most of the people goes for the canvas
Next steps, I need to include the different kind of tiles (industry, commerce, stuff for the company) to be able to start playing with the mechanics
Cause right now I can only place road ... fun but doesn't do much
Regarding the fact that we could use a base, I think it is a great idea, cause it gives us something to start with, especially for the basics. The only issue I might have with that, is we might have some legal constraints afterward. I don't want to use something that requires me to pay royalties or remain open source.
right now, I want to remain free.
It works but it is slow due to all of the read and write actions to add elements to the map... I need to optimize it at some point down the road
=> I understand now why most of the people goes for the canvas

Next steps, I need to include the different kind of tiles (industry, commerce, stuff for the company) to be able to start playing with the mechanics

Cause right now I can only place road ... fun but doesn't do much
Regarding the fact that we could use a base, I think it is a great idea, cause it gives us something to start with, especially for the basics. The only issue I might have with that, is we might have some legal constraints afterward. I don't want to use something that requires me to pay royalties or remain open source.
right now, I want to remain free.
Social Maps will revolutionize your way of interacting with your social network online but also in your realife! Make sure to check it out to be able to see where your friends are in real time and plan for your next night out!
Re: A TT game online?
you could force-cache the base set of tiles used,
then use javascript to load relevant tiles as needed from the chace.
controlling browser cache is on the otherhand a witchcraft on its own
then use javascript to load relevant tiles as needed from the chace.
controlling browser cache is on the otherhand a witchcraft on its own

The Prophet -thx Pikka-
Re: A TT game online?
You gave me an idea: I could optimize what I've done so that I pre-cache the next tiles (with all the info) and THEN display them ...
I'll try that!
I'm afraid that if I pre-cache everything, a lot of memory will be used (if my map is 100000000000000000000000000 x 1000000000000000000000000000 => that's a HUGE array)... but maybe something in between can be implemented. I need to sleep on this
As for the witchcraft ... as long as you don't use the one by default (I tried a couple of time), you are fine !
I'll try that!
I'm afraid that if I pre-cache everything, a lot of memory will be used (if my map is 100000000000000000000000000 x 1000000000000000000000000000 => that's a HUGE array)... but maybe something in between can be implemented. I need to sleep on this

As for the witchcraft ... as long as you don't use the one by default (I tried a couple of time), you are fine !

Social Maps will revolutionize your way of interacting with your social network online but also in your realife! Make sure to check it out to be able to see where your friends are in real time and plan for your next night out!
Re: A TT game online?
the idea is..
that you have only a few types of tiles.
like flat land, road, a house, whatever.
supposedly you cahce 1 copy of those tiles to user end.
then, when the map needs to be scrolled, you only fetch what tile should be displayd, and load the images according to that from the user end cache. so, you only have to send information about the tiles, no images.
on the server side you store the grid map, and when you need to display the game map on user end it would go as:
->client side requests data to show part of the game world. this can be a single tile ID. Like XY coords of center tile
->server sends all tiles that should be shown wit attributes of : XY coord, ID of image to show, and optional scripts for OnClick() and whatever javascript you want. for interaction.
-> client side loads the revelant images from local cache, and displays them and runs the client side javascripts the server has sent.
thisway once Your game page loads the images need to be cached, from then only cached content should be shown image wise.
So probaby what the server sends is no more than a single array.
like.. let's say You show only a pre-defined number of tiles.
hmm. let's see..
like..
$tile1 = [
"img" => "img1",
"script" => "some javascript stuff",
];
probably a simple <DIV> can do what You need.
img is naturally the name of the image to load, and the script is the script to load..
soo..
You could make this a multidimensonal array if you like.
then you can iterate it with a simple loop.
and "echo" the output <DIV>.
so for eatch tile You would be able to create a <DIV>.
Now cache controll would have to be set to allow a long expire time for the images them self.
With an actualy trigger that may be sent by the server to flush the cache in case You update the image files.
that you have only a few types of tiles.
like flat land, road, a house, whatever.
supposedly you cahce 1 copy of those tiles to user end.
then, when the map needs to be scrolled, you only fetch what tile should be displayd, and load the images according to that from the user end cache. so, you only have to send information about the tiles, no images.
on the server side you store the grid map, and when you need to display the game map on user end it would go as:
->client side requests data to show part of the game world. this can be a single tile ID. Like XY coords of center tile
->server sends all tiles that should be shown wit attributes of : XY coord, ID of image to show, and optional scripts for OnClick() and whatever javascript you want. for interaction.
-> client side loads the revelant images from local cache, and displays them and runs the client side javascripts the server has sent.
thisway once Your game page loads the images need to be cached, from then only cached content should be shown image wise.
So probaby what the server sends is no more than a single array.
like.. let's say You show only a pre-defined number of tiles.
hmm. let's see..
like..
$tile1 = [
"img" => "img1",
"script" => "some javascript stuff",
];
probably a simple <DIV> can do what You need.
img is naturally the name of the image to load, and the script is the script to load..
soo..
You could make this a multidimensonal array if you like.
then you can iterate it with a simple loop.
and "echo" the output <DIV>.
so for eatch tile You would be able to create a <DIV>.
Now cache controll would have to be set to allow a long expire time for the images them self.
With an actualy trigger that may be sent by the server to flush the cache in case You update the image files.
The Prophet -thx Pikka-
Re: A TT game online?
That's what I did 
The slowlyness comes from the scrolling when I need to add lines or (and mostly) columns because then I need to right a lot of "data" to create my DIVs.
With columns it is even worse because I need to go line by line and add a div at the front or at the end ...
And for me the image caching will come through "Spriting" in the CSS (which I haven't done yet) => one big image with all the tiles that I load only once in the beginning (if the browser doesn't have it in cache already)
Now where I can optimize is on adding those lines / columns. Currently, I add, in one write request (per line), all the needed tiles in a "loading" state (the background is a loading image) and I pull through socket.io a status on all those new tiles and then update them one by one.
What I should be doing, I should store in a cache of my own the new tiles, request the status for all of them and then write everything in one shot ... that should help a bit

The slowlyness comes from the scrolling when I need to add lines or (and mostly) columns because then I need to right a lot of "data" to create my DIVs.
With columns it is even worse because I need to go line by line and add a div at the front or at the end ...
And for me the image caching will come through "Spriting" in the CSS (which I haven't done yet) => one big image with all the tiles that I load only once in the beginning (if the browser doesn't have it in cache already)
Now where I can optimize is on adding those lines / columns. Currently, I add, in one write request (per line), all the needed tiles in a "loading" state (the background is a loading image) and I pull through socket.io a status on all those new tiles and then update them one by one.
What I should be doing, I should store in a cache of my own the new tiles, request the status for all of them and then write everything in one shot ... that should help a bit

Social Maps will revolutionize your way of interacting with your social network online but also in your realife! Make sure to check it out to be able to see where your friends are in real time and plan for your next night out!
Re: A TT game online?
I do not think you need to add or remove any of the DIVs once they are created.
You can use javascript to just change the image and the revelant javascript function for that single tile.
The data transferd is not more than a part of the map array, witch chsould be verry small indeed.
The way the HTTP protocol works gives You slowness do to the way it works.
This is a major limitation of browser based games.
But there are several ways to overcome.
http://en.wikipedia.org/wiki/Comet_%28programming%29
this should help.
the basic idea is to let the connection to the server be presistant, and on requwest "stream" the required part of the map array. This will reduce the network latency created by the standard HTTP way of retireving information. Since a new commention does not need to be built up.
If cache controll fails btw, for pre-loading images javascript can be used.
Search for preloading images with jquery.
once Your game main page loads the images should be requested.
You can make a loading screen for that.
Then, the presistent connection should serve tile information.
The DIVs acting as the tiles them self would be manipulated on client side with javascript.
This is how You reduce bandwidth, and reduce network lag.
Allso, the presistent connection will be usefull later on, when more than one user would like to build on the same tile.
As soon as a user builds something, the information about this action should be shared with everyone who could acces the same tile. And naturaly the changes has to be refelcted on every connected client's side. To keep the game synchronised. The presistent connections allows to push data to the client in case an event happens on the server side.
Therefore a fast database is required, i would strongy suggest to opt Your code with a database stored in RAM for this reason. (with regular backing up to HDD in case for a power loss).
Might allso not hurt to make sure Your code is ready to handle a database server located on a dedicated and separated hardware.
Previously i mentioned mysql + php a good combination.
I still do.
You can use javascript to just change the image and the revelant javascript function for that single tile.
The data transferd is not more than a part of the map array, witch chsould be verry small indeed.
The way the HTTP protocol works gives You slowness do to the way it works.
This is a major limitation of browser based games.
But there are several ways to overcome.
http://en.wikipedia.org/wiki/Comet_%28programming%29
this should help.
the basic idea is to let the connection to the server be presistant, and on requwest "stream" the required part of the map array. This will reduce the network latency created by the standard HTTP way of retireving information. Since a new commention does not need to be built up.
If cache controll fails btw, for pre-loading images javascript can be used.
Search for preloading images with jquery.
once Your game main page loads the images should be requested.
You can make a loading screen for that.
Then, the presistent connection should serve tile information.
The DIVs acting as the tiles them self would be manipulated on client side with javascript.
This is how You reduce bandwidth, and reduce network lag.
Allso, the presistent connection will be usefull later on, when more than one user would like to build on the same tile.
As soon as a user builds something, the information about this action should be shared with everyone who could acces the same tile. And naturaly the changes has to be refelcted on every connected client's side. To keep the game synchronised. The presistent connections allows to push data to the client in case an event happens on the server side.
Therefore a fast database is required, i would strongy suggest to opt Your code with a database stored in RAM for this reason. (with regular backing up to HDD in case for a power loss).
Might allso not hurt to make sure Your code is ready to handle a database server located on a dedicated and separated hardware.
Previously i mentioned mysql + php a good combination.
I still do.
The Prophet -thx Pikka-
Re: A TT game online?
If you don't add divs, you need to swap all the existing DIVs and this is what taking all the ressources ... which makes even slower. Plus, I think the render would be strange and not smooth at all (even if the computer have enough power).... unless I have very small divs that I move around, but then again more divs = more IO actions
Don't worry for me about HTTP / PHP / JS ... I've been doing this for 15years now
But thanks for the nice advice anyway, those are very usefull XD
To overcome the asynchronous, I'm using socket.io (http://socket.io/). Check it out if you don't know! It allows you to keep a link open between the browser and the server to send (both ways) information on real time.
I'm using this to keep the connection to push new tiles when scrolling or when another user modifies one... but also all the related information to the player / game (date / $ ...)
You are right mySQL and PHP are a good combination, which I have been playing for a long time ... but for this I'm using Node.JS and MongoDB because I wanted to learn and test ...
This is also a pretty sweet combination, which is supposed to be a bit faster than LAMP you have a lot of traffic and lot of persistent connections
Don't worry for me about HTTP / PHP / JS ... I've been doing this for 15years now

To overcome the asynchronous, I'm using socket.io (http://socket.io/). Check it out if you don't know! It allows you to keep a link open between the browser and the server to send (both ways) information on real time.
I'm using this to keep the connection to push new tiles when scrolling or when another user modifies one... but also all the related information to the player / game (date / $ ...)
You are right mySQL and PHP are a good combination, which I have been playing for a long time ... but for this I'm using Node.JS and MongoDB because I wanted to learn and test ...
This is also a pretty sweet combination, which is supposed to be a bit faster than LAMP you have a lot of traffic and lot of persistent connections
Social Maps will revolutionize your way of interacting with your social network online but also in your realife! Make sure to check it out to be able to see where your friends are in real time and plan for your next night out!
Re: A TT game online?
swapping the content o DIVs is the less expensive.
for smooth scrolling, you would need to again abuse javascript.
make the main "frame" size to be fixed, and disable the scrolling bars.
Load more tile information then needed, to ahve it ready.
Make sure Your DIVs are unique.
When scrolling, use a javascript function to manipulate all DIVs to move in the required direction.
so when say.. scrolling left, everything moves to the right.
pixel by pixel. This is not hard for javascript and it won't eat that mutch resource.
When the scrolling took exactly 1 tile, the image and information swapping in the divs are to be done, along with fetching "new" data to be ready if the crolling has to continue.
I did done this, it is not at all that resource expensive and the result is a smooth scrolling.
The infomration fetchd from the server is only as large as the array to hold the name of the images and associated javascript. The latency is equal to the PING time to Your server from the client multiplied by 2 + the time it takes for the database to seek out the information required.
if this time is LESS than the time it takes for the user at full scrolling speed to get to the edge of the buffered data about the tiles, then it will from client side, look like real time.
this is how You can figure out how many additional tile's information You need around the visisble tiles.
Allso, the script moving the DIVs should have a maximum scroll speed.
Or, if you like, you can even just make buttons to scroll a pre-defined number of tiles to a direction.
So as a user interface it would look like 4 arrows, when clicking on one the map should scroll X tiles.
Therefore, You only need to bufer the next line or row of tile information.
If done correctly, the buffering should last no longer than the scrolling it self.
for smooth scrolling, you would need to again abuse javascript.
make the main "frame" size to be fixed, and disable the scrolling bars.
Load more tile information then needed, to ahve it ready.
Make sure Your DIVs are unique.
When scrolling, use a javascript function to manipulate all DIVs to move in the required direction.
so when say.. scrolling left, everything moves to the right.
pixel by pixel. This is not hard for javascript and it won't eat that mutch resource.
When the scrolling took exactly 1 tile, the image and information swapping in the divs are to be done, along with fetching "new" data to be ready if the crolling has to continue.
I did done this, it is not at all that resource expensive and the result is a smooth scrolling.
The infomration fetchd from the server is only as large as the array to hold the name of the images and associated javascript. The latency is equal to the PING time to Your server from the client multiplied by 2 + the time it takes for the database to seek out the information required.
if this time is LESS than the time it takes for the user at full scrolling speed to get to the edge of the buffered data about the tiles, then it will from client side, look like real time.
this is how You can figure out how many additional tile's information You need around the visisble tiles.
Allso, the script moving the DIVs should have a maximum scroll speed.
Or, if you like, you can even just make buttons to scroll a pre-defined number of tiles to a direction.
So as a user interface it would look like 4 arrows, when clicking on one the map should scroll X tiles.
Therefore, You only need to bufer the next line or row of tile information.
If done correctly, the buffering should last no longer than the scrolling it self.
The Prophet -thx Pikka-
Re: A TT game online?
Again, that's pretty much what I'm doing. The only thing that I did is that I have a preloaded buffer just out side of the visibility range.
BUT, my map loaded is 50x50, meaning every time that I need a new line, I need to fetch and will have to update 50 tiles => 50 times that I have to find the right tile in Jquery and then I have to update the content with a new CSS class.
When the user start to increase the scroll speed, I add those lines and pull the tile minimum info (the csses and the elevation) and then update it.
Based on a profiling done with Chrome, the find and write are taking a lot of ressources on the computer which make it slow... that's why I need to update my code to optimize a bit the data flow and Read/Write actions
I really need to find a host so that you can see what I've done
BUT, my map loaded is 50x50, meaning every time that I need a new line, I need to fetch and will have to update 50 tiles => 50 times that I have to find the right tile in Jquery and then I have to update the content with a new CSS class.
When the user start to increase the scroll speed, I add those lines and pull the tile minimum info (the csses and the elevation) and then update it.
Based on a profiling done with Chrome, the find and write are taking a lot of ressources on the computer which make it slow... that's why I need to update my code to optimize a bit the data flow and Read/Write actions
I really need to find a host so that you can see what I've done

Social Maps will revolutionize your way of interacting with your social network online but also in your realife! Make sure to check it out to be able to see where your friends are in real time and plan for your next night out!
Re: A TT game online?
thats a good idea.
If its done as i suggested above it should be smooth.
I would realy look forward to see what yOu made.
If its done as i suggested above it should be smooth.
I would realy look forward to see what yOu made.
The Prophet -thx Pikka-
Re: A TT game online?
Hi all TTD fans. I work on play-ttd.com project. I have add multiplayer feature, now you can play online with friends. Also i significant increase perfomance of game in Chrome.
Thanks.
Thanks.
Re: A TT game online?
Sweet! ...
I wanted to try but nothing is happening (the page is grey). I've tried on my MacBook Air with Chrome and Opera...
I wanted to try but nothing is happening (the page is grey). I've tried on my MacBook Air with Chrome and Opera...
Social Maps will revolutionize your way of interacting with your social network online but also in your realife! Make sure to check it out to be able to see where your friends are in real time and plan for your next night out!
- Zhall
- Tycoon
- Posts: 1237
- Joined: 17 Jul 2007 01:36
- Skype: moonray_zdo
- Location: Teh matrix, duh.
- Contact:
Re: A TT game online?
Same thing here, just stuck on downloading.
Formerly known as Sapphire United.
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Re: A TT game online?
Sorry, i found bug, fixed now. Please try again.
Who is online
Users browsing this forum: Ahrefs [Bot] and 40 guests