Page 1 of 5

Working on a fork of OpenTTD

Posted: 16 Mar 2007 13:26
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.

Posted: 16 Mar 2007 13:31
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.

Posted: 16 Mar 2007 14:28
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.

Posted: 16 Mar 2007 14:36
by Toni Babelony
WOW! That's almost like developing a new game with the same engine...


Good luck with it. You'll need it!

Posted: 16 Mar 2007 15:49
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??

Posted: 16 Mar 2007 15:54
by Killer 11
dunno about the water depth thing i think it will at the very least VERY hard to do...

Posted: 16 Mar 2007 15:55
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

Posted: 16 Mar 2007 16:05
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

Posted: 16 Mar 2007 17:07
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.

Posted: 16 Mar 2007 17:46
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!)

Re: Working on a fork of OpenTTD

Posted: 16 Mar 2007 17:58
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

Re: Working on a fork of OpenTTD

Posted: 16 Mar 2007 18:52
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.

Posted: 16 Mar 2007 18:58
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 )

Posted: 16 Mar 2007 20:25
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.

Posted: 17 Mar 2007 01:01
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".

Posted: 17 Mar 2007 01:21
by iNVERTED
That sounds unnecessarily complicated and I think it could ruin the game. *shrug* I didn't really understand what you said though.

Posted: 17 Mar 2007 01:50
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.

Posted: 17 Mar 2007 08:47
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.

Posted: 17 Mar 2007 10:23
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:

Posted: 17 Mar 2007 11:32
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?