Fundamental programming considerations (important!)

Archived discussions related to Transport Empire. Read-only access only.

Moderator: Transport Empire Moderators

User avatar
orudge
Administrator
Administrator
Posts: 25147
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Fundamental programming considerations (important!)

Post by orudge »

Right, first of all we need to decide on various fundamental programming things:

1. Language
Personally, I think we should either use C, C++ or a mixture of the two. I don't really think we should bring languages like Pascal or Visual Basic into the equation at all. C++ has many advantages as it is object-orientated, and I think we should go with this. What's everybody else's opinions?

2. Portability
I think we should make the game as portable as possible. We should have a system layer, which contains interfaces for graphics, sound and so on, that sits between the host OS (eg, Windows, X Windows or DOS) and the game itself. This way, it would be easy for other platforms to be supported, which is certainly a good thing.

3. Extensibility
In some ways, this isn't a 'fundamental' programming issue, but the game should be as extendable as possible. We should store all data in configuration files of some sort. Someone suggested XML somewhere - that could be quite good actually. For example, we could have a data file called data/vehicles.xml as follows:

Code: Select all

<vehicles>
   <trains>
      <train>
         <name>Collett Pannier Tank</name>
         <speed>40</speed>
         <power>500</power>
         <sprite>collett</sprite>
         <!-- this could open, say, data/graphics/trains/train_collett.tmg -->
         ... and so on ...
      </train>
      ... more trains ...
   </trains>
   <road>
      .....
   </road>
   ...
</vehicles>
This would make the game very easy to extend in the future.

I'll probably post more things as I think of it.
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

Ad 1) Agree.. C++ is the best for this project (and the most popular)
Ad 2) We may not create support for Win 3.1 .. anyway it must run on others system ... at linux should to
Ad 3) We were thinking about ONE FILE = ONE OBJECT ...
(example)
so in \Vehicles directory every ZIP file will store in itself INI (with vehicle data) .. or it can be XML anyway ... and graphics ...
but not all data in one file ... this would be harder to edit .. and my idea is easier and it is not so hard to make
what are you looking at? it's a signature!
User avatar
Arathorn
Tycoon
Tycoon
Posts: 6937
Joined: 30 Nov 2002 17:10

Post by Arathorn »

To be honest, I think it should be made for Win 9x and higher, and then maybe someone can convert it to Linux.
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

Arathorn wrote:To be honest, I think it should be made for Win 9x and higher, and then maybe someone can convert it to Linux.
Yep .. up from 9x ...
what are you looking at? it's a signature!
User avatar
orudge
Administrator
Administrator
Posts: 25147
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

SHADOW-XIII wrote: Ad 3) We were thinking about ONE FILE = ONE OBJECT ...
(example)
so in \Vehicles directory every ZIP file will store in itself INI (with vehicle data) .. or it can be XML anyway ... and graphics ...
but not all data in one file ... this would be harder to edit .. and my idea is easier and it is not so hard to make
Didn't you notice my comment in the code block?
<!-- this could open, say, data/graphics/trains/train_collett.tmg -->
That's what I was planning (like Simutrans now uses, and the TTDPatch new vehicles does) - it would be better.

Also, I don't really think we should use INI files for this (they may have uses in other places) - XML is probably better.
User avatar
orudge
Administrator
Administrator
Posts: 25147
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

Arathorn wrote:To be honest, I think it should be made for Win 9x and higher, and then maybe someone can convert it to Linux.
No, it'd be much easier if we make it portable from the start. We don't need to write a Linux driver at the very beginning - just a Win32 one would do fine, but it'd be much easier to make the game support multiple systems from the beginning than half-way through.
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

I noticed but it I only tell you that it shouldn't been in one XML file data of many vehicles ... so it should be like that

Code: Select all

<vehicles> 
<!--   <trains>  NO USED -->
      <train> 
         <name>Collett Pannier Tank</name> 
         <speed>40</speed> 
         <power>500</power> 
         <sprite>collett</sprite> 
         <!-- this could open, say, data/graphics/trains/train_collett.tmg --> 
<!--      ONLY ONE VEHICLE -->
      </train> 
<!--     ... NO more trains ...  -->
<!-- NOT USED   </trains> -->
<!--    <road>  -->
<!--       .....  -->
<!--    </road>  -->
<!--    ...  -->
</vehicles> 
what are you looking at? it's a signature!
User avatar
orudge
Administrator
Administrator
Posts: 25147
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

Ah right. Personally, I think that might get a bit messy though. Seperate train, plane, road vehicle and ship (and whatever else we might have) XML files though could be a possibility. We could have downloadable .TMV (Transport Master Vehicle - of course, this depends on the name of the game) files which are automatically merged into the appropriate vehicle XML file if you double-click them (or execute a specific command line, or whatever).
Hellfire
Transport Empire Developer
Transport Empire Developer
Posts: 699
Joined: 03 Feb 2003 09:30
Location: Back at the office

Post by Hellfire »

How about one database XML file, which is extensible, like this:

Code: Select all

<vehicles> 
  <trains> 
    <train> 
      <name>Collett Pannier Tank</name> 
      <speed>40</speed> 
      <power>500</power> 
      <sprite>collett</sprite> 
    </train> 
    <include>sometrainfile.xml</include>
  </trains>
  <road>
  ...
  </road>
  <include>somevehiclepack.xml</include>
</vehicles>
In this example, sometrainfile.xml would be for example

Code: Select all

<train>
  <name>T.G.V.</name>
  ...
</train>
Or someveheclepack.xml

Code: Select all

<trains>
  <train> ...... </train>
  <road> ...... </road>
</trains>
The game's XML parser then only has to search for <include> tags, and include the specified files on that spot.

Or even better: let the game search for all possible XML files in the game database directory, and process all XML files in there.
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

It will be hard to edit it for users ..
/me looks at ashley
I think the best idea is one zip (with XML and Graphic files in it) for each vehicle ...
what are you looking at? it's a signature!
User avatar
rein
Traffic Manager
Traffic Manager
Posts: 132
Joined: 12 Jan 2003 17:16
Location: Poland - Czestochowa

Post by rein »

hmmm, but why can't we use old good red alert's ini files?
that's much more clear and easy to implement (i've already made code for this). Look at the example:

Code: Select all

; Trains
; here's the list of all parameters with adnotations
[TRAIN]
Name = First Steam Engine
Type = Steam
Speed = 70
Acceleration = 0.1
Headings = 32
GfxFile = gfx/vehicles/steam01.bmp
...

[WAGON]
Name = goods car
Use = Goods, Paper, Components ...
Headings = 32
...

; Trucks
; here goes description
[TRUCK]
Name = blah blah
Type = Cargo
Speed = 60
...
Transport Empire general programmer
ICQ: 288845484

visit #TEmpire
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

There is disadvantages .... INI files can be up to 32 (or 64) Kb ... but advantage is: easy making them and maneaging them ...
what are you looking at? it's a signature!
Hellfire
Transport Empire Developer
Transport Empire Developer
Posts: 699
Joined: 03 Feb 2003 09:30
Location: Back at the office

Post by Hellfire »

SHADOW-XIII wrote:There is disadvantages .... INI files can be up to 32 (or 64) Kb ... but advantage is: easy making them and maneaging them ...
That's not true. MS Notepad is such a stupid program... It can't support files over 64kb. The INI files themselfs can be over 1MB if they have to.
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

Dunno .. in BCB6 in Help about IniFiles there is text about INI size limit
what are you looking at? it's a signature!
User avatar
orudge
Administrator
Administrator
Posts: 25147
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

INIs are good because of their simplicity, but simplicity can also be a problem. I think XML would be a good solution.
User avatar
rein
Traffic Manager
Traffic Manager
Posts: 132
Joined: 12 Jan 2003 17:16
Location: Poland - Czestochowa

Post by rein »

heh, but it's bit difficult to get the hang of this whole XML structure, i mean at first look it's very indistinct. INI's look much more natural and intuitive, and why we should complicate the most simple solution?

heh, i like speed = 100 much more than <speed>100</speed> - besides that it will take more time to write this all (if we don't use a separate program to set it all up) - and finally - try to make quick changes during balancing :D

ok, give me only one good reason to use XML instead of INI and I will change my mind
Transport Empire general programmer
ICQ: 288845484

visit #TEmpire
User avatar
orudge
Administrator
Administrator
Posts: 25147
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

INIs aren't very well-structured. XML is a logical format. It is, in many ways, the format of the future. OK, we can't just use a simple function to read from it - we'll need an XML parser (and there are plenty of cross-platform ones out there).
User avatar
rein
Traffic Manager
Traffic Manager
Posts: 132
Joined: 12 Jan 2003 17:16
Location: Poland - Czestochowa

Post by rein »

but why Owen, WHYYYYYY...... whaaaa :cry: :cry: :cry: :roll:
/me cries
is it better, faster, simplier, easier to code, easier to write, easier to change, more portable than a simple txt file?

if you really insist, no problem
but I think it just looks MORE PROFESSIONAL and MORE ADVANCED that a simple, lame .ini files, isn't?
Transport Empire general programmer
ICQ: 288845484

visit #TEmpire
User avatar
orudge
Administrator
Administrator
Posts: 25147
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

I'll get back to you on that one, I just have a thought in my head which I want to type:

I meant to include this in my original post - I think we should program the game to have multi-lingual capabilities built in from the start. We could have XML files (yes, XML files!) with all the translations in, and could pre-load the file for whatever language is selected in the language dialog. Then, we call a function whenever we want a string, which retrieves the appropriate translation from memory.
lumted
Traffic Manager
Traffic Manager
Posts: 181
Joined: 20 Oct 2002 10:56
Location: Norway
Contact:

Post by lumted »

That would make it VERY easy to translate =)

One question about using the XML though;

Code: Select all

<trains> 
    <train> 
      <name>Collett Pannier Tank</name> 
      <speed>40</speed> 
      <power>500</power> 
      <sprite>collett.spr</sprite> 
    </train> 
</trains> 
Woudn't it be better to have something like this:

Code: Select all

<trains> 
    <train> 
     <uniqueidforthistrain>some kind of hash (md5?)</uniqueidforthistrain>
     <name>Collett Pannier Tank</name> 
       <speed>40</speed> 
       <power>500</power> 
       <sprite>collett.spr</sprite> 
     </train> 
    <train> 
    <uniqueidforthistrain>some kind of hash (md5?)</uniqueidforthistrain>
     <name>Collett Pannier Tank v2.0</name> 
       <speed>70</speed> 
       <power>1500</power> 
       <sprite>collett2.spr</sprite> 
     </train> 
</trains> 
Woudn't this make it easier to identify specific trains/vehicles/whatever?
Locked

Return to “Transport Empire Development Archive”

Who is online

Users browsing this forum: No registered users and 1 guest