Compiling BoE source code for Windows

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).

Pages

AuthorTopic: Compiling BoE source code for Windows
Apprentice
Member # 8738
Profile Homepage #0
Hi all! I've tried to compile BoE Windows code release and a lot of errors showed up. I think that the problem is that some files are missing: "townspec.h", "town.h", "text.h", "specials.h" and maybe others. Jeff, can you check for these files in your archives?
Posts: 14 | Registered: Wednesday, May 16 2007 07:00
Apprentice
Member # 4231
Profile #1
Specifically, there seem to be none of the files alphabetically after "PARTY.H".

--------------------
Lifetime Spiderweb Gamer
and Fan of Classic Style Graphics
Posts: 42 | Registered: Saturday, April 10 2004 07:00
Board Administrator
Member # 1
Profile Homepage #2
Unbelievable. These files are indeed missing. I'll look for them and try to put them in int he next few days.

- Jeff Vogel

--------------------
Official Board Admin
spidweb@spiderwebsoftware.com
Posts: 960 | Registered: Tuesday, September 18 2001 07:00
Board Administrator
Member # 1
Profile Homepage #3
OK, go to the source code page now and redownload. All the files should be there now.

- Jeff Vogel

--------------------
Official Board Admin
spidweb@spiderwebsoftware.com
Posts: 960 | Registered: Tuesday, September 18 2001 07:00
Apprentice
Member # 8738
Profile Homepage #4
I've tried to port BoE to Win32 API and I encountered some problems I cannot bypass. You can see them HERE. Also see the SOURCE CODE. I've used Dev-cpp IDE which is based on GCC compiler. I'd be happy to get some help from someone experienced in Windows API.

For those who try to solve some basic problems with code published by Jeff while messing with original code:
1) Some Win16 functions and macros are completely removed from Win32 and some are replaced with their extended versions. MoveTo() is to be replaced by MoveToEx(). Members of POINT structure changed their type, so you have to change some things. You can start with MAKEPOINT macro - write your own. Also replace GetWindowWord() with GetWindowLong() and delete MakeProcInstance() as it is obsolote now.
2) You should check whether DeleteDC() and ReleaseDC() are used to destroy right objects. In Jeff's code there are some places where HDCs are deleted by using DeleteObject() which resulted in unexpected behavior of my WinXP. And you have to change fry_dc() function because it calls ReleaseDC and DeleteDC on the same object.
3) You have to add "#include <windows.h>" on the beginning of GAMEDLOG.RC, if you get compilation error

[ Saturday, May 26, 2007 07:16: Message edited by: Ormus ]
Posts: 14 | Registered: Wednesday, May 16 2007 07:00
Apprentice
Member # 8808
Profile #5
Hi:)
If You want to make code more compatible with Win32, You should rewrite all file I/O functions. You should use CreateFile instead of OpenFile functions, SetFilePointer instead of _llseek, etc.

BTW there is no TINYOBJ.BMP file in Windows release of EoB source code. You can get it from shareware version of EoB.
Posts: 5 | Registered: Sunday, May 27 2007 07:00
Off With Their Heads
Member # 4045
Profile Homepage #6
EoB? :P

I want to say something useful in addition to that, but I just don't have anything.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Apprentice
Member # 8808
Profile #7
Beeps... :rolleyes: I mean BoE od course :D Thanks! ;)
Posts: 5 | Registered: Sunday, May 27 2007 07:00
Apprentice
Member # 8738
Profile Homepage #8
quote:
Originally written by r.Q:

Hi:)
If You want to make code more compatible with Win32, You should rewrite all file I/O functions. You should use CreateFile instead of OpenFile functions, SetFilePointer instead of _llseek, etc.

Thanks for advice! I've just rewritten them! Unfortunately, it didn't help with the "no room for graphics" problem. I don't know how to fix it. I'll try to figure it out today. Are there any other people working on Win32 BoE?

EDIT: I've just realised that savegames aren't loading properly.

[ Wednesday, May 30, 2007 02:12: Message edited by: Ormus ]

--------------------
Blades of Exile for Win32
Posts: 14 | Registered: Wednesday, May 16 2007 07:00
Infiltrator
Member # 4248
Profile #9
I have a problem of the most basic kind: I have no idea how to actually compile this game! My logic tells me there is a step-by-step guide somewhere... but so far my attempts to find one have been fruitless.

So could someone give me a hint about what I need to compile the source, how do I do it and where should I look for further info?

--------------------
I have nothing more to do in this world, so I can go & pester the inhabitants of the next one with a pure concscience.
Posts: 617 | Registered: Tuesday, April 13 2004 07:00
Apprentice
Member # 548
Profile #10
quote:
Originally written by Frozen Feet:

I have a problem of the most basic kind: I have no idea how to actually compile this game! My logic tells me there is a step-by-step guide somewhere... but so far my attempts to find one have been fruitless.

So could someone give me a hint about what I need to compile the source, how do I do it and where should I look for further info?

I've given it a shot myself, and here's what I can tell you so far.

The first thing is to set up a Windows development environment. You can use these free tools:

Visual C++ 2005 Express
http://msdn.microsoft.com/vstudio/express/visualc/

Microsoft Platform SDK
http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35- C656-4969-ACE8-E4C0C0716ADB&displaylang=en

How to Use the Platform SDK in Express
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

Then you can make a Blades project with the code (.h, .cpp) and resource files (.rc) in it. If adding files to the project crashes Visual Studio, you need to patch it with the latest Service Pack.

Now, the data does not need to be added to your project, but it does need to be in the right places. If you created the solution and project with the default directory structure, then the BladScen folder goes in your project directory because this is also the default working directory.

The sounds folder should be named "blades" and placed in your solution directory (that is, one directory up from your project directory) -- the blades.rc resource file assumes the sounds path to be "..\blades", but you can change that to anything you like.

That's all the steps I know to get working with Blades in Windows. Getting a successful build is another matter, which I leave to more talented Windows coders than I.

[ Wednesday, May 30, 2007 15:13: Message edited by: Iori Branford ]

--------------------
The essence of balance is detachment. To embrace a cause, to grow fond or spiteful, is to lose one's balance, after which no action can be trusted. Our burden is not for the dependant of spirit.
Posts: 16 | Registered: Wednesday, January 23 2002 08:00
Apprentice
Member # 8738
Profile Homepage #11
Hi guys! I've managed to find source of my problems with loading BoE save-games. It took me a lot of time but I've found it. Compiler used by Jeff didn't align data in structures to memory addresses divided by 2 or 4 because it wasn't important years ago to do it. But my compiler does align data in structures and this changes values of all the sizeof's used to measure length of data blocks to read or write. I suppose that other modern compilers may do that. Unfortunately, I couldn't find how to turn off this thing, so I had to rewrite some portions of FILEIO.CPP in a very ugly way. Now it is loading save-games correctly. Still I haven't rewritten any other input-output functions at this time because there is another problem to deal with - something connected with placing PCs in scenario just after loading it. You can see it on screen capture. My source code is here.

Frozen Feet, you want to compile BoE as 16 or 32-bit application? I suppose that as 16-bit application it should compile without any problems. But if you want to make it 32-bit then you should look at this PDF. It's about porting old Windows apps to 32-bit world and I've found it VERY useful. And there is one thing that isn't mentioned anywhere: on Win32 members of structure named RECT has changed its size.

[ Friday, June 01, 2007 05:58: Message edited by: Ormus ]

--------------------
Blades of Exile for Win32
Posts: 14 | Registered: Wednesday, May 16 2007 07:00
Guardian
Member # 6670
Profile Homepage #12
I haven't taken a good look at the source yet, but how hard would it be to implement sizeof everywhere you need to change from 16-bit to 32-bit? I realize that, depending on JV's code, it could be a big overhaul, but if it isn't done the source will have to be changed again if and when everyone moves to 64-bit.

EDIT: Grammar are nice.

--------------------
I stayed up all night playing poker with Tarot cards. I got a full house and seven people died.
- Steven Wright

[ Friday, June 01, 2007 06:17: Message edited by: Dintiradan ]
Posts: 1509 | Registered: Tuesday, January 10 2006 08:00
Apprentice
Member # 8738
Profile Homepage #13
I don't see how using sizeofs could help. Could you explain it more, please? I've had a lot of problems because of their usage in BoE code, not because of lack of it.

EDIT: I think that what could really help is good documentation of file formats, data structures and algorithms. Porting is always difficult but it could be less time consuming.

[ Friday, June 01, 2007 06:46: Message edited by: Ormus ]

--------------------
Blades of Exile for Win32
Posts: 14 | Registered: Wednesday, May 16 2007 07:00
Guardian
Member # 6670
Profile Homepage #14
... gah.

Sorry, brain fart on my end. I was thinking of something completely different.

--------------------
I tried to hang myself with bungee cord. I kept almost dying.
- Steven Wright
Posts: 1509 | Registered: Tuesday, January 10 2006 08:00
Babelicious
Member # 39
Profile Homepage #15
Ormus: What that looks like to me is that you're properly loading the scenario record and the text but not the town records, which are loaded separately.

You should try spitting out the starting co-ordinates when placing the party. where_start for ASR is (14, 56) -- which it obviously isn't for you -- and which_town_start is 1. That's what I'd check for.

UPDATE: Are you using the copy of ASR packaged with the source release? Because it appears that it's corrupt.

It and the packaged ZKR are garbled when I load them with my scenario dumper. Meanwhile, VoDT and all three of the Mac versions of the scenarios load fine, as well as a half dozen scenarios I just downloaded. Finally, I found some old copies of them lying around on my hard drive -- the Windows versions, natch -- and they worked.

So the copies of STEALTH.EXS and ZAKHAZI.EXS packaged with the Windows source release version 2 are corrupt. Don't use them for testing.

UPDATE 2: Running stock BoE in an old version of Wine, I tried to run the apparently corrupt STEALTH.EXS. I was partially able to duplicate your issue. It placed me 'correctly' -- that is, on the dock -- but moving in any direction resulted in a special-out-of-range error and I was teleported into the middle of nowhere. Hope that helps.

[ Friday, June 01, 2007 18:37: Message edited by: Andrea ]

--------------------
Pygmalion | Desperance | Djur
Posts: 1074 | Registered: Wednesday, October 3 2001 07:00
Apprentice
Member # 8738
Profile Homepage #16
You're right, Andrea, Windows versions of scenarios are corrupt. Unfortunately, I was disconnected from the internet so I couldn't read your post and I spend 8 hours looking for errors in code. :( Then I discovered that scenario editor couldn't open these scenarios and realized that something is not right with them. Great thanks anyway - it's nice to know that someone wants to help!

After changing scenarios to the Mac ones I've fixed all code responsible for loading and saving save-games. Now it works correctly. At this time I have to test all the game mechanisms, check for bugs etc. Currently I can compile and run BoE, make nice group of adventurers, load scenario, talk with some NPCs, fight with someone. It all works.

Links: source code, main executable

Now I want to find out why the game runs so slow and I think it's necessary to tidy up the code.

[ Saturday, June 02, 2007 06:03: Message edited by: Ormus ]

--------------------
Blades of Exile for Win32
Posts: 14 | Registered: Wednesday, May 16 2007 07:00
Apprentice
Member # 8808
Profile #17
quote:
Originally written by Ormus:

Compiler used by Jeff didn't align data in structures to memory addresses divided by 2 or 4 because it wasn't important years ago to do it. But my compiler does align data in structures and this changes values of all the sizeof's used to measure length of data blocks to read or write. I suppose that other modern compilers may do that. Unfortunately, I couldn't find how to turn off this thing, so I had to rewrite some portions of FILEIO.CPP in a very ugly way. Now it is loading save-games correctly.
There is a way to turn off structure data align on the GCC based compiler (e.g Dev-C++). To do it, You have to add "__attribute__" instruction to a structure definition. For example:
typedef struct
#ifdef __GNUC__
__attribute__ ((packed))
#endif
{
char a;
int b;
} NOT_ALIGNED_STRUCTURE;
Anyway, this is not recommended but it's worth to know ;)
Posts: 5 | Registered: Sunday, May 27 2007 07:00
Shaper
Member # 73
Profile #18
Ormus: I just downloaded, extracted, and ran the application. It skips the introduction with the Spidweb logo, the splash screen, and the music. I simply get a black screen with a black popup window which I assume is the Tip Of The Day. I moved it around which revealed the text on the main menu buttons but no images, closed the window with what I assume is the OK button, heard the click sound, and still couldn't see anything. I had to close the program with the Task Manager, I think due to the same problem I have with the old BoE (it insists on changing my Windows colors every time I switch to it from another program, and then the colors need to change back when I switch to another program from BoE, causing my computer to lag for a minute or two every time I switch to or from BoE).

Black screen aside, it would be nice if you could remove whatever code is switching the Windows colors to stop the lagging.I have very little programming knowledge, but I assume getting rid of that bit of code wouldn't harm compatibility or anything.

Hmm. Further investigation reveals the character and scenario editors change the colors too, but have considerably less lag. It must be something else.

--------------------
My Myspace, with some of my audial and visual art
The Lyceum - The Headquarters of the Blades designing community
The Louvre - The Blades of Avernum graphics database
Alexandria - The Blades of Exile Scenario database
BoE Webring - Self explanatory
Polaris - Free porn here
Odd Todd - Fun for the unemployed (and everyone else too)
They Might Be Giants - Four websites for one of the greatest bands in existance
--------------------
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Posts: 2957 | Registered: Thursday, October 4 2001 07:00
Apprentice
Member # 8738
Profile Homepage #19
r.Q, thanks, I''ll check it. It would really help.

The Almighty Do-er of Stuff, probably you don't have image files in right subfolder. Download this, unpack and run. Then tell me if you still have problems with colors and lagging.

Now I'm porting Character Editor. I was planning to port Scenario Editor first, but it seems that some files are missing (again). I couldn't find "townout.h" and "tfileio.h". :( I hope that Jeff will find these ones too.

--------------------
Blades of Exile for Win32
Posts: 14 | Registered: Wednesday, May 16 2007 07:00
Board Administrator
Member # 1
Profile Homepage #20
"Now I'm porting Character Editor. I was planning to port Scenario Editor first, but it seems that some files are missing (again). I couldn't find "townout.h" and "tfileio.h". I hope that Jeff will find these ones too."

Meh. Just make them. Copy-paste the function/procedure headers over and you got it.

- Jeff Vogel

--------------------
Official Board Admin
spidweb@spiderwebsoftware.com
Posts: 960 | Registered: Tuesday, September 18 2001 07:00
Apprentice
Member # 8738
Profile Homepage #21
quote:
Originally written by Spidweb:

Meh. Just make them. Copy-paste the function/procedure headers over and you got it.
You're right! Sometimes the simpliest solutions are the hardest to imagine. :D Unfortunately, TOWNOUT.CPP doesn't exist, so I can't create appropriate header file for it. :(

The Almighty Do-er of Stuff, I've changed the code responsible for color palette changes. Now the game should work without any problems. And now it works really fast (at least on my computer). Please, download the game from my makeshift website (link is in the signature).

--------------------
Blades of Exile for Win32
Posts: 14 | Registered: Wednesday, May 16 2007 07:00
Shaper
Member # 73
Profile #22
Yes, now it is SUPAR SPEEDY. Thanks! I still miss the splash screen and intro music though, but I suppose I can live without it.

Anyway, there's another bug that was in the Win16 version and was carried over to the Win32 version. On my 1280x960 monitor, BoE's main screen displays just fine, as it did on smaller monitors I had in the past. However, on my 1600x1200 monitor, it looks like this: http://ados.ermarian.net/garbage/boemain.gif (681.77 KB GIF image, dialup beware)

That black area is black when I first open the program, but when I go to different screens within BoE or put other windows in front of it, it gets filled in with whatever was there. This only seems to happen with the main screen and not other screens.

[ Monday, June 04, 2007 09:15: Message edited by: The Almighty Do-er of Stuff ]

--------------------
My Myspace, with some of my audial and visual art
The Lyceum - The Headquarters of the Blades designing community
The Louvre - The Blades of Avernum graphics database
Alexandria - The Blades of Exile Scenario database
BoE Webring - Self explanatory
Polaris - Free porn here
Odd Todd - Fun for the unemployed (and everyone else too)
They Might Be Giants - Four websites for one of the greatest bands in existance
--------------------
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Posts: 2957 | Registered: Thursday, October 4 2001 07:00
Board Administrator
Member # 1
Profile Homepage #23
"You're right! Sometimes the simpliest solutions are the hardest to imagine. Unfortunately, TOWNOUT.CPP doesn't exist, so I can't create appropriate header file for it. "

I just don't have time to dig that old machine out of storage again. Use the Mac version. You'll have to change the #includes at the top of the change the call to launch the dialog boxes (change it from the Mac ModalDialog to whatever it being used for the Windows version. Should be pretty quick.

- Jeff Vogel

--------------------
Official Board Admin
spidweb@spiderwebsoftware.com
Posts: 960 | Registered: Tuesday, September 18 2001 07:00
Babelicious
Member # 39
Profile Homepage #24
Ornus: your Windows source refers to a 'look.cur' which I can't find anywhere. Other than that, it's compiling very smoothly with winelib. Do you know where that file may be?
.

[ Monday, June 04, 2007 11:27: Message edited by: Andrea ]

--------------------
Pygmalion | Desperance | Djur
Posts: 1074 | Registered: Wednesday, October 3 2001 07:00

Pages