Forum



DrAsik am 08.08.2010 07:37 #5672


Hello,

first off, I do not know German, so I am only able to use this site due to the magic of Google Translate. Sorry
for all you non-English readers.

I am trying to understand the code base. I'm stepping through the code in VS2008 and taking notes as I go.
Right now I'm looking at the Loader::LoadFilesAtStart method and seeing what the game loads and how it handles
the different file formats. Right now I understand than .BBM files contain color palettes, and that .ACT files
are color palettes as well. BMPs are images of course, and .DAT contain several different resources indexed by
IDX files. DAT is very complex because there are many different things it can contain, all of which are treated
very differently (fonts, bitmaps, etc.), so currently I'm looking at that and it's taking a lot of time.

I would like if some of the developpers could either point me to some documentation or give a high-level
overview of how the game works, to help me get up to speed more quickly. Also I have a very specific question:
in Loader.cpp at line 140 is the following code:

if(!LoadFile( i->c_str(), GetPaletteN("pal5"), load_always ) )

I wonder why is GetPaletteN("pal5") called there and what is the return value supposed to be used for. Why is
it always "pal5"?

Anyway, thanks for making your code open-source, this is very interesting. I've always wanted to understand how
Settlers 2 worked since I was a child.


Spike am 09.08.2010 09:21 #5673

Im Ruhestand
Hello and welcome ;)
English shouldn't be a problem for the most people here.
I don't think that may answer will help you but the pal5 is the original Pallette normally and so i think that palette is needet to draw the old buildings which are using that palette. Maybe it's only loaded that you need the original game because the palette is also as pal5.act aviable i think. Mayba this helps you and i hope that my information are right^^

mfg Spike

---



DrAsik am 09.08.2010 20:41 #5674


Ok I should be able to figure that out. Question about sound: What are the different sound formats used by
Settlers 2? Please be very specific, I suppose it is some kind of MIDI but what kind exactly (there exists several
MIDI formats: SMF (Format 0, 1, 2), MOD, RCP, R36, G18, G36, MFi, etc.. Is it that same format for music and
sound? Why does RTTR convert the musics to OGG but not the in-game sounds?`

Thanks again very much for your replies.


OLiver am 10.08.2010 14:31 #5675

FloSofts Coding-Sklave
Hey,

the ingame sound is just normal pcm data 8bit mono if I remeber it correctly with different frequencies (which is very strange btw). That's the reason the "soundconverter" exists because alle the sounds are converted to 44,1khz in order to load them easily.

The midi files are in the XMIDI format which means that those files contains usual midi commands (note on/off etc.) but with different file headers and some other stuff, so they don't use the standard MIDI file format.

We converted the midi to ogg because it's easier to play the stuff because on some OS, especially on Linux it's often a bit tricky to play midi files nowadays and then they use different software synthesizers which causes different sound etc. so it's easier you have normal (compressed) pcm data.

---
Warum heißt der Staatsbürger "Staatsbürger"?
-> Weil er für den Staat bürgt.


DrAsik am 10.08.2010 17:20 #5676


Ok so sounds are pcm and music is xmidi which is an obscure midi format. Why then do you have both MIDI and XMIDI code files, e.g.:

XMIDI_Track.cpp
MIDI_Track.cpp

ArchivItem_Sound_XMidi.cpp
ArchivItem_Sound_Midi.cpp

etc. ?


OLiver am 10.08.2010 20:28 #5677

FloSofts Coding-Sklave
Afaik because we had converted the XMIDI files to MIDI files which could be loaded by the sound libraries. Actually this stuff is obsolete and could be removed.

---
Warum heißt der Staatsbürger "Staatsbürger"?
-> Weil er für den Staat bürgt.


BaBaUTZ am 11.08.2010 04:00 #5678


Why didnt u use the CD Audio tracks for those ogg files?


FloSoft am 11.08.2010 12:45 #5679

Großmeister
thats a good question

---
mfg
Flo



DrAsik am 11.08.2010 17:16 #5680


Zitat von OLiver:
Actually this stuff is obsolete and could be removed.
Do you mean that it is not used in the latest revisions?
If so, what do you do instead?


FloSoft am 11.08.2010 21:34 #5683

Großmeister
Zitat von DrAsik:

Zitat von OLiver:
Actually this stuff is obsolete and could be removed.
Do you mean that it is not used in the latest revisions?
If so, what do you do instead?

its quite simple: we're using the ogg-files instead

---
mfg
Flo



DrAsik am 11.08.2010 23:07 #5684


Zitat von FloSoft:
its quite simple: we're using the ogg-files instead
But when the game is run the first time, you need to
convert the midi tracks to OGG first, right? So, at least then you need to use the MIDI/XMIDI stuff. Also, when I stepped through the
code last time I saw that upon loading the resource files, it stumbled on some MIDI assets and started analyzing them (even though
the OGG files already existed). I'm not sure why it would process any MIDI assets if the sounds are PCM and the musics are pre-
converted to OGG.

Thanks again for your explanations.


FloSoft am 12.08.2010 08:58 #5685

Großmeister
the original pcm sounds are in different samplerates (between 9-11khz), but this is not supported by the sdl-mixer library, so the program does convert them all to 44.1khz

---
mfg
Flo



DrAsik am 14.08.2010 19:04 #5686


Question about fonts. It looks like Siedler25 uses font09, but not font11 and font14. For most of the UI, it uses its own font,
located in RTTR/LSTS/OUTLINE_FONTS.LST. font14 looks exactly like it, except it misses the black outline we can see in-game. Is
OUTLINE_FONTS.LST generated from original Settlers 2 fonts like font14? If so, when is it generated?

Thanks.


DrAsik am 14.08.2010 19:12 #5687


Question about fonts. It looks like Siedler25 uses font09, but not font11 and font14. For most of the UI, it uses its own font,
located in RTTR/LSTS/OUTLINE_FONTS.LST. font14 looks exactly like it, except it misses the black outline we can see in-game. Is
OUTLINE_FONTS.LST generated from original Settlers 2 fonts like font14? If so, when is it generated?

Thanks.


DrAsik am 15.08.2010 19:43 #5690


Other question: as far as I can tell, .SWD and .WLD are identical file formats. They are handled in exactly the same way (i.e. by ArchivItem_Map.cpp). .SWD is only used by RTTR. Why the new file extension then, why not just use .WLD everywhere?


FloSoft am 15.08.2010 22:14 #5691

Großmeister
hi, wlds are the files from the s2editor. they will be listed in the maps view too

---
mfg
Flo



Spike am 16.08.2010 09:13 #5694

Im Ruhestand
If I understand it right, the .swd files are the map files saved by the original s2 editor and the .wld files were the mission map files. (but  you could rename the .wld to .swd and then edit with the editor)

---



FloSoft am 16.08.2010 12:20 #5702

Großmeister
oh yes, I switched the two. wld are the original map files, swd are the files created by the s2editor. They both have the same format.

---
mfg
Flo





Feel free to post in English!

Antwort schreiben

Username:
Security code:
Text:

   
  Convert smilies like :), ;) etc. into small graphics?
  Convert WWW-addresses into clickable links?
  Soll Boardcode in ihrer Nachricht aktiviert werden?