Working on a fork of OpenTTD

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

iNVERTED
Route Supervisor
Route Supervisor
Posts: 387
Joined: 24 Apr 2005 21:21
Location: Torquay, England
Contact:

Working on a fork of OpenTTD

Post by iNVERTED »

Okay, I got bored of people telling me my coding style is bad. I personally think the coding style used in the openttd.com downloads is bad. So, I decided to start working on a fork with lots of stuff fixed to work much nicer...

(Side note: To anyone who's seen the various functions involving iterating over a tile area: Doesn't this look better?)

Code: Select all

		ResetTileArea(t);
		while (IterateTileArea(t)) {
			// do stuff with the tile t->current here
		}
(end of side note)

And the stuff I'm planning to make:
- Long train depots (depots must be as long as the train and depot is accessible from both ends, so trains can drive through)
- Brand new GUI for building things
- Diagonal roads
- Traffic lights on roads
- Civilian cars on roads
- Bridges and tunnels for canals (though they would be damn expensive)
- Custom airports - place spare land, runways, hangars, terminals, loading bays and jetties
- Design tool (ie. copy and paste)
- New railtype - vacuum tubes
- Bridges over bridges, bridges with corners and tunnels with corners
- Four- and six-lane roads
- Curved tracks and roads
- Rotate the view
- Different gradient slopes
- RCT-style water (i.e. different depths of water that cost different amounts of money to "reclaim" as land)
- Diagonal stations
- Conveyor belts

I have to go to school now. Some screens later. Very little is done so far.
User avatar
Nickman
Engineer
Engineer
Posts: 66
Joined: 27 Jun 2006 23:07

Post by Nickman »

That's a very big list you have there :).
An impressive one to.

I'm guessing it'l take A LOT of time to code all that, but you have some cool features planned if you can accomplish them.
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

There is no good or bad coding style, it just depends on the coding style of the project and on the developers personal opinion. If the OTTD devs say that your coding style is bad then that is because you don't follow their style rules.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
User avatar
Toni Babelony
Tycoon
Tycoon
Posts: 1389
Joined: 07 Jul 2006 09:34
Skype: toni_babelony
Location: Sagamihara-shi, Japan
Contact:

Post by Toni Babelony »

WOW! That's almost like developing a new game with the same engine...


Good luck with it. You'll need it!
Retired JapanSet developer and creator of TIAS.
User avatar
thetitan
Engineer
Engineer
Posts: 4
Joined: 12 Aug 2006 23:34
Location: Austin, TX, USA
Contact:

Post by thetitan »

i like the idea, i particularly like;

- Traffic lights on roads
- Civilian cars on roads
- Custom airports - place spare land, runways, hangars, terminals, loading bays and jetties
- New railtype - vacuum tubes
- Bridges over bridges, bridges with corners and tunnels with corners
- Four- and six-lane roads
- Rotate the view

- Conveyor belts <<< how would you use this??
User avatar
Killer 11
Tycoon
Tycoon
Posts: 2463
Joined: 06 Jan 2004 18:38
Location: Kaunas, Lithuania
Contact:

Post by Killer 11 »

dunno about the water depth thing i think it will at the very least VERY hard to do...
User avatar
jonty-comp
Tycoon
Tycoon
Posts: 2542
Joined: 22 Oct 2005 16:05
Location: Chesterfield, England
Contact:

Post by jonty-comp »

Ooh, most of those things are things I've always wanted to see in a TTD game, but that have been too hard to code!

Kudos to you, sir! :D
Psistorm
Traffic Manager
Traffic Manager
Posts: 173
Joined: 05 Jun 2004 12:22

Post by Psistorm »

thats a very impressive list you have there, sir!
I wish you good luck getting it all to work, and may surely give these a shot. the tricky thing: will you adapt new features introduced by OTTD or develop completely on your own there? because with the new gamebalance branch in development, it will definitely be a tough choice which build to play
iNVERTED
Route Supervisor
Route Supervisor
Posts: 387
Joined: 24 Apr 2005 21:21
Location: Torquay, England
Contact:

Post by iNVERTED »

thetitan wrote:- Conveyor belts <<< how would you use this??
Once I make them, you will either have to place your stations adjacent to an industry to get cargo from it, or you'll have to connect the industry to the station with a conveyor belt. So basically it removes the unrealism of having a station 3 tiles away from an industry, with a bunch of houses or whatnot in between, and still getting cargo to the station.

And, I forgot something - most of the internal code will be re-worked as I go through it, because it's extremely confusing as it is. The code I posted in my side note was an example of the new re-worked code. ;)

Screenshots!

http://invhost.com/share/main.png - Notice that the 5 construction buttons have been replaced by a big button that says "Construction". When you click it, the Construction toolbar opens, and you then click one of the 6 blue buttons to open a toolbox for each type of construction: rail, road, air, water, trees and the design/copypaste tool (that's the as yet blank button). As you can see, the 6 green buttons are the ones previously found in the Landscaping toolbar. The toolbox open in this screenshot is the railway construction one. In the top right of it, you can select the track type (railway, electrified railway, monorail, maglev, and when I add it, vacuum tube). The icons will be redone to fit the new big buttons later (ie. once I redo all the sprite stuff to use bitmap images, so you don't have to use grfcodec and pcxes every single time you want to edit sprites :roll: ).

http://invhost.com/share/others.png - This shows the road, water and trees toolboxes. Again, icons will be redone (or in some cases, just made from scratch - I didn't show the airport or design toolboxes purely because the icons don't exist so there's nothing to see). In the road toolbox, you can choose 1, 2 or 3 lanes per carraigeway (one-way roads make that 2, 4 or 6, because you can't have a single lane). 2 lpc will take a width of two tiles and 3 lpc takes three, of course. In 2 and 3 lpc roads, there will be a central res between the different direction lanes. I'm also hoping to enable you to make proper road junctions when you are dealing with 2 and 3 lpc roads - road junctions you would see in real life, the kind of junctions we currently make in TT with railways.

Nothing really to see in the water toolbox, apart from the presence of the bridge and tunnel buttons, and also an extra canal button which will be used to raise or lower the water level of an area of land. Be careful with that, because water will stay level, and raising/lowering water in a high area will cause mass expenditure. ;) And as for the trees toolbox, well, all I did with that was to make it into a scrollable list - that means in the future we will be able to add custom trees like we can for stations and depots.
Psistorm wrote:will you adapt new features introduced by OTTD or develop completely on your own there?
Well, for now, I'm developing this completely on my own. Once the first major feature is finished (and nothing else is broken), which will probably be the long depots, I'll release the source code. Currently, this is still based on the ancient revision 5929, but I'm going to port all my new code to the latest nightly available when the time comes sometime between now and releasing the source code. As for patches made for the trunk, I'll probably either rewrite them myself or someone else can. This is very much a "make it up as I go along" thing.
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Post by Sacro »

I am greatly intrigued by this project, and I think it would provide some great patches for OpenTTD... I'd be interested in helping (that's if you need anything that is!)
We Am De Best

Host of ThroughTheTube site
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7595
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Re: Working on a fork of OpenTTD

Post by Born Acorn »

iNVERTED wrote:- Conveyor belts
Will this be limited to the catchment area? Wouldn't want to have any cross country conveyors. :p
Image
iNVERTED
Route Supervisor
Route Supervisor
Posts: 387
Joined: 24 Apr 2005 21:21
Location: Torquay, England
Contact:

Re: Working on a fork of OpenTTD

Post by iNVERTED »

Born Acorn wrote:
iNVERTED wrote:- Conveyor belts
Will this be limited to the catchment area? Wouldn't want to have any cross country conveyors. :p
I'm thinking of having a limit set in the difficult settings. A smaller conveyor belt limit obviously makes the game harder.
User avatar
Digitalfox
Chief Executive
Chief Executive
Posts: 708
Joined: 28 Oct 2004 04:42
Location: Catch the Fox if you can... Almost 20 years and counting!

Post by Digitalfox »

iNVERTED, i would love to see some of those features in openttd :)

Start working my slave and don't waste time posting until all work is done :lol: ( I'm joking )
iNVERTED
Route Supervisor
Route Supervisor
Posts: 387
Joined: 24 Apr 2005 21:21
Location: Torquay, England
Contact:

Post by iNVERTED »

Don't complain if you don't see progress. Coding OpenTTD isn't the only thing I do. :P

Since my last post, I've been working on new functions to load sprites from a .bmp and .nfo combination. I haven't been able to test it, since it's not finished and I've done enough for today, but I'm thinking this is going to be relatively slow as it has to constantly iterate through the palette (as it's loading a 24-bit .bmp image, and converting every single pixel into a palette color). Anyway, because it's slow, I'm making this for the sole purpose of not having to use grfcodec. It makes it a simple case of saving the file and loading OTTD, and when the graphics are perfect, they can then be made into a .grf for speed purposes.
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Post by athanasios »

iNVERTED would you consider my idea of giving industries station capabilities? It is very unrealistic to have an industry, served by 3 or 4 companies, each one building its own station a few tiles far from the industry. And AI is so stupid that same company will build multiple stations to serve same industry.
So for example a raw industry could have a truck loading bay and a 1 line railstation, or just area reserved for them. (First company servicing the industry could be given a bonus of lower cost of construction of the station.) (Shared stations patch mandatory.) When production increases these could be expanded or parts added, like port, airport.
In the same line city owned airports and rail stations could be introduced.
I believe this schema would make game less "heavy" and less "messy".
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
iNVERTED
Route Supervisor
Route Supervisor
Posts: 387
Joined: 24 Apr 2005 21:21
Location: Torquay, England
Contact:

Post by iNVERTED »

That sounds unnecessarily complicated and I think it could ruin the game. *shrug* I didn't really understand what you said though.
Psistorm
Traffic Manager
Traffic Manager
Posts: 173
Joined: 05 Jun 2004 12:22

Post by Psistorm »

another random quesion: I can see the benefit of one-way roads when it comes to specifically routing some vehicles. but: what use would 2 or more lane roads have? right now trucks can drive in such a close order it wouldnt make much sense. if you pack a regular road so full with vehicles that you will need another set of lanes, you might as well just use a train.
iNVERTED
Route Supervisor
Route Supervisor
Posts: 387
Joined: 24 Apr 2005 21:21
Location: Torquay, England
Contact:

Post by iNVERTED »

Psistorm wrote:what use would 2 or more lane roads have?
I am making civilian cars, you know. ;) If you joined two big cities with a 1 lpc road, there would surely be way too much traffic on it.
iNVERTED
Route Supervisor
Route Supervisor
Posts: 387
Joined: 24 Apr 2005 21:21
Location: Torquay, England
Contact:

Post by iNVERTED »

Hmm... When I used my new bitmap sprite loader to replace the cursor with an image of the same size, it worked fine. But when I try to use the same thing to make the build dock button twice as big (it's the first one in trg1r.grf, which is why I tried that first)... this happens. http://invhost.com/share/ohdear.png :lol:
User avatar
Aracirion
Traffic Manager
Traffic Manager
Posts: 241
Joined: 15 Jan 2006 15:15
Contact:

Post by Aracirion »

um, I don't know a lot about coding, but couldn't you save a lot of tim by using the 32bit build as a base?
Locked

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 5 guests