Bay 12 Games Forum

Dwarf Fortress => DF General Discussion => Topic started by: Toady One on September 22, 2006, 12:46:00 pm

Title: Kobold Quest port status?
Post by: Toady One on September 22, 2006, 12:46:00 pm
I've had some more inquiries, so I was curious if anybody was working on this?  If I remember, some potential porters were starting to feel uneasy about releasing any of their own work under BSD, which is reasonable.  I'll start an SDL port at some point if there's nobody working, but it'll likely be inferior since it would be my first time with the library.

edit: unabbreviated title in topic!

[ September 22, 2006: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: dav on September 22, 2006, 03:30:00 pm
It's a sign of my gaming orientation that my first thought was "ASCII King's Quest?  Cool!"
Title: Re: Kobold Quest port status?
Post by: odd2k on September 22, 2006, 08:36:00 pm
Well, I know of one goon who said he would be porting it. I will summon him to this thread.
Title: Re: Kobold Quest port status?
Post by: Gakidou on October 03, 2006, 06:40:00 pm
Although I doubt my skills are up to porting it, now that midterms are over I'm going to take a look at it. I'm still interested to hear if anyone has made any progress yet with either porting or getting it to compile in something other than Visual Studios. (I'm going over to check the other thread about that...)
Title: Re: Kobold Quest port status?
Post by: jerkloaf on October 10, 2006, 05:00:00 pm
I rewrote the windowing system in SDL but I broke rendering in the process. I have no idea how to make SDL mesh with OpenGL properly although I know it's possible. It also doesn't have working input yet because I don't have a way of testing that.

edit:The code compiles and it plays the title song, just doesn't display anything.

[ October 11, 2006: Message edited by: jerkloaf ]

Title: Re: Kobold Quest port status?
Post by: Toady One on October 10, 2006, 09:59:00 pm
When I got the SDL Gears sample running with OpenGL, it seemed like the only difference was that you passed an SDL_OPENGL flag in the beginning:

code:

SDL_SetVideoMode(600, 600, 16, SDL_OPENGL|SDL_RESIZABLE);

Then you can just use standard OpenGL functions inside the event handling loop.  I might have missed something.  I didn't look at it very closely.  There are lots of short samples floating around though.

Title: Re: Kobold Quest port status?
Post by: jerkloaf on October 11, 2006, 06:40:00 pm
I did pass SDL_OPENGL to SetVideoMode. I'm not sure what I'm doing wrong, but here's my code in case anyone wants to take a whack at it.
http://jagular.org/d/files/1/updated.zip

Note:These are just the updated source files. You'll need to download SDL and add it to your library/header include directories. enabler.cpp will link sdl.lib and sdlmain.lib assuming you have them.

[ October 11, 2006: Message edited by: jerkloaf ]

[ October 11, 2006: Message edited by: jerkloaf ]

Title: Re: Kobold Quest port status?
Post by: peterb on October 17, 2006, 09:41:00 pm
I spent an afternoon on this, and then got too busy to follow up on it.  From what I can see, there are three issues in porting to SDL (and specifically, Mac).

(1) The horrifically huge case-statement with all the windows-specific key-codes.  Changing those to SDL key codes is mostly a mechanical task, although there are a few places where they don't match up perfectly.

(2) the main program loop.

(3) various windows data types are used throughout, and need to be typedef'd (or avoided) on systems that don't have them.

I did most of (1) and some of (3).  I've been too busy to even think about (2).

But I really want to be able to play DF on OS X.  How much do I have to raise in donations  to convince you to just do it?  :-)

Title: Re: Kobold Quest port status?
Post by: peterb on October 17, 2006, 09:43:00 pm
oh, and it needs to deal with build systems other than Visual C, of course.  I threw together a cheesy unix-style Makefile.

[ October 17, 2006: Message edited by: peterb ]

Title: Re: Kobold Quest port status?
Post by: jerkloaf on October 18, 2006, 05:22:00 pm
quote:
Originally posted by peterb:
(3) various windows data types are used throughout, and need to be typedef'd (or avoided) on systems that don't have them.

Which ones, exactly? The only problems I encountered when ripping out windows.h were with files.cpp, game.cpp and enabler.cpp. files needs to be rewritten and so does enabler, but game.cpp just has a MsgBox that needs to be taken out. Of course, I didn't try to compile it on any other systems but I don't recall seeing any windows-specific stuff.

[ October 18, 2006: Message edited by: jerkloaf ]

[ October 18, 2006: Message edited by: jerkloaf ]

Title: Re: Kobold Quest port status?
Post by: peterb on October 18, 2006, 07:35:00 pm
A lot of the data types used use the Windows names instead of the ANSI names.  The first thing I did was throw this together (note, this is totally Hacky McHackHack, and I would not seriously say anyone should use it.  I just wanted to get it closer to compiling).

#ifndef MAC
#define MAC 1

#include <SDL_keyboard>

#define TRUE 1
#define FALSE 0

typedef unsigned int DWORD;
typedef int WORD;
typedef int BOOL;
typedef int32_t LONG;
typedef int64_t LONGLONG;
typedef int32_t HINSTANCE;
typedef void* HANDLE;

typedef union {
 struct {
   DWORD LowPart;
   LONG HighPart;
 };
 struct {
   DWORD LowPart;
   LONG HighPart;
 } u;
 LONGLONG QuadPart;
} LARGE_INTEGER;

typedef struct tagBITMAPINFOHEADER{
 DWORD  biSize;
 LONG   biWidth;
 LONG   biHeight;
 WORD   biPlanes;
 WORD   biBitCount;
 DWORD  biCompression;
 DWORD  biSizeImage;
 LONG   biXPelsPerMeter;
 LONG   biYPelsPerMeter;
 DWORD  biClrUsed;
 DWORD  biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER;

#define VK_F10 121 // Magic!

#endif /* MAC */

Title: Re: Kobold Quest port status?
Post by: X on October 18, 2006, 08:13:00 pm
But those are only for the windows-specific bit that needs to be chopped out anyway, right? Don't need to spec BITMAPINFOHEADER at all if you're using SDL as it has all its own image loading routines, etc.

X

Title: Re: Kobold Quest port status?
Post by: Gakidou on October 18, 2006, 09:45:00 pm
quote:
Originally posted by X:
<STRONG>But those are only for the windows-specific bit that needs to be chopped out anyway, right? Don't need to spec BITMAPINFOHEADER at all if you're using SDL as it has all its own image loading routines, etc.

X</STRONG>


Perhaps, although if the goal is to create something Toady could easily integrate into DF proper, it would probably be best to keep these kind of checks, at least at first.

Title: Re: Kobold Quest port status?
Post by: popecharlotte on October 19, 2006, 09:03:00 am
I've managed to get the thing working, at least partially - you can get it here.

At the moment you can get to the main game screen, but that's about it as the keyboard input handling still needs doing properly. And texture transparency isn't done yet - everything's very pink.

Title: Re: Kobold Quest port status?
Post by: Gakidou on October 19, 2006, 06:49:00 pm
I just tried to compile it on Ubuntu; unsuccessful:

code:

~/Desktop/kobold$ make
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/adventurer.o mysource/adventurer.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/basics.o mysource/basics.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/cave.o mysource/cave.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/command_line.o mysource/command_line.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/critter.o mysource/critter.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/definition.o mysource/definition.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/graphics.o mysource/graphics.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/kobold.o mysource/kobold.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/music_and_sound.o mysource/music_and_sound.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/random.o mysource/random.cpp
mysource/random.cpp:103: warning: this decimal constant is unsigned only in ISO C90
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/unit.o mysource/unit.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/game.o mysource/game.cpp
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/enabler.o mysource/enabler.cpp
mysource/enabler.cpp: In member function ‘void enablerst::add_gennum_tile(long int, double, double, double, double, char)’:
mysource/enabler.cpp:1525: warning: converting to ‘long int’ from ‘double’
mysource/enabler.cpp:1526: warning: converting to ‘long int’ from ‘double’
mysource/enabler.cpp:1527: warning: converting to ‘long int’ from ‘double’
g++ -I/usr/include/SDL -D_REENTRANT -DNO_FMOD   -c -o mysource/interface.o mysource/interface.cpp
mysource/interface.cpp: In member function ‘bool interfacest::handleEvent(SDL_Event&)’:
mysource/interface.cpp:863: error: jump to case label
mysource/interface.cpp:857: error:   crosses initialization of ‘interfacekeyst* iks’
mysource/interface.cpp:867: error: jump to case label
mysource/interface.cpp:857: error:   crosses initialization of ‘interfacekeyst* iks’
mysource/interface.cpp:871: error: jump to case label
mysource/interface.cpp:857: error:   crosses initialization of ‘interfacekeyst* iks’
mysource/interface.cpp:875: error: jump to case label
mysource/interface.cpp:857: error:   crosses initialization of ‘interfacekeyst* iks’
make: *** [mysource/interface.o] Error 1

Title: Re: Kobold Quest port status?
Post by: peterb on October 19, 2006, 08:09:00 pm
Here's a patch against popecharlotte's build (and a source tarball, if you'd rather just grab that) that will compile and run on a Mac, given certain restrictions:

-it assumes that you have the Linuxy sort of install of SDL in the /usr/local tree.
-it reaches in to the system openGL framework for includes and libraries, which is vaguely obscene.

but, on the up side, it only took me about 10 minutes to roll it up from popecharlotte's tarball.

I also added a few casts in places where we were passing unsigned int pointers to interfaces that really want a GLuint pointer.


unified diff:  http://www.tleaves.com/kobold/kobold-mac-diff

source tarball: http://www.tleaves.com/kobold/kobold-mac.tgz

When I have time i'll try to create an Xcode project for this so it can be made into a "real" app.

[ October 19, 2006: Message edited by: peterb ]

[ October 19, 2006: Message edited by: peterb ]

Title: Re: Kobold Quest port status?
Post by: peterb on October 19, 2006, 09:39:00 pm
Got it building in Xcode.
http://tleaves.com/kobold/KoboldQuest.mac.for-xcode.tgz

For now, the "data" directory has to be manually put in the same directory as the app.  Eventually what should happen is it should just keep and load that stuff from the bundle, but I'm too lazy to do it tonight.

Title: Re: Kobold Quest port status?
Post by: popecharlotte on October 20, 2006, 08:21:00 am
I've now got keyboard input working (kinda) as well as sound. I'll have a look at peterb's stuff this afternoon to see if I can integrate it.

New version can be found here.

Title: Re: Kobold Quest port status?
Post by: popecharlotte on October 20, 2006, 01:45:00 pm
New version here. Mostly just tidying up (getting rid of all the warnings from -Wall). Also note that loading saves and viewing high scores case segfaults at the moment.
Title: Re: Kobold Quest port status?
Post by: Gakidou on October 20, 2006, 06:05:00 pm
I just made the source in Ubuntu; worked! Observations:

-The mouse does not change to the kobold pointer.
-In the cave name section, several keys do not produce any letters. Alphanumerics not appearing are: "cdegikpqst0123456789"
-All letters that are produced are lower case, regardless of caps lock and shift.
-Once the game starts, you can mouse-click between kobolds, but the number keys don't move them. (My laptop lacks a numberpad, so I can't check that.) Period also does not cause time to pass.
-The key-binding menu in options will not accept any input to change the controls.

Title: Re: Kobold Quest port status?
Post by: peterb on October 20, 2006, 08:39:00 pm
Ignore my errors/warnings comment -- I was still using NO_FMOD in the project file.

Seems to work -- I get music, sound, and keyboard input, although the keybindings are tragic for mac users (many of us don't have numeric keypads, especially on laptops).

I was unable to change any keybindings, as per the earlier report.

Note that I did nothing to the source to make this compile -- I just took popecharlotte's last source drop and copied the files in.  The only tweaks I made were to the project file.

I've uploaded new binary and source packages.  If someone with a mac could download the binary and let me know that it works for them, that would be great.

src: http://tleaves.com/kobold/KoboldQuest-src.tgz  

binary: http://tleaves.com/kobold/KoboldQuest.tgz

[ October 20, 2006: Message edited by: peterb ]

Title: Re: Kobold Quest port status?
Post by: Gezol on October 20, 2006, 09:46:00 pm
I just downloaded the binary and tried it out. Alas, all I got was a message saying "You can not open the application 'Kobold Quest' because it may be damaged or incomplete." I don't know if it makes a difference, but I'm running OS 10.3.9 on a G4.
Title: Re: Kobold Quest port status?
Post by: peterb on October 20, 2006, 09:48:00 pm
I think the reason for that is that I linked against the internal zlib, when I should have used the MacOS standard zlib.  I'm uploading a new version now.  I'll get a friend of mine to test it out before demanding that you download it all over again :-)
Title: Re: Kobold Quest port status?
Post by: popecharlotte on October 21, 2006, 01:18:00 pm
I think I've sorted out all the keyboard stuff now. New version here.
Title: Re: Kobold Quest port status?
Post by: peterb on October 21, 2006, 01:37:00 pm
Can I get you to change the zlib includes in game_g.h and enabler.cpp to look like this?

#ifdef MAC
#include <zlib>
#else
#include "zlib/zlib.h"
#endif

Thanks.

Title: Re: Kobold Quest port status?
Post by: Gezol on October 21, 2006, 09:29:00 pm
Well, I don't know if your friend tried it yet, but I downloaded the new version of the Kobold Quest port anyway. The good news is that it starts, and the music plays. The bad news is that it automatically quits as soon as I click on "Play", without a message or anything. It doesn't crash if I click on "View High Scores", though- that seems to be working. Also, there seem to be some display issues still- the kobold picture at the beginning doesn't show up, and the text is cyan highlighted in light green. As you can imagine, it's pretty close to being unreadable.  

Still, this is exciting, and I'm grateful to everyone who's been working on the ports- this is closer than anyone's come so far, and I'm sure it won't take much more to work out the bugs. The dream of Mac and Linux versions of Dwarf Fortress may come true yet...

Title: Re: Kobold Quest port status?
Post by: peterb on October 22, 2006, 08:30:00 am
I'm in that weird state where it works on my machine, but not on any other Mac I run it on.  Typically this means that I'm inadvertently relying on some library in my home directory that isn't being packaged correctly into the application bundle.  I won't have time to look at this again until next weekend, but I'll make sure the source package is up-to-date so that if you get impatient you can build it yourself :-)
Title: Re: Kobold Quest port status?
Post by: popecharlotte on October 28, 2006, 01:20:00 pm
New version here. We now have transparency, mouse cursor, title image and key repeat.
Title: Re: Kobold Quest port status?
Post by: peterb on October 29, 2006, 09:43:00 pm
I got the Mac version working on multiple platforms, finally.  Universal binary is available here:
http://tleaves.com/kobold/KoboldQuest.tgz

Source code here:
http://tleaves.com/kobold/KoboldQuest-src.tgz

No source code changes needed to make it compile.

One heads up for the future:  it's pretty clear to me that the save file format is super-unportable.  You might want to think about that as an area to work on, although it's obviously not a top priority.  (In fact, it was the fact that I accidentally packaged the save file with the binary that hosed me on last week's build).

Title: Re: Kobold Quest port status?
Post by: Toady One on October 29, 2006, 10:39:00 pm
Was that to me or popecharlotte?  What about the file format needs to be changed?  I don't know anything about the file system for Mac.
Title: Re: Kobold Quest port status?
Post by: peterb on October 30, 2006, 12:08:00 am
It was to you :-).  I'll look at the save/load code a little more carefully before sending mail to you directly.
Title: Re: Kobold Quest port status?
Post by: popecharlotte on October 30, 2006, 08:04:00 am
New version here. I think everything is sorted now, in particular saving and high scores now work. It turns out that the problem was in the loading of definitions - the stuff I'd written to replace the Windows-specific code didn't work. The save file format seems fine.

[ October 30, 2006: Message edited by: popecharlotte ]

Title: Re: Kobold Quest port status?
Post by: Gezol on October 30, 2006, 03:21:00 pm
I just tried the new Kobold Quest binary, and, alas, it's still not working for me. It still crashes when I try to start a new game, this time freezing for a while before it does(this time I get the message that the application has unexpectedly quit, incidentally). It's definitely getting closer, though- the text is fixed, but the cursor is invisible. And, interestingly, the kobold picture at the title screen still doesn't show up, but the bug he's holding does. I wonder if there's some display issues with the brown colors or something.

It sounds like you got it working on more than one machine, so this might be just some weird conflict with something on my computer. I might try it on a couple of other Macs later and see how it does on those...

Title: Re: Kobold Quest port status?
Post by: peterb on October 30, 2006, 07:55:00 pm
Gezol,

What would be super-helpful to me would be if you could open the console application, run the game until it crashes, and then copy the output of the console to me in an email.  You can send it to peterb - a t - gmail d o t com.

Thanks!   And yes, I've gotten confirmation that it runs on at least two machines now.  That certainly doesn't mean there aren't still bugs.

(and just to make sure:  you threw out the old folder and completely replaced it with the new one, right?  The issue in the old folder is that it had a save file generated on my machine, and I suspect endianness issues).

Title: Re: Kobold Quest port status?
Post by: Gezol on October 30, 2006, 09:55:00 pm
Yes, I did throw out the old folder before, so that shouldn't be the problem. I just sent you an e-mail. I hope I did this right...
Title: Re: Kobold Quest port status?
Post by: Toady One on October 30, 2006, 10:31:00 pm
I've been reading about sizeof() and endianness.  It should be a fascinating and slow struggle.
Title: Re: Kobold Quest port status?
Post by: Zurai on October 30, 2006, 10:39:00 pm
Endianness makes my head hurt. It's one of the few programming problems (along with networking) that makes me want to not be a programmer, heh.
Title: Re: Kobold Quest port status?
Post by: nihilocrat on November 22, 2006, 11:05:00 am
has there been any more progress with this port? I downloaded the latest source from popecharlotte and plan to compile it on Ubuntu sometime this week.
Title: Re: Kobold Quest port status?
Post by: DDouble on November 22, 2006, 07:29:00 pm
^^^^

Wow almost one month gap between these last 2 posts. I don't use a mac but a cafe I like to go to only has two imacs, and I would love to play some DF there. I could probably get at least 5 people hooked (its a comics cafe, tons of nerds there).

Title: Re: Kobold Quest port status?
Post by: Toady One on November 22, 2006, 07:36:00 pm
I don't know anything about how Macs store files, so I can't do that part without burning a lot of time.  I'm not even sure what all the issues are.  The way the data is stored in the game and the way they are written to a file by another OS aren't necessarily the same, so files wouldn't work between computer without some kind of header information in the file and routines that can convert from the save format to the storage format for a given system.  Perhaps there are other issues as well.
Title: Re: Kobold Quest port status?
Post by: segmose on November 23, 2006, 03:31:00 am
ASCII Tekst files are mostly compatible between platforms, problems are floating points and time.
Title: Re: Kobold Quest port status?
Post by: Toady One on November 23, 2006, 03:37:00 am
There are plenty of floating points and 32 bit integers and other variables that are saved to the disk.  If a "long" isn't 32 bits on another platform or the order of the 4 bytes is reversed, that would need to be accounted for, and I have no idea what other platforms do.  I'm not even sure how my own platform stores the 4 bytes.
Title: Re: Kobold Quest port status?
Post by: X on November 24, 2006, 03:58:00 am
code:
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> struct.pack("i",7)
'\x07\x00\x00\x00'

One easy way to see int as 4 bytes LE.

X

Title: Re: Kobold Quest port status?
Post by: segmose on November 24, 2006, 05:41:00 am
What I meant was to simply store the data as text, no need to wonder on byte ordering.
As 0x000A gets stored as "10".
Title: Re: Kobold Quest port status?
Post by: Toady One on November 24, 2006, 02:55:00 pm
This would increase the file size by quite a lot.  Right now, I copy things into a character array which is then compressed by zlib and saved.  It could copy the longs and other variables into the array as a number string instead (so a long would take 11 bytes, and a short would take 6 bytes), but it would be best to handle the issues prior to saving the file.  As far as I know, I'd only need to handle the one place where the longs are copied into the compression array, since after compression it's just a list of chars that can be saved easily.  So it's just a matter of knowing sizeof(long) and the endian issues for long (and other types) on the target system, and making the small number of "copy into the array" functions behave differently based on the OS.  Unless there are various things I'm missing, which is quite possible.
Title: Re: Kobold Quest port status?
Post by: segmose on November 25, 2006, 05:52:00 am
I found these routines in some network code.
Call these before saving:
itsaint32 = htonl(0x7F000001); // Host To Network Long int
itsaint16 = htons(7654); // Host To Network Short int

and their reverse after loading
ntohl
ntohs

See also here: http://www.penguin-soft.com/penguin/man/3/byteorder.html

Title: Re: Kobold Quest port status?
Post by: Pod on December 05, 2006, 12:56:00 pm
Is this to be considered a final port of kobold quest then?
Title: Re: Kobold Quest port status?
Post by: Toady One on December 05, 2006, 01:28:00 pm
As far as I know, the potential endian/sizeof issues haven't been handled for any platform.  There's the link to that library, but I don't have time to look at it right now.  A port should allow the game to run on the OS and also produce OS-independent save files.
Title: Re: Kobold Quest port status?
Post by: Pod on December 06, 2006, 08:41:00 am
Why bother changing the endianness? Specify it as little endian in the save file format, then, for any port on a different architecture, they simply call a different method in order to load the file instead of a normal one. Getting a truly architecture-independent save file would be a pain in the arse, just leave it small endian and let the few ports that do go to none-x86 sort it out.

I'm not sure I understand the sizeof issues as well - is this to do with 32/64bit compatibility or something else?

Title: Re: Kobold Quest port status?
Post by: Toady One on December 06, 2006, 01:06:00 pm
As I've said before, I simply don't know what Macs and Linux do for files, and I've been told my file format is heavily OS-dependent.  If the ports are done, they are done, but I was under the impression that they aren't.
Title: Re: Kobold Quest port status?
Post by: Pod on December 07, 2006, 02:02:00 pm
Linux doesn't really 'do' anything special for files. Files are files. The old macs had some crazy resrouce fork thingy which I never bothered to understand, but mac os x uses linux...... so I doubt there's anything incompatible about your files.
I'll have a quick look at the files used in kobold quest and see if I agree.
Title: Re: Kobold Quest port status?
Post by: Toady One on December 07, 2006, 04:25:00 pm
Yeah, peterb might comment on this better than I can -- he said an old KQ save file caused a fatal problem of some kind due to endianness, which lead to my comment that files still have some porting work to be done.
Title: Re: Kobold Quest port status?
Post by: peterb on December 09, 2006, 06:31:00 pm
I think I might have been smoking crack.  I dunno.  I still think it's worth proceeding apace.
Title: Re: Kobold Quest port status?
Post by: Toady One on December 09, 2006, 06:44:00 pm
From what I've read, all but the most recent (intel) Macs are going to be big-endian.  This complicates porting to "Mac".
Title: Re: Kobold Quest port status?
Post by: peterb on December 10, 2006, 08:25:00 pm
That's true, but all of the Macs currently being sold are little-endian.  

And more importantly, i have one!

:-)

-p

Title: Re: Kobold Quest port status?
Post by: Toady One on December 11, 2006, 03:09:00 am
The only Mac I potentially had access to is big-endian...  I'll have to figure out how I'm going to compile things.
Title: Re: Kobold Quest port status?
Post by: Shadowlord on December 11, 2006, 04:46:00 am
The aforementioned htons and htonl functions change a platform-dependent short or long into a platform-independent version (Or rather, it changes them to the same endianness on all platforms). As segmose mentioned, ntohl and ntohs are their opposites.

Those functions are in winsock.h on windows, and on linux/macs:

code:
#include <sys>
#include <netinet>
#include <inttypes>

Essentially what you would need to do is:
When reading a 32-bit variable from the save files: fread it, then ntohl it.
When writing a 32-bit variable to the save files: htonl it, then fwrite it.
For 16-bit variables use ntohs and htons instead.
For 8-bit variables, you don't need to do anything. (Endianness is the order of bytes in words (16 bit / 2 bytes), dwords (32 bit), etc, so a big-endian 8-bit variable would be the same as a little-endian one)
If you have ASCII (one byte per character) strings being written, you shouldn't have to do anything to them either. But if they're being written in unicode, maybe you would.

That may probably break compatibility with old save files, however.

Alternately, you try can hackish things to determine whether the system is little-endian or big-endian: Set a short (16-bit) to 0x0001, and then cast it to a two-byte char array, and check to see whether it's index 0 or 1 which is 0x01. Then you can just have a custom byte-swapping function being called which only does anything if the endianness of the platform doesn't match the endianness on the save files. This would preserve compatibility with old save files, and would make them work on machines with different endianness. (First you'd need to do the above test on the PC to see where the 0x01 is, then code it to enable the byte-swapper only if the 0x01 is in the other byte instead)

I'm assuming the compiler won't be so smart that it swaps the bytes around. I've seen them do some annoyingly smart things from time to time, though... So if the 0x01 appears to be in the same place on both little-endian and big-endian systems, then you know that won't work (ntohl etc should still work then though).

P.S. The reason ntohl etc are in network sockets libraries, is that they were created because networks (like the internet) needed a platform-independent protocol, as no network node could be expected to know the endianness of other arbitrary nodes.

P.P.S. You can manually swap bytes by doing something like this:

code:
integer fooSwapped = ((foo&0xff)<<24)+((foo&0xff00)<<8>>8)+((foo&0xff000000)>>24);

[ December 11, 2006: Message edited by: SL ]

Title: Re: Kobold Quest port status?
Post by: Jifodus on December 11, 2006, 03:08:00 pm
Yes I'm fairly sure using those will break backwards compatability, because http://en.wikipedia.org/wiki/Endianness  says that "Internet Protocol defines a standard big-endian network byte order." So those functions will most likely output as big-endian numbers breaking backwards compatability.

I did modify the basic read and write code to load and write files as little endian therefor it should maintain compatability.

code:
// This will modify read_file and write_file
// to save and load all data in little endian notation.

const static char BIG_ADDE[2] = { 0xAD, 0xDE };

char file_compressorst::read_file(void *read_var,long read_size,bool raw)
{
//---------------SNIP1
   // {raw} is an endian dependant type if true

   unsigned short ELVIS=*(unsigned short *)BIG_ADDE;
   bool BIG_ENDIAN=(ELVIS!=0xDEAD);

   bool endianSwap=!raw; // endian swap if it is not going to read in the data raw (i.e. strings)

   if(!raw)
      {
      else if(BIG_ENDIAN)
         {
         // swap if big endian
         endianSwap = true;
         }
      }
//---------------SNIP1

   if(h==INVALID_HANDLE_VALUE)return 0;

   //NOW LOAD INTO read_var UNTIL DONE
   while(read_size>0)
      {
      //GET A BUFFER IF NECESSARY
      if(in_buffer_amount_loaded==0||
         in_buffer_position>=in_buffer_amount_loaded)
         {
         if(!load_new_in_buffer())return 0;
         }

      //BAIL IF STILL NO BUFFER LEFT
      if(in_buffer_amount_loaded==0)return 0;

      //SET THE AMOUNT TO COPY
      long copy_size=in_buffer_amount_loaded-in_buffer_position;
      if(read_size<copy_size)copy_size=read_size;

      //COPY
      //memmove(read_var,in_buffer+in_buffer_position,copy_size);
//---------------SNIP2
      char *data = (char *)read_var;
      if (endianSwap)
         {
         for (long read=0;read<copy_size;read++)
            {
            // read in reverse
            data[read_size-read-1]=in_buffer[in_buffer_position+read];
            }
         }
      else
         {
         for (long read=0;read<copy_size;read++)
            {
            data[read]=in_buffer[in_buffer_position+read];
            }
         }
//---------------SNIP2

      read_var=((char *)read_var) + copy_size;
      read_size-=copy_size;
      in_buffer_position+=copy_size;
      }
      
   return 1;
}

char file_compressorst::write_file(void *write_var,long write_size,bool raw)
{
//---------------SNIP3
   // {raw} is an endian dependant type if true
   // this does not have backwards compatability because it really isn't necessary

   unsigned short ELVIS=*(unsigned short *)BIG_ADDE;
   bool BIG_ENDIAN=(ELVIS!=0xDEAD);

   bool endianSwap=!raw; // endian swap if it is not going to read in the data raw (i.e. strings)

   if(!raw)
      {
      if(BIG_ENDIAN)
         {
         //swap if big endian
         endianSwap = true;
         }
      }
//---------------SNIP3

   if(h==INVALID_HANDLE_VALUE)return 0;

   //WRITE OUT THE VARIABLE CHUNK BY CHUNK
   while(write_size>0)
      {
      //FLUSH THE BUFFER IF NECESSARY
      if(in_buffer_amount_loaded>=in_buffersize)
         {
         if(!flush_in_buffer())return 0;
         }

      //SET THE AMOUNT TO COPY
      long copy_size=in_buffersize-in_buffer_amount_loaded;
      if(write_size<copy_size)copy_size=write_size;

      //COPY THE NEXT CHUNK INTO THE BUFFER
      //memmove(in_buffer+in_buffer_amount_loaded,write_var,copy_size);
//---------------SNIP4
      char *data = (char *)write_var;
      if (endianSwap)
         {
         for (long write=0;write<copy_size;write++)
            {
            // read in reverse
            in_buffer[in_buffer_amount_loaded+write]=data[read_size-read-1];
            }
         }
      else
         {
         for (long write=0;write<copy_size;write++)
            {
            in_buffer[in_buffer_position+write]=data[read];
            }
         }
//---------------SNIP4

      write_var=((char *)write_var) + copy_size;
      write_size-=copy_size;
      in_buffer_amount_loaded+=copy_size;
      }

   return 1;
}



The only modifications that need to be made are to the higher level readers/writers is adding true to the function call.
So for reading strings, instead of calling:
read_file(var,len*sizeof(char));
You must call:
read_file(var,len*sizeof(char),true);

And for reading an endian important data type (short, int, long) is:
read_file(&var,sizeof(long));
You must call:
read_file(&var,sizeof(long),false);

Similar for writing.

I'm unsure if floating point numbers are endian independant or not.

[ December 11, 2006: Message edited by: Jifodus ]

Title: Re: Kobold Quest port status?
Post by: popecharlotte on January 03, 2007, 07:03:00 pm
I've been working on a version of kobold quest that should handle endianness properly. There's a link here if you want to see what I have at the moment, but I'm pretty sure it won't work.

At the moment it byte-swaps the data coming in to file_compressorst::write_var (and out of read_var) on big-endian machines. However, I'm not sure if what comes out of zlib's compression needs to be fiddled with as well, or if zlib handles that itself.

I don't have access to a big-endian machine so I have no idea what will happen, so it would be handy if someone were to test it.

Title: Re: Kobold Quest port status?
Post by: Toady One on January 08, 2007, 05:53:00 pm
For the DF port, from what little was mentioned before, cross-compilation seems unlikely.  I only have my Windows XP laptop, and I'm not sending the source code to random people or anybody else.  So, it seems like I need to find a computer that will work somehow.  People want "Linux" and "Mac" ports?  What does this imply exactly about the types of operating systems I'd need to place on computers?  If I have to buy something, what is the least-cost solution?  I can't build computers reliably.  Is there a way to do "Linux" and "Mac" on one system or am I looking at at least two additional systems here?  I don't have a ton of money to throw around, though these can probably pay themselves off at least partially in the long-term if the ports work out.
Title: Re: Kobold Quest port status?
Post by: puke on January 08, 2007, 07:58:00 pm
the newest version of the apple OS basically just runs on top of BSD.  you could PROBABLY make something work for both if you ran something like free-BSD which is, you know, free.

but then you have to maintain at least two copies of everything, and do cross-platform testing on each release.  it doesnt exactly double the workload and bug reports, but it sure dosent reduce either of them.

Title: Re: Kobold Quest port status?
Post by: Toady One on January 09, 2007, 03:49:00 pm
I imagine most of the source files will be exact copies between the two machines, if two machines is the way to go.  Handling the strange bugs that I don't even understand because I don't work with these other operating systems will likely be the hard part.  Any other thoughts on the OS setup from people that wanted ports?  I need to be 100% clear on this before I can proceed.
Title: Re: Kobold Quest port status?
Post by: odd2k on January 13, 2007, 05:01:00 pm
quote:
Originally posted by Toady One:
<STRONG>I imagine most of the source files will be exact copies between the two machines, if two machines is the way to go.  Handling the strange bugs that I don't even understand because I don't work with these other operating systems will likely be the hard part.  Any other thoughts on the OS setup from people that wanted ports?  I need to be 100% clear on this before I can proceed.</STRONG>

Well, for starters most linux distributions (and all the good ones, imo) are completely free. You can run OS X, linux and windows on one single computer, you can even run all three OS'es at the same time.

Look into something like VMware, it's an application that allows you to run several virtual machines on one physical machine. The standard server version is free.

So in order to run linux, you just install vmware and some linux distro on the virtual machine. If you're not familiar with linux, go with something like Ubuntu. It's popular and user-friendly.

[ January 13, 2007: Message edited by: odd2k ]

Title: Re: Kobold Quest port status?
Post by: Toady One on January 13, 2007, 05:34:00 pm
I'm downloading VMware Server.  I'll let you know when I have questions...

[ January 13, 2007: Message edited by: Toady One ]

Ubuntu is coming in over 4 hours...  the VMware virtual machine is set up, and I guess it wants me to burn the Ubuntu ISO onto a CD for it.

[ January 13, 2007: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: Tormy on January 13, 2007, 07:54:00 pm
Hm....is it really a good idea to make Linux and Mac versions? That will slow down the development a lot I guess.
Probably 80+% of the people are using Windows anyways. Also there are lot of cheap latptops for sale, everyone can buy one and run windowns on that.   :)

[ January 13, 2007: Message edited by: Tormy ]

Title: Re: Kobold Quest port status?
Post by: Toady One on January 13, 2007, 11:43:00 pm
I'd rather have them pass on the laptop and donate directly if they can spring that much for DF, he he he.

So, I have a VMware virtual Ubuntu computer, and I played that faux-"mahjongg" matching game on it, so it seems to work fine.

I have a few questions.

  • What should I use to compile KQ on this Ubuntu system?  Did we test a linux version yet?

  • Will this approach work with the Mac?  OS X was mentioned as a VMware candidate, but I didn't see it in the list and I don't know where to obtain it if that's possible.

edit:  From what I've been reading, up to August 2006, OS X isn't really available unless you are running on Apple hardware, and they've resisted virtualization.  I do not know the current situation.

[ January 13, 2007: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: odd2k on January 14, 2007, 01:12:00 am
Apparently, it's possible to install and run OS X as a guest on vmware in windows. Read the following:
http://wiki.osx86project.org/wiki/index.php/Vmware_how_to

It's not exactly legal though. Although I wouldn't feel terribly bad about buying OS X and installing it virtually, illegal or not. It's not exactly piracy.

As for compiling on linux, you usually need a make file. Most programs are compiled by calling make, which reads the make file and in turn calls the compiler/assembler/etc.

Look into autoconf and automake, I believe that's what most people use. You'll need gcc(and gcc-g++ if you're compiling c++ code), as well as gnu make, autoconf, automake, and some other annoying dependencies that I can't remember. Just google whatever error messages you get.

Oh, and there is a working linux port for kobold quest, lastest I could find was posted by popecharlotte on page 2:
http://johnbrawn.cabspace.com/kobold-20061030.tgz

By the looks of the makefile, you just have to enter the 'kobold' directory and issue 'make kobold', and that should be it. If you're unfamiliar with using the prompt, just goto tldp.org and read a quick bash tutorial.

[ January 14, 2007: Message edited by: odd2k ]

Title: Re: Kobold Quest port status?
Post by: Toady One on January 14, 2007, 02:24:00 am
Okay, I've got the compiler running, and I've got KQ giving me reasonable errors about SDL and opengl (because they aren't installed yet).  Work in progress...
Title: Re: Kobold Quest port status?
Post by: Toady One on January 14, 2007, 02:46:00 am
Okay, KQ compiled and ran under Ubuntu in the virtual machine.  Seemed fine.  Very laggy, but that's the virtual computer -- Mahjongg was laggy.

edit:  I had found that same article when I was looking for OS X information, and I'm not going that way...  I guess I'll have to figure out something else for Mac.

[ January 14, 2007: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: X on January 14, 2007, 06:16:00 am
Hope you didn't waste too much time farting around with that stuff Toad...

Now, question, would be useful to have KQ on a public source control system? I don't really see how platform-experts can be expected to track changes when everyone's working off their own master. Hosting it on Bay12 would be yet more pointless distractiveness for the Toad, I don't like sourceforge much... anyone used this yet? Or other suggestions?

X

Title: Re: Kobold Quest port status?
Post by: Toady One on January 15, 2007, 01:22:00 am
Bits of the linux KQ are from Wine (LGPL)?  The other changes don't seem to have an accompanying copyright or license either (the license I distributed is unaltered, but it only has my name in it, so it's unclear what the status of the additions is, and the stuff from Wine can't be put under BSD, since it doesn't have a modification clause).  That's fine for this thread -- I'm just noting that I can't use this as it is for DF.
Title: Re: Kobold Quest port status?
Post by: axus on January 15, 2007, 09:14:00 am
I don't run Linux or Mac but I think being portable is a good idea.  It forces you to avoid Windows specific functions, so when Microsoft decides to deprecate something, it still works on the newer versions.

Look up the Bloodshed C++ IDE, it uses MinGW which uses GNU c++.  GNU c++ is available on a lot of platforms.

Title: Re: Kobold Quest port status?
Post by: chiaruscuro on May 10, 2007, 11:35:00 am
Hi! New guy here...

Basically I followed this old thread it its entirety this morning and was disapointed to find that the link to the most recent mac os x port/build was dead  :(

I would really love to try this game out, can anyone put the link back up?  I will be trying the irc channel otherwise...

Title: Re: Kobold Quest port status?
Post by: Toady One on May 10, 2007, 07:46:00 pm
I think the Mac KQ is based on the Linux KQ, which has bits under LGPL, so I didn't host it on the main page.  Somebody else might have a copy.
Title: Re: Kobold Quest port status?
Post by: chiaruscuro on May 11, 2007, 10:26:00 am
Ok, thank you.  If you know anyone in particular you could always let them know (by sending me a prvate message via the forum), but I'll try the irc chan   :cool:
Title: Re: Kobold Quest port status?
Post by: Jaqie Fox on May 17, 2007, 05:49:00 pm
re how to test and run multiple operating ystems on a single PC: the best way is with the free version of VMware. it emulates an entire PC in the 'host' OS, even has an actual BIOS file licened from (IIRC) phoenixBIOS.  Check out vmware, I use it pretty constantly here. the only thign to be aware of is the increased RAM demands for running multiple OSes concurrently. 1GB is prettymuch minimal.... but compared to the alternative of having multiple PCs more RAM is dirt cheap.
Title: Re: Kobold Quest port status?
Post by: Toady One on May 17, 2007, 06:03:00 pm
Yeah, that's actually how I ran the aborted Linux port -- on a VMWare Ubuntu.  There was a little lag, sure, but it worked fine.  I gather VMWare wouldn't help with a Mac port unless I broke some kind of law though.
Title: Re: Kobold Quest port status?
Post by: Peristarkawan on May 17, 2007, 06:08:00 pm
The LGPL issue is unfortunate. I haven't looked at the code yet, but it sounds like a revived porting effort would have to start over from scratch.

I'm not a licensing expert, but would it be feasible to turn the KQ code into an open-source library derivative of Wine and then just have DF link it? That should allow you to release DF on your own terms using section 6a or 6b of the LGPL.

If the issue is the "must allow modification and reverse engineering" clause of section 6, then I think that would prohibit you from using any LGPL library at all, including SDL.

Title: Re: Kobold Quest port status?
Post by: Toady One on May 17, 2007, 06:14:00 pm
It was my impression that you could use an LGPL DLL and not release the source code of your own project (since you don't become a derivative work at that point, and the modifications can occur at the DLL level), but I don't know much about it.

As for turning KQ into a library, I doubt it would have to go that far, but whatever works.  My requirements are that it has to be easy for me to understand how to lay DF on top of it, and I have to be able to release it without releasing the source code of DF.

Title: Re: Kobold Quest port status?
Post by: Peristarkawan on May 17, 2007, 06:35:00 pm
quote:
Originally posted by Toady One:
<STRONG>It was my impression that you could use an LGPL DLL and not release the source code of your own project (since you don't become a derivative work at that point, and the modifications can occur at the DLL level), but I don't know much about it.</STRONG>

Right, that's what section 6 covers. It does seem to include the annoying requirement that the DF license must allow users to modify and reverse-engineer the DF executable. I brought it up because the current DF license agreement doesn't permit modification of the executable.

It may be somewhat ignorable. The SDL overview of the license doesn't even mention it.

Title: Re: Kobold Quest port status?
Post by: Toady One on May 17, 2007, 06:44:00 pm
From what I've managed to google, people seem confused.  Section 6 seems dangerous to me.  Perhaps a non-SDL approach will be required, which I guess amounts to what, handling input in some way, and getting the OpenGL initialized in Linux?  Perhaps that's a lot of work.

edit:  To be specific, it seems like using the DLL would be fine, until such a point that a new version of the DLL is no longer compatible with the binary, at which point the binary must be opened up to allow compatibility.  This would put me at the mercy of whoever is maintaining the LGPL project.

[ May 17, 2007: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: Peristarkawan on May 17, 2007, 08:18:00 pm
I think that setting up the OpenGL directly would be fairly platform-dependent. Right now I'm looking at possibly using ClanLib as an alternative to SDL that uses a BSD-style license. It looks promising, although I don't really know how it compares in terms of performance.
Title: Re: Kobold Quest port status?
Post by: Toady One on May 17, 2007, 11:04:00 pm
I guess as long as it's not awful, it's fine.  The performance issues with DF are mostly independent of any graphics etc, so a bit of overhead wouldn't be a major problem.  I think.
Title: Re: Kobold Quest port status?
Post by: X on May 17, 2007, 11:59:00 pm
More to the point than any LGPL issues is that you don't even frekin' want WINE code in a KQ port - it's not needed.
Only the enabler code uses windows.h for anything relevant, and of that:
 enablerst::loop
 enablerst::create_window_GL
 enablerst::destroy_window_GL
 enablerst::register_window_class
 WindowProc
 WinMain
Wants rewriting from win32 to platform equivalents, and:
 enablerst::load_bitmap_header
 enablerst::load_bitmap_file
 enablerst::load_bitmap_file_with_alpha
 enablerst::save_texture_data_to_bmp
Want junking and replaced with stuff that calls libpng.

That's only ~750 lines total, and is not a technically hard task for anyone who knows a little about win32 and enough about their target platform. Add in finding other stray calls to stuff like MessageBox and re-routing through the enabler, the task is still of hours order, not days.
Anyway, it served its purpose of shutting up the I'd-port-this-if-you-gave-me-the-source bullshitters. Whining is easier than WINEing, but WINEing is easier than porting, and they're all about path of least resistance.

X

Title: Re: Kobold Quest port status?
Post by: nornagon on June 04, 2007, 01:27:00 am
It turns out the LGPL is mostly fine, except for a reverse engineering clause in section 6. I guess I'll have a stab at porting stuff with glut. The windows-specific stuff I can see is mostly in enabler.cpp and a bit in files.cpp and definitions.cpp, yes? Are there any caveats I should be warned about?
Title: Re: Kobold Quest port status?
Post by: Toady One on June 04, 2007, 02:34:00 am
There are a few more MessageBox() in game.cpp, one in game.h.  GetTickCount() is used in game.cpp, interface.cpp, random.cpp.  Not sure what the other problems are beyond what X said.

[ June 04, 2007: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: nornagon on June 05, 2007, 10:08:00 am
Okay, finished. The game compiles and runs under linux, near-perfectly as far as I can tell (having never played the game under windows). The build process is a little involved, so I'm reluctant to post a tarball just yet, but if anyone wants to have a go, join us on worldirc.org #bay12games or private message me here. I'll try to have a nicely buildable tarball sometime soon.

Testing is still far from extensive, I think a few keybinding things may be broken (in particular, ctrl and alt, though shift seems to work). GLFW has some small quirks which I'm not entirely sure of, so they'll take a little prodding.

Title: Re: Kobold Quest port status?
Post by: Peristarkawan on June 05, 2007, 10:52:00 am
I was going to do a ClanLib port since it uses BSD licensing, but I never found the time to actually work on it. Glad to hear that somebody's picked this up.
Title: Re: Kobold Quest port status?
Post by: nornagon on June 05, 2007, 11:15:00 am
GLFW is pretty nice for this purpose. It's sort of a GLUT replacement, with a few bells and whistles. SDL is possibly better still, but there lie licensing issues.
Title: Re: Kobold Quest port status?
Post by: Peristarkawan on June 05, 2007, 07:35:00 pm
Oh, I wasn't aware of that one.  Looks nice!  The other reason I was looking at ClanLib was that it includes modules for sound and for performing serialization in a platform-independent manner, but obviously there's no reason those things need to be handled by the same toolkit.
Title: Re: Kobold Quest port status?
Post by: Peristarkawan on June 05, 2007, 07:36:00 pm
Especially since fmod already works fine on both Linux and Mac.
Title: Re: Kobold Quest port status?
Post by: nornagon on June 06, 2007, 06:34:00 am
FMOD is a little dodgy here, it skips and stutters or doesn't play anything at all unless I tell it specifically to use the ESD driver. I haven't really looked too hard at clanlib, ISTR having some weird annoyance with it a while ago. I guess I should check it out again.
Title: Re: Kobold Quest port status?
Post by: ricree on August 14, 2007, 12:16:00 am
What ever happened with this?  Everything seemed to be going fairly well from what I could see, but the thread seemed to spontaneously die.  Did someone dig too deep here?
Title: Re: Kobold Quest port status?
Post by: demonbane on August 16, 2007, 02:14:00 am
Just to try to contribute what I can to this thread (though it does seem to be a bit on the dead side at the moment), my C/C++ skills are pretty rusty at this point, but I'm very well brushed up on licensing issues.

You can safely use LGPL code in a proprietary project, as long as you leave the LGPL portion of the code under the LGPL. In other words, either make no changes to it and distribute it as is (should be easy enough with SDL), or optionally make changes to it and redistribute the source for the changed LGPL code only.

This exact scenario is exactly why the LGPL was developed in the first place. If it was regular GPL you'd have to GPL the entire code base, but with LGPL you only have to MAINTAIN the license, not PROPAGATE it through the rest of your code. Hope that helps in case anyone is still concerned about the licensing issues around this.

Title: Re: Kobold Quest port status?
Post by: capehill on August 18, 2007, 06:28:00 am
Yes, using SDL by linking it dynamically (.dll, .so) doesn't enforce LGPL on your project. Indeed many commercial Linux games use SDL, for example.

If you linked statically SDL to your project, your project would become LGPL too.

Just use it (dynamically), many did before  :)

Title: Re: Kobold Quest port status?
Post by: failure on August 27, 2007, 04:15:00 am
I just registered to say that I really enjoy Dwarf Fortress, can't wait for the new version, and most of all would love to see a linux release!
Title: Re: Kobold Quest port status?
Post by: Slartibartfast on August 27, 2007, 02:30:00 pm
Is the problematic section 6 in the LGPL you are refering to is
 
quote:
6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.



?
(this is from LGPL version 3.0)

If so, I fail to see how that is a problem. since:
 

quote:
The Simple DirectMedia Layer library is currently available under the GNU Lesser General Public License (LGPL)  version 2.1 or newer.

means you can choose whichever version of the LGPL license that you'd like to follow (as long as it is of version 2.1 or higher)

Finally, according to the SDL website (http://www.libsdl.org/license-lgpl.php)
 

quote:
To comply with this license, you must give prominent notice that you use the Simple DirectMedia Layer library, and that it is included under the terms of the LGPL license. You must provide a copy of the LGPL license.
You must also do one of the following:

  1. Link with the library as a shared object (e.g. SDL.dll or libSDL.so)
  2. Provide the object or source code to your application along with any libraries and custom tools not available with a standard platform development kit. You may also simply provide a written offer, valid for three years, to provide these materials upon request to anyone with a legal copy of your application.

If you include the SDL library in binary form, you should also make available the source code to the version you provide, including any customizations you have made. If you link to a standard version of the library, simply referring to the SDL website is sufficient.


Also, I kind of stumbled upon this cool tutorial for SDL: http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/index
Just in case someone is interested in it. (Or in case Toady still doesn't know SDL)

EDIT: Ahh, could the problem be if you need (for example) SDL1.2 and that will no longer be available on the SDL website at some distant point in the future? (which will mean using a newer version which could be under any license)
I highly doubt the chances of that happening. And even if it will, the dll will still most probably be available (if not on the SDL website, then somewhere else), so there would be no problems.

[ August 27, 2007: Message edited by: Slartibartfast ]

Title: Re: Kobold Quest port status?
Post by: Toady One on August 27, 2007, 02:53:00 pm
Nah, that's not the same Section 6 I was reading.  My comments were before Version 3, 29 June 2007.  In Version 3, it's Section 4.  The reverse engineering clause wasn't clear to me.  That kind of reverse engineering might be covered under fair use already, but I don't know.
Title: Re: Kobold Quest port status?
Post by: demonbane on August 27, 2007, 04:39:00 pm
The reverse engineering bit just refers to the license terms that you impose on the non-LGPL portion of the code you're distributing. So, in the case of using the SDL, whatever license accompanies YOUR code cannot prevent people from reverse engineering your code for the purposes of debugging the SDL if they choose to modify their version of the SDL. In theory this means that if someone is reverse engineering your code for the purposes of overcoming a "feature" of your code that doesn't rely on the LGPL covered library (copy protection code, for example), you could still take them to court over it.

In practice what it means is that if you use SDL 1.2, and I decide I want to use my own version of SDL 1.2 with some of my own changes in it, and I need to reverse engineer portions of your code to get my version of the SDL to work, you won't take me to court. But if I reverse engineer your code and then publish specs online about how to circumvent some non-SDL feature as a result of that, then I still could be running afoul of your terms (assuming, of course, that your terms don't allow me to do that). That clause was put there specifically to combat Tivoization. So if you want to use LGPL code, you're perfectly welcome to do so, but you can't take people to court because the way they use that same code isn't exactly what you had in mind.

Title: Re: Kobold Quest port status?
Post by: Slartibartfast on August 28, 2007, 12:16:00 am
Use Allegro instead then   :) (Or actually, AllegroGL, since you want drawing to be hardware accelerated)

(Allegro is under a "giftware" license, which basically means "do what you want with it, just don't blame us if your computer catches on fire")

[ August 28, 2007: Message edited by: Slartibartfast ]

Title: Re: Kobold Quest port status?
Post by: Lavastine on October 03, 2007, 01:49:00 am
To be honest the market share for mac/linux is so small that I can't imagine it would be worth it to give a piece of all sales to these guys for the small amount of extra sales he would get from it. Unless of course they only want part of the ported sales.
Title: Re: Kobold Quest port status?
Post by: Shades on October 03, 2007, 06:29:00 am
Considering it runs under wine (and you can get wine for the mac on osx) it would seem a little strange to pay someone to port it.
Title: Re: Kobold Quest port status?
Post by: Baughn on November 03, 2007, 02:45:00 pm
After reading the FAQ entry on linux/mac, I'm going to take a shot at porting Kobold Quest to wholly platform-independent libraries - SDL, mostly.

Is there anything I should know? Like, is anyone else already doing this (so we could collaborate), or would porting it no longer help much?

I'd also be willing to sign an NDA to do the same work on Dwarf Fortress itself. Yes, for free, if toady is listening - I'd consider this my payment for the game.  ;)

Title: Re: Kobold Quest port status?
Post by: Toady One on November 03, 2007, 06:43:00 pm
I think nornagon did something and X has it put together somewhere for KQ, though I'm not sure at this point exactly how far that got.  I was busy with this latest release and never got a chance to look at it.  I might again after I get most of the bugs sorted out.
Title: Re: Kobold Quest port status?
Post by: peterb on November 03, 2007, 07:57:00 pm
I can confirm that the Mac port of Kobold Quest was working.  It wasn't that painful to get ported; I just think Toady was very busy at the time.

I would pay cash on the barrel head (and, as a somewhat well known game blogger, encourage other Mac users to do so) for an OS X native port.  There may be fewer of us, but we are loyal as hell.  And our marketshare is growing :-)

-peterb http://tleaves.com

Title: Re: Kobold Quest port status?
Post by: Baughn on November 03, 2007, 09:42:00 pm
quote:
Originally posted by Toady One:
<STRONG>I think nornagon did something and X has it put together somewhere for KQ, though I'm not sure at this point exactly how far that got.  I was busy with this latest release and never got a chance to look at it.  I might again after I get most of the bugs sorted out.</STRONG>

Then I won't do anything further.
The port does appear straightforward, from what I've seen, but if you don't have time yourself (too busy making it better?) then I'd urge you to consider asking someone else. It wouldn't be much work to write a contract that lets you keep all rights for my work - god knows I've seen enough of them. :P

Alternately.. lots of people have suggested that they'd pay for this port. Perhaps it's time to collect those pledges on a wiki page, so they can be summed?

Title: Re: Kobold Quest port status?
Post by: Muriac on November 11, 2007, 11:36:00 pm
quote:
Originally posted by peterb:
<STRONG>I would pay cash on the barrel head (and, as a somewhat well known game blogger, encourage other Mac users to do so) for an OS X native port.  There may be fewer of us, but we are loyal as hell.  And our marketshare is growing :-)

-peterb http://tleaves.com</STRONG>


I just joined this forum to say I would pay for a Mac port. Dwarf Fortress is amazing, but I can't stand booting into Windows. No offence to Windows users: I'm sure you'd be just as annoyed if you had to boot into Mac OS to play.

[ November 11, 2007: Message edited by: Muriac ]

Title: Re: Kobold Quest port status?
Post by: RustedAxe on November 12, 2007, 12:22:00 am
quote:
Originally posted by Muriac:
<STRONG>

I just joined this forum to say I would pay for a Mac port. Dwarf Fortress is amazing, but I can't stand booting into Windows. No offence to Windows users: I'm sure you'd be just as annoyed if you had to boot into Mac OS to play.

[ November 11, 2007: Message edited by: Muriac ]</STRONG>


*shudder*  I considered myself pretty literate with computers, until I tried using a Mac for the first time since 10 or so years ago.  So confusing compared to the familiar windows.

Title: Re: Kobold Quest port status?
Post by: Oarfish on November 12, 2007, 07:34:00 pm
Another request for OSX support here. It's a shame parallels can't handle opengl well enough to get a decent framerate.
Title: Re: Kobold Quest port status?
Post by: mattmoss on November 13, 2007, 04:16:00 pm
Hey all...

I don't know what the status of other folks on this is... I downloaded and started working on this before I saw some of the latest replies.

I have a stubbed-out version compiling on the Mac. For non-coders, stubbed out means lots of empty functions that now need to be filled in to make things actually work. The biggest thing there is replacing the Windows message pump and window creation with a similar Mac setup.  Once that's done, the rest should fall into place quickly.

This would not rely on anything else... no SDL, etc. I've completely disabled fmod at the moment, since at least in DF it's just background music... iTunes would be suitable for that.  =)  But I've seen the fmod website, which seems to be available for all platforms, so could be done eventually.

Gotta keep pushing.

Title: Re: Kobold Quest port status?
Post by: mattmoss on November 25, 2007, 05:30:00 pm
My current status...  Progress a little slow; I've been distracted by actual playing of Dwarf Fortress.  =)

Right now, I have a base OpenGL window up and running... and accepting render from the game.  See here, click for larger version:
 (http://lh3.google.com/matthew.moss/R0n11qz_fKI/AAAAAAAAALQ/gdJc12Tz4bE/s288/kqmain.png)  


Currently I'm working on keyboard input... That's a bit of a pain, but I think I'm close. I need to actually boot into Windows and play KQ to see the expected behavior, so I know where I might be failing. Right now it's just windowed, no fullscreen, but that's a lesser priority.

[ November 25, 2007: Message edited by: mattmoss ]

Title: Re: Kobold Quest port status?
Post by: mattmoss on November 25, 2007, 11:49:00 pm
Whoo! Look at what is playable...

 :D

[ November 25, 2007: Message edited by: mattmoss ]

Title: Re: Kobold Quest port status?
Post by: Jifodus on November 26, 2007, 12:18:00 am
Congratulations for making it so far. Now make it robust and perfect... not that I have a Mac(or tel) to test it on. It's just exciting to see the next step to cross platform availability.

Just to make sure I've been reading your posts correctly, this will be a native OSX application?

Title: Re: Kobold Quest port status?
Post by: Karlito on November 26, 2007, 12:49:00 am
3 cheers for mattmoss.  I can't wait to get a DF port to mac!
Title: Re: Kobold Quest port status?
Post by: mattmoss on November 26, 2007, 08:03:00 am
quote:
Originally posted by Jifodus:
<STRONG>Congratulations for making it so far. Now make it robust and perfect... not that I have a Mac(or tel) to test it on. It's just exciting to see the next step to cross platform availability.

Just to make sure I've been reading your posts correctly, this will be a native OSX application?</STRONG>


Yes, this is a native OSX app that doesn't rely on things like SDL or similar, something I believe Toady wanted to avoid. Once this is done, I will give full ownership of the code to Toady in the hopes we can also have a native DF.

Title: Re: Kobold Quest port status?
Post by: mattmoss on November 26, 2007, 08:31:00 am
quote:
Originally posted by Toady One:
<STRONG>The only Mac I potentially had access to is big-endian...  I'll have to figure out how I'm going to compile things.</STRONG>

I had a few thoughts on this...

1. When I have the native Mac code working for KQ, you can send me the source to DF which I can get up and running and build a Universal Mac app. I know this doesn't particularly appeal to you as I've seen said a number of times. All I'll say towards this is that I am a professional game developer, used to NDAs, can keep it secure, and I can stick solely to making the port work and leaving everything alone. It would also be easier to get a native OSX port working with someone familiar with and owning both Intel and PPC macs. Additionally, it would leave you free to fix bugs and add features rather than worrying about a port.

2. If that's still not an option, I may be able to set up my tower Mac as a server and provide you a login account with ssh/sftp and possibly vnc access. That should keep your code secure and allow you to build the project mostly without my involvement. That has some disadvantages... namely, you couldn't test it that well... VNC would probably work, but it ain't going to be fast. Also, being the admin of the machine, I would still technically have access to your code; even if I promised to not look, you might not consider this much better than #1.

3. The cheapest Mac is US$600, the Mac mini. You hook up your own display/keyboard/mouse and you've got a mac. That comes with the OS, and all the dev tools are free. It's Intel-based, so you wouldn't easily be able to test the endian issues that would come up on PPC machines, but if all your file-reading code happens in one place, that shouldn't be much of an issue. It ain't the fastest, most powerful machine, but this ain't Unreal Tournament, so that shouldn't be a problem.

Title: Re: Kobold Quest port status?
Post by: Toady One on November 27, 2007, 04:03:00 am
Mac:  Hi, yeah, paranoid so 1/2's not gonna work.  But I was thinking of getting back into this porto stuff now that things are settling down again.  600 dollars should be negligible -- I'm sure all the friendly Mac people will donate that much over the life of the mini, assuming it all works out.  I'd have to have somebody help me dig up tools and figure out...  everything, but whatever, should be fine.

Linux:  I think I've got a computer I can stick Linux on now if the virtual computer idea doesn't work.  The Lord Packman still has nornagon's code, I think.  I'm not sure if there was a license included with it though.  Hopefully there was.  I'll ask LP about that tonight and see if I can get that ball rolling again.

Title: Re: Kobold Quest port status?
Post by: mattmoss on November 27, 2007, 02:22:00 pm
quote:
Originally posted by Toady One:
<STRONG>Mac:  Hi, yeah, paranoid so 1/2's not gonna work.  But I was thinking of getting back into this porto stuff now that things are settling down again.  600 dollars should be negligible -- I'm sure all the friendly Mac people will donate that much over the life of the mini, assuming it all works out.  I'd have to have somebody help me dig up tools and figure out...  everything, but whatever, should be fine.</STRONG>

Understandable paranoia...  It's cool.

Towards a Mac mini, or heating bills, or whatever, I just sent a donation via PayPal. Enjoy.   :)

As far as further Mac porting... I will continue on Kobold Quest and make it as complete and clean as I can. When it's done, we can chat about how it works, how to integrate and build it, whatever... I'm happy to help with a Mac port however you need.

Title: Re: Kobold Quest port status?
Post by: mattmoss on November 27, 2007, 09:42:00 pm
Status: full screen working, cursor offset fixed.
Title: Re: Kobold Quest port status?
Post by: Toady One on November 28, 2007, 03:53:00 am
My brother and I drove around a while, but I guess they don't sell Apple computers around here and the nearest Apple store is in Seattle, so I got a mini online instead.  It will arrive whenever.  I suppose low availability is part of the Apple marketing strategy, unless they've been driven out of the local stores by force or something.
Title: Re: Kobold Quest port status?
Post by: mattmoss on November 29, 2007, 08:55:00 am
quote:
Originally posted by Toady One:
<STRONG>My brother and I drove around a while, but I guess they don't sell Apple computers around here and the nearest Apple store is in Seattle, so I got a mini online instead.  It will arrive whenever.  I suppose low availability is part of the Apple marketing strategy, unless they've been driven out of the local stores by force or something.</STRONG>

Apple has tried a few times in years back to have a retail presence without luck, until they started opening their current chain of Apple stores, and they do that slowly, choosing locations with care. There are occasional 3rd-party retailers that will sell Apple products... I know of two in my area... but that is pretty rare. Apple resellers generally have been online-only.

Title: Re: Kobold Quest port status?
Post by: Helmaroc on November 30, 2007, 07:04:00 pm
Sorry for being  a newb, but what are differences in DF and Kobold's Quest?
Title: Re: Kobold Quest port status?
Post by: mattmoss on December 01, 2007, 12:15:00 am
quote:
Originally posted by Helmaroc:
<STRONG>Sorry for being  a newb, but what are differences in DF and Kobold's Quest?</STRONG>

Well, they're quite different games. DF is much, much deeper than KQ. But, according to Toady, DF uses basically the same engine as KQ. So in porting KQ to another platform makes it easier and more likely that DF could be ported.

Title: Re: Kobold Quest port status?
Post by: Toady One on December 09, 2007, 01:22:00 am
I now have a Mac Mini.  It came with a few cables.  Now I need to dig up a monitor that will work in the mini and in the linux computer.
Title: Re: Kobold Quest port status?
Post by: mattmoss on December 09, 2007, 09:31:00 pm
quote:
Originally posted by Toady One:
<STRONG>I now have a Mac Mini.  It came with a few cables.  Now I need to dig up a monitor that will work in the mini and in the linux computer.</STRONG>

Woo! Okay... I have some time off this week, so I'll get back to some more of the KQ porting and cleanup, and we can chat later about how you want to do this.

Additionally, the dev tools (XCode) are most likely not installed by default, but you should be able to pop in one of the discs that came with it and install XCode from there.

Title: Re: Kobold Quest port status?
Post by: Toady One on December 11, 2007, 02:10:00 pm
I am posting this from the Mac Mini.  It came with a couple OS X install discs and a OS X Leopard CPU Drop-in DVD, whatever that is.  I wonder if I have XCode.

edit:  I guess it's supposed to come on one of these DVDs.  I'll have to try to find it out without destroying something.

[ December 11, 2007: Message edited by: Toady One ]

edit:  Okay, I've installed XCode.  Everything seems to be working correctly.

[ December 11, 2007: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: opx on December 12, 2007, 04:30:00 pm
I'm very much looking forward to this. Thanks for all the effort... much appreciated! By the way, is it just me or is the XCode installation somewhat fiddly (using Tiger, at least)? I hesitate to install it because i don't want to ruin my perfectly stable system.
Title: Re: Kobold Quest port status?
Post by: Toady One on December 12, 2007, 04:58:00 pm
I'm not sure if fiddly means something special on a Mac.  I had to open up the XCode folder on my OS DVD, click on an open box icon, and it did most of the rest on its own.  I maybe had to answer a question or two.  It didn't seem very dangerous, but I'm the last person to ask I guess.  Maybe somebody else knows.
Title: Re: Kobold Quest port status?
Post by: mattmoss on December 13, 2007, 02:58:00 pm
The Apple installation packages are basically as you said, Toady. Double-click, answer couple of questions (which are usually correct by default) and it does the rest.

Most 3rd party application installation is basically "drag application into Applications folder". Whee.

Toady, sorry I haven't replied yet with anything on my KQ work. I will shortly.... just typing up my turn for a succession game.   :D  It will be cool if I can get it running in OSX, since DF is about the only thing I reboot into XP for.

Title: Re: Kobold Quest port status?
Post by: ErrorJustin on December 15, 2007, 05:36:00 am
As a mac user I am eagerly anticipating developments here!
Title: Re: Kobold Quest port status?
Post by: peterb on December 20, 2007, 05:26:00 pm
Ditto what Matt said about Dwarf Fortress being pretty much the only thing I reboot into XP for.  I'm super excited at the thought of a Mac port!
Title: Re: Kobold Quest port status?
Post by: Toady One on December 28, 2007, 05:52:00 pm
Okay, I've put up a preliminary version of mattmoss's port here.  There's a known issues text file with the application zip.  I don't really know what's going on with the glDeleteTextures() call.  Let me know if there are any other problems and we'll try to deal with them.  Once this is sorted out, we can move on to DF.

[ December 28, 2007: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: eli on December 28, 2007, 11:58:00 pm
It required a pretty simple fix to get it to run on 10.3.9, it would be harder to get it going on 10.2 and probably isn't worth the effort. The current binary seems to work fine on my 10.4 intel machine, after the 10.3 fix it seems to be running on my 10.3 PPC machine (I get key code messages) but I don't see any graphics. I would guess there's an endian bug in the graphics display, I'll take a quick look at it and see if anything is obvious.

10.3 fix below (file is enabler_osx.cpp, line 418)
---------------

code:

if (HIPointConvert != NULL)
{
   HIPointConvert(&hipt, kHICoordSpaceScreenPixel, NULL,
      kHICoordSpaceView, dstView);
}
else
{
   hipt.x -= cr.left;
   hipt.y -= cr.top;
   HIViewConvertPoint(&hipt, NULL, dstView);
}

pt.h = (short) hipt.x;
pt.v = (short) hipt.y;



edit: code tag

[ December 29, 2007: Message edited by: eli ]

Title: Re: Kobold Quest port status?
Post by: bluetrust on December 29, 2007, 12:06:00 am
I just wanted to say, Toady One, that the OS X community CARES about Dwarf Fortress.  At least I care.  If you put up a playable OS X version of Dwarf Fortress, I'll donate $100.
Title: Re: Kobold Quest port status?
Post by: eli on December 29, 2007, 02:55:00 am
I played with it a bit more and adding the endian conversions after the fread() calls fixed the graphics on PowerPC.

The text input is also a bit wacko, I partly fixed it by taking out the cast to char on the Unicode value, but the virtual keycode lookup seems problematic. You can probably get away with it, but the table looks wrong, apparently OS X uses the keycodes from the good old Apple Extended Keyboard 2 as described here keycodes from OS X.

All of my changes were limited to enabler_osx.cpp, let me know if you'd like the new file.

Title: Re: Kobold Quest port status?
Post by: Toady One on December 29, 2007, 02:52:00 pm
I have no experience with the various different kitty cats and how to support them, so would I need to do two separate releases for each one?  Or is this something that would compile on mine once (I'm on 10.4.11) and work back to 10.3 up to 10.4?  I'm interested in whatever fixes people have, provided they are released under a suitable license (BSD, etc).  I'm at toadyone@bay12games.com.
Title: Re: Kobold Quest port status?
Post by: mattmoss on December 29, 2007, 03:23:00 pm
quote:
Originally posted by Toady One:
<STRONG>Okay, I've put up a preliminary version of mattmoss's port here.  There's a known issues text file with the application zip.  I don't really know what's going on with the glDeleteTextures() call.  Let me know if there are any other problems and we'll try to deal with them.  Once this is sorted out, we can move on to DF.

[ December 28, 2007: Message edited by: Toady One ]</STRONG>


I sent you an email about a fix for the glDeleteTextures issue.

Title: Re: Kobold Quest port status?
Post by: mattmoss on December 29, 2007, 03:32:00 pm
quote:
Originally posted by eli:
<STRONG>I played with it a bit more and adding the endian conversions after the fread() calls fixed the graphics on PowerPC.

The text input is also a bit wacko, I partly fixed it by taking out the cast to char on the Unicode value, but the virtual keycode lookup seems problematic. You can probably get away with it, but the table looks wrong, apparently OS X uses the keycodes from the good old Apple Extended Keyboard 2 as described here keycodes from OS X.

All of my changes were limited to enabler_osx.cpp, let me know if you'd like the new file.</STRONG>


Yeah, the text input is a bit wacko... It's been a while since I've done regular Mac coding, and a lot has changed. I was trying to just get from the mac key codes to windows, to keep as much of the port work in enabler_osx rather than scattered elsewhere through the code. (I certainly don't write cross-platform code this way, but in this instance, it seemed better to try and isolate the mac stuff that start telling Toady how to rearrange everything.

But hey, another Mac-head lookin' at my code is just fine.     :D

EDIT: Oh, and on the endianness issue...  Doing the porting work on an Intel mac meant I could leave that to last...  since I try not to mix sources of potential problems. Once that was finished, I had planned to go back and fix then endian stuff for PPC. I haven't yet looked to see how Toady was reading
things in... as text, structured, or as binary blobs dumped into structures. Each requires different endian-ness handling, and it's not difficult stuff, just needs to be looked at.

[ December 29, 2007: Message edited by: mattmoss ]

Title: Re: Kobold Quest port status?
Post by: mattmoss on December 29, 2007, 03:39:00 pm
quote:
Originally posted by Toady One:
<STRONG>Okay, I've put up a preliminary version of mattmoss's port here.  There's a known issues text file with the application zip.  I don't really know what's going on with the glDeleteTextures() call.  Let me know if there are any other problems and we'll try to deal with them.  Once this is sorted out, we can move on to DF.

[ December 28, 2007: Message edited by: Toady One ]</STRONG>


I can download and unzip the archive for the game, but the source/project zip file isn't working for me...

Title: Re: Kobold Quest port status?
Post by: Toady One on December 29, 2007, 04:43:00 pm
Is the source zip working now?  I think my FTP might have crapped out while it was sending before.
Title: Re: Kobold Quest port status?
Post by: eli on December 29, 2007, 04:51:00 pm
quote:
Originally posted by mattmoss:
<STRONG>

Yeah, the text input is a bit wacko...
...
but in this instance, it seemed better to try and isolate the mac stuff that start telling Toady how to rearrange everything.

But hey, another Mac-head lookin' at my code is just fine.       :D

EDIT: Oh, and on the endianness issue...  Doing the porting work on an Intel mac meant I could leave that to last...  
...
[ December 29, 2007: Message edited by: mattmoss ]</STRONG>


I agree the endian thing isn't a priority, I just needed to put it in to verify that my 10.3 fix worked.

I'm 90% sure the keycode stuff you did actually will work when the table is adjusted, even if it is wacko. I agree that it's much better to have code that's easy for Toady One to integrate than code that's 100% kosher OS X approved but ends requiring extra hoops.

I emailed Toady One, but for anyone else following along it will be very easy for him to build a single Universal application that supports 10.3 and later on PowerPC and intel (at least for Kobold Quest).

Also, big thanks to mattmoss for doing all the work. Nobody should think that me calling something wacko is an actual criticism of his code - more of a joke.    ;)

edit:typo

[ December 29, 2007: Message edited by: eli ]

Title: Re: Kobold Quest port status?
Post by: mattmoss on December 29, 2007, 08:05:00 pm
quote:
Originally posted by Toady One:
<STRONG>Is the source zip working now?  I think my FTP might have crapped out while it was sending before.</STRONG>

Yes, working now, thanks.

Title: Re: Kobold Quest port status?
Post by: mattmoss on December 31, 2007, 07:40:00 pm
quote:
Originally posted by eli:
<STRONG>

I'm 90% sure the keycode stuff you did actually will work when the table is adjusted, even if it is wacko. I agree that it's much better to have code that's easy for Toady One to integrate than code that's 100% kosher OS X approved but ends requiring extra hoops.
</STRONG>


I wonder if another solution is needed....  When you say "when the table is adjusted", do you mean that some of your keys are not mapping to what the game expects? E.g., the arrow keys aren't doing what they should, or something like that?

Because, aside from some missing ones and the general wonkiness of the code, the table seems fine on my computer.

I wonder if the keycodes I'm fetching are at too low a level to be consistent across different keyboard layouts/locales/manufactures? I should probably look at that stuff again... find a way that will be more consistent.

Title: Re: Kobold Quest port status?
Post by: eli on December 31, 2007, 09:24:00 pm
quote:
Originally posted by mattmoss:
<STRONG>
I wonder if another solution is needed....  When you say "when the table is adjusted", do you mean that some of your keys are not mapping to what the game expects? E.g., the arrow keys aren't doing what they should, or something like that?
</STRONG>

Apologies, I was assuming the key table from that image was in hex, but it is actually decimal, and the keycodes you were getting are right. Sorry about that, I had just glanced at a few and they didn't seem to match. The other odd keycodes I was getting were the result of an endian issue, but removing the cast to char fixed those.

My impression is that the keycodes in OS X are all either identical to or auto-magically morphed into the old Apple Extended ones, in which case you're good to go on the translation.

Title: Re: Kobold Quest port status?
Post by: Toady One on January 01, 2008, 12:33:00 am
I got DF running today, minus various peripherals (movies/FPS counter...  highlighting on the designation menu for who knows what reason...).  I'm not sure when I'll put it up, since I want to fix the pieces that don't work and streamline the whole PC -> Mac process that would come with each release, but it looks like it'll definitely work.  I don't know how powerful my Mini is, so it's hard to judge what the speeds going to be like.  I'm getting vaguely 50 on a 6x6 with 7 dwarves at startup.
Title: Re: Kobold Quest port status?
Post by: Charlie on January 01, 2008, 01:55:00 pm
Just a tip here: I really wanted to play DF (sounds like a great game) but I have a mac, so I've been waiting for a while. However, then I installed Windows XP on my Macbook (using Boot Camp beta) and Dwarf Fortress runs GREAT.

~Charlie

Title: Re: Kobold Quest port status?
Post by: taargus on January 01, 2008, 05:43:00 pm
I can't wait to play. Thanks for going through all this work just so us mac users can play.
Title: Re: Kobold Quest port status?
Post by: Armok on January 01, 2008, 08:55:00 pm
quote:
Originally posted by taargus:
<STRONG>I can't wait to play. Thanks for going through all this work just so us mac users can play.</STRONG>

And you'd BETTER donate the $300 it cost him.

Title: Re: Kobold Quest port status?
Post by: peterb on January 03, 2008, 02:06:00 pm
I have no problem stating in public that I plan on donating $100 to Tarn once DF for Mac is released, and will blog about it encouraging others to donate as well.

-p

Title: Re: Kobold Quest port status?
Post by: axus on January 04, 2008, 01:27:00 pm
quote:
Originally posted by Armok:
<STRONG>

And you'd BETTER donate the $300 it cost him.</STRONG>


I thought the Mini was donated to Toady?  I don't have a Mac but I support going multi-platform, its a good way to futureproof a game.

Title: Re: Kobold Quest port status?
Post by: mattmoss on January 04, 2008, 01:32:00 pm
quote:
Originally posted by axus:
<STRONG>

I thought the Mini was donated to Toady?  I don't have a Mac but I support going multi-platform, its a good way to futureproof a game.</STRONG>


Futureproof? You're expecting Windows (w/OpenGL) to die anytime soon?

:D

Title: Re: Kobold Quest port status?
Post by: Toady One on January 04, 2008, 05:48:00 pm
Nah, I had to buy the Mini.  There was an offer a long time ago from somebody to send me a Cube of some kind, but I didn't end up taking it because I didn't have a port at the time.

I think I'm going to put up the PowerPCish KQ on Monday.  I was planning on trying to finish the DF port then as well, but that might have to wait a little until I get together something releasable for Windows again.  I'm hoping to be able to release the next version of DF on both platforms (the Mac one would be a MegaAlpha, of course), but we'll have to see how that plays out.

Title: Re: Kobold Quest port status?
Post by: zeb on January 04, 2008, 08:46:00 pm
Hi Toady,

Very glad to see your hard work on the Mac Port of DF.  I've just contributed 50.00 for your existing efforts and will contribute 50 more on delivery of a working mac binary.  Don't let that little incentive rush you though.  We love stability, and quality is more important than speed.  Also, I own several macs , Intel and PowerPC and would be happy to beta test any builds that you want to help chase down bugs.

Zeb.

Title: Re: Kobold Quest port status?
Post by: Toady One on January 07, 2008, 07:53:00 pm
Okay, I've put up KQ 1.04 so people can let me know how that went...
Title: Re: Kobold Quest port status?
Post by: oohhboy on January 09, 2008, 05:10:00 am
My apologies if this isn't the best place to post this. I hope this helps.

Date/Time:      2008-01-09 22:59:30 +1300
OS Version:     10.3.9 (Build 7W98)
Report Version: 2

Command: Kobold Quest
Path:    /Volumes/USB HD/downloads/kobold quest/Kobold Quest.app/Contents/MacOS/Kobold Quest
Version: ??? (1.0)
PID:     593
Thread:  Unknown

Link (dyld) error:

dyld: /Volumes/USB HD/downloads/kobold quest/Kobold Quest.app/Contents/MacOS/Kobold Quest Undefined symbols:
/Volumes/USB HD/downloads/kobold quest/Kobold Quest.app/Contents/MacOS/Kobold Quest undefined reference to _HIPointConvert expected to be defined in Carbon

It starts up fine. Loads front end with the picture of that thing (kobold?), then regardless of any input it crashes.

Title: Re: Kobold Quest port status?
Post by: Toady One on January 09, 2008, 04:27:00 pm
I wonder if that's something I did wrong with the new code or if it's just not working in 10.3 yet.  We'll have to wait for the experts on this one.  I know HIPointConvert was key to the 10.3 changes.
Title: Re: Kobold Quest port status?
Post by: eli on January 09, 2008, 07:23:00 pm
Same crash here on 10.3.9 (PowerPC). I'm guessing the compiled version isn't actually the same as the source code, which looks fine. I can't check it until I'm on my development machine, but I'll try compiling it tonight.
Title: Re: Kobold Quest port status?
Post by: Toady One on January 09, 2008, 07:52:00 pm
I deleted all the executables before I got started, and compressed the only folders on the computer, so I'm not sure how a mismatch would have happened, but we can see I guess.
Title: Re: Kobold Quest port status?
Post by: eli on January 10, 2008, 03:33:00 am
Easy fix. You need to open up the project settings (you can double click the blue "game" icon at the top of the file list) and change the setting for MACOSX_DEPLOYMENT_TARGET from "Compiler Default" to "10.3". You should probably also turn on PowerPC in the Architectures setting right at top, but it seems to be building the Universal application anyway.

I did notice that it was eating the mouse click and not registering it if I opened the About Box so that it overlapped the game window, but I'm too sleepy to look at that tonight.

edit: spelzin

[ January 10, 2008: Message edited by: eli ]

Title: Re: Kobold Quest port status?
Post by: mattmoss on January 10, 2008, 06:35:00 pm
Thanks for looking at that, eli. I've been a bit busy lately...
Title: Re: Kobold Quest port status?
Post by: Toady One on January 14, 2008, 08:45:00 pm
Well, I've changed the settings and uploaded it again.

I searched for how to changed the architecture settings, and what I found made it look like I should type "ppc i386" into the Architectures area, so that's what I did.  It made a couple of different object folders upon build, but I have a warning about adding -bind_at_load that I don't know what to do with.

Title: Re: Kobold Quest port status?
Post by: oohhboy on January 15, 2008, 02:33:00 am
Seems to work fine for now.  I just gotta figure out how  to play it. If there are any more issues I will come back with them.

Other than that, congratulations. I hope this has allowed you to take a pretty big step towards getting DF on Mac.   :D

Title: Re: Kobold Quest port status?
Post by: mattmoss on January 15, 2008, 10:49:00 am
quote:
Originally posted by Toady One:
<STRONG>Well, I've changed the settings and uploaded it again.

I searched for how to changed the architecture settings, and what I found made it look like I should type "ppc i386" into the Architectures area, so that's what I did.  It made a couple of different object folders upon build, but I have a warning about adding -bind_at_load that I don't know what to do with.</STRONG>


Hey Toady,
I'll download the latest source this evening and check it out...

I'll also work on the fullscreen swap, and perhaps clean up the menus (i.e. remove all the unused junk).

[ January 15, 2008: Message edited by: mattmoss ]

Title: Re: Kobold Quest port status?
Post by: Q on January 15, 2008, 02:20:00 pm
I saw someone mentioned Cider...  Is that out of the question?  It seems like that would be the easiest and fastest solution.  Might even be free, since they profit-share and DF is nonprofit.

Granted it would only play nice with Intel Macs.  But it's a start...  And any Mac under two years old is Intel anyway.

Title: Re: Kobold Quest port status?
Post by: Q on January 15, 2008, 02:52:00 pm
er...  my last post didn't seem to go through.  Here goes:

I saw someone mentioned using Cider ...  is that out of the question?  It seems like it'd be the easiest and fastest way to get an OSX port out, and it might even be free, since DF is a nonprofit game and they operate by profitsharing.

Granted it would only play nice with Intel Macs.  But it's a start...

Title: Re: Kobold Quest port status?
Post by: mattmoss on January 15, 2008, 07:13:00 pm
Cider has been mentioned before... and passed on, if I recall correctly.

Seeing as how DF is pretty much running on the Mac (specifically, Toady's Mac), I don't see that Cider is necessary. As I understand it, DF uses little platform-specific code, and much of that has been accommodated in code that Toady now owns.

Title: Re: Kobold Quest port status?
Post by: mattmoss on January 15, 2008, 11:02:00 pm
I've got the fullscreen toggle 1/2 working... well, about 40%.

It switches from window to fullscreen now, but something weird is going on switching back. I may have to hook up a 2nd monitor so I can debug properly.

The textures are also going a bit weird when switching. It's not unplayable, but it's like they're lower rez or something. Weird...

Anyway, should have it all good soon...

Title: Re: Kobold Quest port status?
Post by: poesel on January 18, 2008, 10:11:00 am
Just a report that KQ 1.05 works on a PPC G4 with 10.5.1 (Powerbook).

What does not work is going fullscreen: I get big blocky graphics and it won't switch bach to windowed. Pressing Alt-Aplle-Esc crashes KQ.

Also I don't seem to be able to kill adventurers. Maybe I'm stupid but they just walk over pits and throwing critters at them make them flashing but nothing else happens.

Title: Re: Kobold Quest port status?
Post by: mattmoss on January 18, 2008, 02:29:00 pm
quote:
Originally posted by poesel:
<STRONG>Just a report that KQ 1.05 works on a PPC G4 with 10.5.1 (Powerbook).

Thanks for the report...

quote:
What does not work is going fullscreen: I get big blocky graphics and it won't switch bach to windowed. Pressing Alt-Aplle-Esc crashes KQ.

Yeah, I'm dealing with the fullscreen/window switching code now.

quote:
Also I don't seem to be able to kill adventurers. Maybe I'm stupid but they just walk over pits and throwing critters at them make them flashing but nothing else happens.</STRONG>

As I understand it, throwing critters is generally a last resort... you need to rely on the pits more.  Pick up a critter, drop him in a pit, then cover the pit. (Adding multiple critters to a pit is also good...)  Then keep the pit between you and the adventurer... assuming he didn't actually see you cover it, in which case I believe he'll avoid it.

Title: Re: Kobold Quest port status?
Post by: poesel on January 20, 2008, 02:04:00 pm
Just for the stupid (like me): you need to press 'enter' after you throw...   :cool:
Title: Re: Kobold Quest port status?
Post by: taargus on January 25, 2008, 11:05:00 pm
any updates for the dwarf fortress port?
Title: Re: Kobold Quest port status?
Post by: Toady One on January 25, 2008, 11:09:00 pm
The situation hasn't changed.  I'm hoping to release an attempt at a Mac version with the next DF.
Title: Re: Kobold Quest port status?
Post by: mattmoss on January 28, 2008, 02:09:00 pm
I have the fullscreen swap 90% working now. It's usable and seems stable. There are three remaining things I'd like to do.

1. Make it fully robust. While it is most likely robust as it is, I have this nagging feeling that there might be cases where it would get stuck in fullscreen mode and the user won't be able to switch away, forcing power off and reboot. I'll have to check this further...

2. Textures still get slightly mangled when switching to the other mode from which you started. It's still playable, just not as pretty. Have to look into this more.

3. Windows of other apps are getting moved/resized due to the screen change... It's not supposed to happen; trying to figure out why.

Anyway, will be sending you the revised code later today, Toady.

[ January 28, 2008: Message edited by: mattmoss ]

Title: Re: Kobold Quest port status?
Post by: Trukkle on January 28, 2008, 07:14:00 pm
Holy crap, it took me half an hour to get KQ to compile properly on a fresh install of VC++ 2008 on windows (I'm still a beginner and had to switch it to the glut libs, then fight fmod). My hat is off to you guys forging ahead on Macs.
Title: Re: Kobold Quest port status?
Post by: taargus on February 06, 2008, 10:04:00 pm
There's still going to be a mac port right?
Title: Re: Kobold Quest port status?
Post by: Toady One on February 06, 2008, 10:11:00 pm
From dev log:
quote:

Mac portage... there are still various gigantic problems with the peripherals (sound/movies/BMP export/etc.), but there was quite a bit of progress. I generated a world with the same seed on both of my computers and got the same exact map and history. It was a bit of a chore though since the order of RNG calls between MSVC and XCode was different based on compiler optimizations (so I had to break some expressions up, once I found out what was going on). I can't guarantee there won't be a lot of addition problems along these lines. I then went on to mine a tunnel in dwarf mode and join a temple in adventure mode. Speed was fine, except in a few places where the number of refreshes needs to be cut down (unit offloading is the big one).

I'm at a point where I can't continue without some email correspondence, so I'm going to release the Windows version now. I'll just be bug fixing with more frequent releases for a while though, so as soon as the main Mac issues are handled I can get the port out with one of those. I have the actual code transfer/Mac compile/archive process down to about a half hour which I can mostly spend working on other release procedures, so once the initial problems are sorted out everything should actually go smoothly from now on.


Title: Re: Kobold Quest port status?
Post by: eli on February 13, 2008, 02:40:00 pm
quote:
Originally posted by Toady One:
<STRONG>From dev log:
</STRONG>

I've been AWOL (stupid job) but probably have a few hours this weekend if there's anything specific I could help out on. Is music still broken in Kobold Quest? I could work on that if it's the same system used in Dwarf Fortress...

Title: Re: Kobold Quest port status?
Post by: Toady One on February 13, 2008, 07:39:00 pm
We haven't chosen between upgrading to a new fmod or using something else (it would have to have a permissive license of course), preferably something that will work with Intel and PPC.  I think the issue was that the older versions of fmod didn't work on both Intel/PPC?  In any case, any suggestions here are welcome.  I have no idea how sound is handled on a Mac.  Dropping in a new music_and_sound_osx.cpp that is mostly compatible with the commands I'm currently using should work for DF, although I'd need a way to refer to the songs that is fmod/new library independent if we end up going over to something else, so that the windows version can be made to work within the same framework.
Title: Re: Kobold Quest port status?
Post by: mattmoss on February 13, 2008, 11:32:00 pm
Seeing as how it's ogg vorbis files, it might not be a big deal to compile libogg (which I imagine has a decent license, though not sure) and pump output from that into whatever runs the Mac audio system. Unfortunately, that's one area I know nothing about.

Another option might be taking the tabs I saw in another thread and putting that into midi. But again, that's another area I've never dealt with.  For either of these, I don't imagine it's that difficult, but it would take time to figure out, and for the next month or two, my time is going to be extremely limited. (Moving)

eli, if that's something you know about, please have a crack at it.

Title: Re: Kobold Quest port status?
Post by: eli on February 13, 2008, 11:48:00 pm
I got the "old" (3.75 - is that what you use?) version of fmod going on the my intel MBP, seems to work fine. <<EDIT>> 10.3 PPC actually works fine too - it was a weird issue with file permissions from transferring on my usb thumb drive.<<>>

The changes were very minor, most of my time was spent being stupid and missing the line right in front of my nose where it tried to set fmod to use DirectSound output (nice sanity checking, guys.)

[ February 14, 2008: Message edited by: eli ]

Title: Re: Kobold Quest port status?
Post by: Toady One on February 14, 2008, 07:36:00 am
I'm using 3.7.4.  I can upgrade windows DF to 3.7.5 though, assuming they didn't change everything around, and they've still got a file for me to snatch.

[ February 14, 2008: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: tarsier on February 17, 2008, 05:33:00 pm
Toady, I want to thank you so much for your progress so far on making an OS X version - running DF in virtual PC makes it run extremely slowly, so I can't wait until I can play DF at it's intended speed!
Keep up the great work, all of us mac geeks are really really excited!  :D
Title: Re: Kobold Quest port status?
Post by: xomg on February 18, 2008, 09:15:00 am
For what it's worth, DF wrapped with Cider runs at exactly the same speed as DF launched with Crossover (and I assume WINE) on a quick test fortress.
Title: Re: Kobold Quest port status?
Post by: Toady One on February 20, 2008, 03:46:00 am
I've made the movie code OS independent and I've now got the intro movie running with sound on the Mac version of DF.  Most of the remaining issues are fairly minor and I'll probably put up a version with the next Windows version of DF (late Saturdayish being the current plan).  The fullscreen toggle is still mysteriously only working in Mac KQ, but you can probably live without that until it's sorted out.

edit: He he he, full screen toggle suddenly started working for no reason!  This is both good and bad, but I'll let the bad slide for now and possiblye forever.

[ February 20, 2008: Message edited by: Toady One ]

Title: Re: Kobold Quest port status?
Post by: xomg on February 20, 2008, 10:48:00 am
Haha, awesome. I haven't been this excited about something since Christmas as a child. That's both funny and depressing at the same time.

Don't worry too much about fullscreen on the Mac. I'm new to them myself and can't speak for everybody, but in general a lot of Mac users seem to prefer running apps and games in a window. Most are also going to have LCD screens these days, which can look like ass when forced into non-default resolutions or aspect ratios and seems to disable task-switching for me.

ps: I've been running the game in Crossover/Wine since switching to a Mac, and it seems to be locked at a solid 21-22 FPS regardless of how large or complicated the fort is (within reason). Feels like a bottleneck somewhere, either in Crossover, my system, or DF itself.

Title: Re: Kobold Quest port status?
Post by: fifelfoo on March 31, 2008, 10:25:00 pm
Oh great ones, the port rocketh most highly.

However, being used to a variety of interfaces, DF's interface is, uh, well there's a bug logged about it, but its status is future.

I note, for example, the following systems of movement / resizing (in today's world, equivalent tasks).  Sometimes its legitimate that two would be needed (left pane / right pane).  But in others, like lists, sometimes its -/+ for the left list and arrows for the right.

Types of movement & resizing tools:
wasd
wasdx
uhkm
shift-uhkm (alongside uhkm)
-/+
arrow-keys

Similarly for selection / quantity
space
enter
left/right-keys
-/+

For abort / dismiss
space
enter
F8/F9
tab

Additionally, there are some interesting interface flow issues, sometimes (for instance Dwarf management via [j]obs or nits) abort/dismiss returns to Map, instead of to prior menu.  Other times abort/dismiss returns to prior menu.

Some panes/panels aren't available from logical places.  Found I was incorrect about: [[From Zoom to Dwarf, the option of View Dwarf mood / relationship isn't available, and from View Dwarf the option to zoom to General / Labour assignment isn't available.]]

* * *

But: this is bitching from someone used to the (relatively) integrated and controlled Mac interface, someone who's a Human Interface Guidelines lover, reads Style Manuals for fun, and is into typography.  Learning the DF interface idiosyncracies is possible, but its frustrating on about the same level as obsessive / compulsive stone management.
null

[ April 01, 2008: Message edited by: fifelfoo ]

Title: Re: Kobold Quest port status?
Post by: Geofferic on April 03, 2008, 04:10:00 pm
Not to thread hijack (and yet here I go), but I have been playing DF off and on for some time now and I have to say that I can't even conceive of there being interface problems! lol

Clearly, I have spent far, far too many hours playing the game.

The only interface problem I have is going from a full keyboard to my laptop - now that can be weird.   :)

Title: Re: Kobold Quest port status?
Post by: Zardus on April 29, 2008, 01:06:00 am
I was browsing the DF FAQ, which led me here through the "When is DF for Linux coming out" question. The thread spans over 1.5 years and nothing is clear, though, so I was wondering if someone would summarize it for me:

1. Is anyone working on porting Kobold Quest to Linux?
2. Was SDL ruled out (because of the LGPL or otherwise) or will Toady One accept a port using this route (for the purpose of furthering it into a Linux DF)?
3. Is there any abandoned or otherwise in-progress KQ port? What's its status/license?

Sorry for my laziness. I didn't want to read a year and a half worth of posts and come to the wrong conclusions.

Title: Re: Kobold Quest port status?
Post by: Toady One on April 29, 2008, 03:33:00 am
1.  Not that I know of, though there was a recent discussion in a Linux thread in the suggestions forum that made it sound like there were a few people interested in looking at it again.

2.  I don't remember the particulars with SDL, but if I remember, I didn't want to use it.

3.  I have something that nornagon cooked up for KQ 1.02.  I think there was some roughness with it, and I haven't gotten a chance to look at it, and he's been busy.  I can't find a licensing discussion in my email with him, so I can't post the source at this point.  I doubt there'd be a problem, but since I don't have time to look at it until later, I haven't contacted him.

So in the end, I might have something I can or can't use.  Maybe not best to rush forward with another port in that environment.

Title: Re: Kobold Quest port status?
Post by: I3erent on April 30, 2008, 11:33:00 pm
quote:
Originally posted by tarsier:
<STRONG>Toady, I want to thank you so much for your progress so far on making an OS X version - running DF in virtual PC makes it run extremely slowly, so I can't wait until I can play DF at it's intended speed!
Keep up the great work, all of us mac geeks are really really excited!   :D</STRONG>

Me too and I have a Pc!  Low key jab at framerate optimization.......