working on c# port of openttd

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

Moderator: OpenTTD Developers

exe
Engineer
Engineer
Posts: 54
Joined: 06 May 2004 15:20

working on c# port of openttd

Post by exe »

Hello! I'm working on c# port of OpenTTD. :)

some of the new features:

- ideally all data of vehicle types, industries, cargos should be defined in external text files.
- new prices, some economy rework to keep game challenging even after many many train routes are built, for ex very high inflation.
- new graphics support
- pluggable ai and bots

code changes:

- more oo and encapsulation, for example map which can be accessed only by Map class methods.
- windowprocs, windowdescs, widgetids replaced by virtual classes and methods like OnPaint(); commands packed into command objects; abstract tileprocs class
- ini options replaced by simple xml serialization of options class
- remove low level optimizations, especially in areas of gui, graphics rendering, except of optimizations of map storage and in other performance sensitive places pointed by a profiler.
- adding more and more unit tests (NUnit)

Graphics are opened directly through .pcx files generated by grfcodec, which were converted to .png and colorkey converted to alpha 0.

Speed: Game will propably be somewhat slower, but i don't think there will be much problems on 1024x1024 map.
Portability: I guess it should be possible to make it run on platforms other than windows with mono.

There is still very much to be done, but porting is quite mechanic so its moving steadily. I'd be glad for any comments or ideas!
Last edited by exe on 29 Jul 2006 13:40, edited 1 time in total.
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Best wishes on your endeavour. I'm not aware of a C# compiler for Linux, so unfortunately I won't be able to enjoy the fruits of your labour, but it'll be nice to see it.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
maquinista
Tycoon
Tycoon
Posts: 1828
Joined: 10 Jul 2006 00:43
Location: Spain

C#

Post by maquinista »

Some problems:
-New bugs: translating de code can create new bugs.
-Priority: is more importan write features than write the same game but with other code.
-Procesing power: C# needs more procesing power than C or C++.
I think that C is a better programing languaje for this game, but you can do it and continue the project yourself with a fork, the actual openttd team can continue the project with c languaje.

I dont like C# in my opinion I call It c--.
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Re: working on c# port of openttd

Post by Bjarni »

if you understand the code good enough to do this, then you can spend your time way better coding patches in C/C++, so we will work towards a common goal.
exe wrote:some goals:

- ideally all data of vehicle types, industries, cargos should be defined in external text files.
- new prices, some economy rework to keep game challenging even after many many train routes are built, for ex very high inflation.
- new graphics support
- pluggable ai and bots

code changes:

- more oo and encapsulation, for example map which can be accessed only by Map class methods.
- windowprocs, windowdescs, widgetids replaced by virtual classes and methods like OnPaint(); commands packed into command objects; abstract tileprocs class
- ini options replaced by simple xml serialization of options class
- remove low level optimizations, especially in areas of gui, graphics rendering, except of optimizations of map storage and in other performance sensitive places pointed by a profiler.
- adding more and more unit tests (NUnit)
why not code this in C/C++, where it's actually planned to be coded and some work have already been done.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: working on c# port of openttd

Post by DaleStan »

exe wrote:- ideally all data of vehicle types, industries, cargos should be defined in external text files.
- new graphics support
And will these two override newgrf files, or will it be the other way around?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Snuk the Great
Engineer
Engineer
Posts: 63
Joined: 26 Aug 2005 15:12

Post by Snuk the Great »

I agree with Bjarni, however you probably live in a free country, so I wont stop you.
Snuk the Great
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Re: working on c# port of openttd

Post by Brianetta »

DaleStan wrote:
exe wrote:- ideally all data of vehicle types, industries, cargos should be defined in external text files.
- new graphics support
And will these two override newgrf files, or will it be the other way around?
Override, one would hope. Then you can make use of a newgrf's graphics, and do what you like to the values.
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 »

Snuk the Great wrote:I agree with Bjarni, however you probably live in a free country, so I wont stop you.
this have nothing to do with where exe lives, but the fact that OpenTTD is GPL allows him to do stuff like this if he just follow some basic rules.
He got the freedom to do a lot of stuff to his own copy of the game, including stuff that likely turns out to be a waste of time. Once you are done (say it will take you a year, maybe more) image how many new features there will be in OpenTTD that have been added in the meantime, that you will have to port as well. In a sense, you will never be done because you are just one person and there are a lot of people working on OpenTTD, so odds are that you can't keep up.
Snuk the Great
Engineer
Engineer
Posts: 63
Joined: 26 Aug 2005 15:12

Post by Snuk the Great »

Bjarni wrote: this have nothing to do with where exe lives, but the fact that OpenTTD is GPL allows him to do stuff like this if he just follow some basic rules.
He got the freedom to do a lot of stuff to his own copy of the game, including stuff that likely turns out to be a waste of time. Once you are done (say it will take you a year, maybe more) image how many new features there will be in OpenTTD that have been added in the meantime, that you will have to port as well. In a sense, you will never be done because you are just one person and there are a lot of people working on OpenTTD, so odds are that you can't keep up.
Lol. The country thing was a different use of the expression "its a free country". Meaning that he can do what he want. However I probably could not say that because he probably lives in different country. So I used "you probably live in a free country". So its in a figure of speach. Sorry it confused you.

To make a long story short. I agree with Bjarni, and I think its a waste of time.
Snuk the Great
exe
Engineer
Engineer
Posts: 54
Joined: 06 May 2004 15:20

Re: working on c# port of openttd

Post by exe »

Bjarni wrote: why not code this in C/C++, where it's actually planned to be coded and some work have already been done.
OpenTTD is not written in "c/c++" but in pure c, so a port to c++ still requires much work and to fork. From my gamer's perspective not much changed in openttd in last two years; last cool features were big maps and a stable multiplayer. I think having OpenTTD in c# or even c++ would allow to add new features much easier without going around c limitations,and then it is still a little work compared to various projects of writing new transport games from scratch.
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Re: working on c# port of openttd

Post by Bjarni »

exe wrote:
Bjarni wrote:OpenTTD is not written in "c/c++" but in pure c
when I say that it's C/C++, then it's C/C++. Check out the newest revision from the svn server or the nightly build source (more or less the same), then you will see that features such as YAPF is written in C++. It used to be pure C, but not anymore.
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Re: working on c# port of openttd

Post by Sacro »

Bjarni wrote:It used to be pure C, but not anymore.
Didn't it used to be a mix of C and ASM?
We Am De Best

Host of ThroughTheTube site
Hazelrah
Traffic Manager
Traffic Manager
Posts: 196
Joined: 13 Apr 2005 05:41

Post by Hazelrah »

Bjarni wrote: He got the freedom to do a lot of stuff to his own copy of the game, including stuff that likely turns out to be a waste of time.
I don't particularly think that C# is a good idea, but I am curious. Is this what TTDPatch users were saying when OpenTTD started? ;)

-Hazelrah
Xaroth
Engineer
Engineer
Posts: 103
Joined: 01 May 2006 09:09

Post by Xaroth »

C# isn't as sucky as most people claim, sure it takes a bit of extra, and compiling cross-platform can be a bit dodgy (though the MONO project has made a -lot- of progress).. but it works
exe, maybe look at the source of RunUO, it's an uo emulator in C#, got a 'solid' network code that's easily adaptable to anything you want, plus the compiler it uses for custom scripts might be an interesting idea for your project (Can anybody say "Patches without having to recompile"? )
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Re: working on c# port of openttd

Post by Bjarni »

Sacro wrote:Didn't it used to be a mix of C and ASM?
no

the newgrf codec contains some ASM code and we added some ASM to OpenTTD to do specific tasks like counting cycles it takes to run a certain function (the timer stuff) to use when optimising and there is a file to add 64 bit windows support, but generally we don't use ASM and never did. It's truly a cross platform source and it works on more or less all hardware.
exe
Engineer
Engineer
Posts: 54
Joined: 06 May 2004 15:20

Post by exe »

Xaroth wrote:exe, maybe look at the source of RunUO, it's an uo emulator in C#, got a 'solid' network code that's easily adaptable to anything you want, plus the compiler it uses for custom scripts might be an interesting idea for your project (Can anybody say "Patches without having to recompile"? )
i'm not sure if Transport Tycoon needs that much customization, but i think that it would be nice and quite simple to add LUA scripting for game iconsole, to automate some tasks.

two current screenshots:
Attachments
screen04.PNG
screen04.PNG (78.01 KiB) Viewed 6983 times
screen05.PNG
screen05.PNG (40.58 KiB) Viewed 6982 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Methinks something is broken.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

DaleStan wrote:Methinks something is broken.
But my OpenTTD looks like that all the time...
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
Snuk the Great
Engineer
Engineer
Posts: 63
Joined: 26 Aug 2005 15:12

Post by Snuk the Great »

Brianetta wrote:
DaleStan wrote:Methinks something is broken.
But my OpenTTD looks like that all the time...
Yeah, thats the way its supposed to be!
Snuk the Great
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Very nice idea, this outside text files and all, especially the patches without compile thing.
Doesn't the Openttd.GPMI team work toward the Quake/UT-like mod system or is that only for AI?

BTW - that landscape there is seriously.....detached. ;)
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 18 guests