Transport Empire Developer Handbook

Discussions related to programming Transport Empire.

Moderator: Transport Empire Moderators

Post Reply
User avatar
uzurpator
Transport Empire Moderator
Transport Empire Moderator
Posts: 2178
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Transport Empire Developer Handbook

Post by uzurpator »

This document is permanently Under Construction.

Transport Empire Prtential Developer Handbook:

1. How to get the source

The Source is available at svn://svn.transportempire.com/trunk/transport_empire_4
Currently it contains only win32, VC10 project and dependancies.


2. How to get the dependancies

TEmpire uses several dependancies to build they include:

Boost - http://www.boost.org/
Ogre - http://www.ogre3d.org

Boost is a gargantuan set of libraries. We actually use only:

3. How to build

TEmpire should port easily to any operating system. Current build however relies on
a few windows specific functions (see timing.h).

Unfortuneatly you have to build yourself a makefile on any platform that is not win32

4. How to submit changes

To submit changes you have to contact our project maintainer - Steve:
http://www.tt-forums.net/memberlist.php ... ile&u=2023

While submitting make sure that the code you have submitted actually
compiles and runs well.

5. General coding tips

Note that TEmpire is a C++ code. This means that it is a template/class/std::
bonanza. Ie you should prefer:

std::string to char*,
std::vector<int> to int[],
cout << "stuff", to printf("stuff")

While nobody will kill you if you use those functions in your own
code - ie inside a class, however when dealing with class interfaces then:

__IT IS STRICTLY FORBIDDEN, UNLESS EXPLICITLY ALLOWED IN SPECIAL
CASES, TO USE C SPECIFIC SOLUTION WHEN C++ SOLUTUION IS AVAILABLE__

This is pretty much the only rule of the project :>

As for formatting your source file, the format is available in template.txt in the source.

6. Reserved for future use
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Transport Empire Developer Handbook

Post by DaleStan »

uzurpator wrote: __IT IS STRICTLY FORBIDDEN, UNLESS EXPLICITLY ALLOWED IN SPECIAL
CASES, TO USE C SPECIFIC SOLUTION WHEN C++ SOLUTUION IS AVAILABLE__
Define "C specific solution". Unless you're using class, template, typename, this, public, protected, or private as names (which would be incredibly stupid, and should be forbidden) all valid C code is also valid C++ code. Does this mean that no code that a C compiler would accept is permitted? That will make things ... difficult.

Also:
boost::format vs *printf?
std::vector of boost::any vs va_list et al?
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
uzurpator
Transport Empire Moderator
Transport Empire Moderator
Posts: 2178
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Re: Transport Empire Developer Handbook

Post by uzurpator »

It means:

No void* or void**
No char* for text output
No type[] unless their size is constant (but then boost::array is better)
No defines if template/inline is possible
Avoid globals
no #define value 10 (prefer const int value 10)

all this however is on the module (class) interface. I don't want any ownership or allocation problems between classes. Whatever an author does inside of his class is completely up to him/her

The intent is to ecourage using of modern solutions instead good ol
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Transport Empire Developer Handbook

Post by DaleStan »

uzurpator wrote:No char* for text output
So one has to do this:

Code: Select all

cout<<string("My text\n"):
I'm sure I don't have to tell *you* this, but for the benefit of others, "My text\n" is a char*, and sending it direct to cout is clearly using it for output.

Code: Select all

const int value 10
Not legal in either C or C++. After applying the obvious corrections, the code is valid in both. What makes this a C++ solution?
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
uzurpator
Transport Empire Moderator
Transport Empire Moderator
Posts: 2178
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Re: Transport Empire Developer Handbook

Post by uzurpator »

DaleStan wrote:
uzurpator wrote:No char* for text output
So one has to do this:

Code: Select all

cout<<string("My text\n"):
I'm sure I don't have to tell *you* this, but for the benefit of others, "My text\n" is a char*, and sending it direct to cout is clearly using it for output.
that is

cout << const char *;

which is a compile time constant. Not a dynamically allocated buffer which is printf'ed/strcmp'ed and there is nothing done to it.

Code: Select all

const int value 10
Not legal in either C or C++. After applying the obvious corrections, the code is valid in both. What makes this a C++ solution?[/quote]

Because C programs tend to prefer #define to do A LOT of things, and overuse of macros is dangerous - especially with the lack of namespaces.
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
MrSmoke
Engineer
Engineer
Posts: 25
Joined: 16 Jul 2006 23:50

Re: Transport Empire Developer Handbook

Post by MrSmoke »

well i better get learning C++ haha
User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Transport Empire Developer Handbook

Post by Vaulter »

Wow! I did it!
Thank for posts and readmes!

ps: see some threads issues..... will fixing
pss: attach to make project actual compile with GCC (ownership_manager for a now disabled :()
Attachments
te.png
First successful run after hundreds fails
(220.55 KiB) Downloaded 2 times
gcc.patch
Patch to make project linux buildable
(70.3 KiB) Downloaded 428 times
CMakeLists.txt
CMake list for te4 separately (included in patch)
(2.87 KiB) Downloaded 463 times
Post Reply

Return to “Transport Empire Coding”

Who is online

Users browsing this forum: No registered users and 5 guests