Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pascal sources for Moria

185 views
Skip to first unread message

mewpo...@hotmail.com

unread,
Sep 26, 2012, 5:24:13 AM9/26/12
to
I'm a pascal programmer and I'm wanting the pascal sources for Moria (hopefully version 5) to implement it on Delphi/FreePascal (with extensions/improvements).

I've searched and searched, but all I can find are c translations of the pascal. I don't want to have to translate it back again.

Can anyone help me?

Thanks in advance.


Daniel.

Michał Bieliński

unread,
Sep 26, 2012, 7:53:21 AM9/26/12
to
Once upon a time, Daniel wrote thus:
> I'm a pascal programmer and I'm wanting the pascal sources for Moria
> (hopefully version 5) to implement it on Delphi/FreePascal (with
> extensions/improvements).

Hello, fellow Pascal programmer.

> I've searched and searched, but all I can find are c translations
> of the pascal. I don't want to have to translate it back again.

You need to search for VMS Moria. That version was in Pascal. Here:

http://www.beej.us/moria/files/historical/vms/vms50.tar.Z

Beej kindly hosts archive containing Moria and its variants. I have
ported BOSS which was forked from VMS Moria 5.0 to PC with some
effort. You can see it here (sources naturally are available):

http://dungeon_keeper.republika.pl/

It took me about seven days several hours of work each day. The code
has some incompatibilities but surprisingly few for so old piece
of software. Porting Moria should be comparable. If you could use help
working on the program I will be glad to offer some minor assistance.

--
Michał Bieliński

mewpo...@hotmail.com

unread,
Oct 2, 2012, 9:44:22 AM10/2/12
to
Michał,

Thanks for that!

I've downloaded the sources and begun work on translating them.

I like the "value" reserved word and the way VMS pascal handles initialising variables. Unfortunately for me, its a lot more difficult in Delphi/Free Pascal.

To get me started, I translated the BOSS sources to work on Delphi XE2. That took quite a bit of work; more than I was expecting. The crt unit from Free Pascal and another from the web didn't work (just printed gibberish or caused the Writeln procedure to produce artefacts) so I had to use the Console unit from another source. I think it had something to do with Delphi XE2 using unicode by default. I also had trouble with some string conversions, again unicode issues.

Anyway, I have something working now for BOSS and I can give you the source code although it is in a slightly "in progress" form and I can't guarantee it supporting all Delphi versions (but it should be simple to do this). I'm quite impressed with Free Pascal handling those "otherwise" clauses.

I have started work on Moria although I'm still translating the variable data. As I progress, I am trying to also make a format that will be useful when it comes time to put all the data in separate data files, as well. Having your BOSS source code will help, I feel.

Thanks again.


Daniel.

mewpo...@hotmail.com

unread,
Oct 9, 2012, 4:01:17 AM10/9/12
to
Okay... I've finished the first pass on the source files and they compile without any messages with Delphi XE2 and only a couple with Free Pascal.

Mostly anywhere I've done a change, I've kept the original code in comments. I'm currently using the Classes unit because of the "master file" (for save file encryption checking). I can perhaps clear all this up in the second pass. There are a few todos.

I wasn't sure what the "<+" operator is meant to do in the routine poly_monster so I translated it as per Michal in BOSS to just "<". I changed the creature_type field mexp to signed because it loads signed data from the creature data file.

I'm testing the code now. Its a near impossible job to test all logic paths. So far, its running but I haven't gone anywhere interesting yet.

The save files are not compatible with the VMS version because of: 1. the data encryption may be different; and 2. saving booleans is presently different (saved as oridinals since this is easier).

The checking for valid playing hours has been disabled. Wizard mode is presently unavailable. I am concerned about some of the input keys not working as expected because of the way the original checks them (I am yet to test them all). I have to clear up the {$IFDEF VER230} conditionals to make them more specific to the task (rather than just checking for VER230).

I'm wondering where I should put the code. I'm thinking I may put it on SourceForge or GoogleCode but I'm unfamiliar with doing so.


Daniel.

Michał Bieliński

unread,
Oct 9, 2012, 4:11:59 PM10/9/12
to
Once upon a time, Daniel wrote thus:
> Okay... I've finished the first pass on the source files and they
> compile without any messages with Delphi XE2 and only a couple with
> Free Pascal.

Great! Good job. Is it available for checking out? I am curious how
much Moria and BOSS differ.

> Mostly anywhere I've done a change, I've kept the original code in
> comments. I'm currently using the Classes unit because of the "master
> file" (for save file encryption checking). I can perhaps clear all
> this up in the second pass. There are a few todos.

I dropped encryption support entirely for BOSS. Decided it was not worth
keeping around.

> I wasn't sure what the "<+" operator is meant to do in the routine
> poly_monster so I translated it as per Michal in BOSS to just "<".

Actually "<+" is two operators. Less than and unary plus. Original
BOSS sources I worked on had already dropped the plus in favor of just
the relational operator.

> I'm testing the code now. Its a near impossible job to test all
> logic paths. So far, its running but I haven't gone anywhere
> interesting yet.

Very true. Once in a while I run into an odd behavior too. The problem
is I haven't had any prior Moria or its variants experience before
being exposed to BOSS. Thus it is a bit difficult deciding when
something strange happens what should be done about it. Is it a game
peculiarity, side effect of porting the code or unfixed bug? Had to go
with common sense once in a while.

> The save files are not compatible with the VMS version because of:
> 1. the data encryption may be different; and 2. saving booleans is
> presently different (saved as oridinals since this is easier).

Same here. Not being able to read and write booleans easily is
something to wish for.

> I'm wondering where I should put the code. I'm thinking I may put
> it on SourceForge or GoogleCode but I'm unfamiliar with doing so.

Can't offer useful advice on that I am afraid. Putting a tarball on
website does it for me.

--
Michał Bieliński

mewpo...@hotmail.com

unread,
Oct 11, 2012, 2:47:27 AM10/11/12
to
On Wednesday, 10 October 2012 06:11:59 UTC+10, Michał Bieliński wrote:
> Once upon a time, Daniel wrote thus:
>
> > Okay... I've finished the first pass on the source files and they
> > compile without any messages with Delphi XE2 and only a couple with
> > Free Pascal.
>
>
> Great! Good job. Is it available for checking out? I am curious how
> much Moria and BOSS differ.

I'm presently adding colour (for the Windows platform only at the moment) so that might be of particular interest.

The player stuff is largely different, as are the creatures and objects. I like the way a player character is generated in BOSS. I intend to change it in Moria to be somewhat similar.

I want to add a difficulty setting, too. Like in Baldur's Gate/Neverwinter Nights so that the player isn't affected by things too badly in normal and easy. It would only be settable from the beginning. With the way the code is now, it might also be a bit tricky to implement.

I also would like to add something like attacks of opportunity (as per AD&D) but that would require significant changes. Actually, I'm not quite sure how to do it at the moment.

I've kept all of the information about where things were meant to be stored in memory (the blah$blahblah attributes) for the routines so this will help when I get around to refactoring it all into objects.

The only way I could get it to you at the moment is via e-mail, I'm afraid.


> > Mostly anywhere I've done a change, I've kept the original code in
> > comments. I'm currently using the Classes unit because of the "master
> > file" (for save file encryption checking). I can perhaps clear all
> > this up in the second pass. There are a few todos.
>
> I dropped encryption support entirely for BOSS. Decided it was not worth
> keeping around.

I've had to drop it, too. At least, temporarily. The algorythm won't work on Unix/Linux/Windows because the encrypted data can contain the values $0A and $0D which are also required for line-break markers. On VMS, line-breaks must be stored in some other way. I have already had to change the way the dungeon floor layout is saved because of this issue. I have thought of a way to work-around it but haven't implemented it yet. I've also changed the way the version stamp is stored because using a small floating point value is too inaccurate.


> > I wasn't sure what the "<+" operator is meant to do in the routine
> > poly_monster so I translated it as per Michal in BOSS to just "<".
>
> Actually "<+" is two operators. Less than and unary plus. Original
> BOSS sources I worked on had already dropped the plus in favor of just
> the relational operator.

Hmm... Do you know what this code would have done?
"if (dist <+ obj$Bolt_range) then"

I've translated it to:
"if (dist < obj_Bolt_range)"

I know that the $ is used to mark memory storage space but not sure about the <+.

> > I'm testing the code now. Its a near impossible job to test all
> > logic paths. So far, its running but I haven't gone anywhere
> > interesting yet.
>
> Very true. Once in a while I run into an odd behavior too. The problem
> is I haven't had any prior Moria or its variants experience before
> being exposed to BOSS. Thus it is a bit difficult deciding when
> something strange happens what should be done about it. Is it a game
> peculiarity, side effect of porting the code or unfixed bug? Had to go
> with common sense once in a while.

Yes... Its quite a while ago since the code was last worked on by anyone as well. So the expert/knowledge-base is not there.


> > The save files are not compatible with the VMS version because of:
> > 1. the data encryption may be different; and 2. saving booleans is
> > presently different (saved as oridinals since this is easier).
>
> Same here. Not being able to read and write booleans easily is
> something to wish for.

Yes, the Writev routine from VMS pascal is nifty. I like it a lot. The same for Readv; very nice. I'm presently doing a whole heap of nasty work-arounds for not having a really functional sscanf in Delphi. I can only pass in actual integers and AnsiStrings for the data so have to use variables for reading the data into and then assign the data from the variables to where it needs to go. I've always meant to write an Unformat routine. I might actually get around to it but I'm not sure how to fix the issue since the type's type data is rather limited in expressing just what the pointer refers to (this is why I have the problem now).


> > I'm wondering where I should put the code. I'm thinking I may put
> > it on SourceForge or GoogleCode but I'm unfamiliar with doing so.
>
> Can't offer useful advice on that I am afraid. Putting a tarball on
> website does it for me.

Yeah, me too. Except I presently have no web hosting and can't afford it, either. Gone are the days you'd get it for free with your internet provisioning.

I'm looking at SourceForge now. Apparently Subversion is integrated into the RAD Studio XE2 IDE so that might be good... or bad.

Do you have Delphi or are you just using FPC/Lazarus?


Daniel.

mewpo...@hotmail.com

unread,
Oct 11, 2012, 3:00:44 AM10/11/12
to
On Thursday, 11 October 2012 16:47:27 UTC+10, (unknown) wrote:
>
> I'm looking at SourceForge now. Apparently Subversion is integrated into the RAD Studio XE2 IDE so that might be good... or bad.

Oh dang. They already have a project "Moria." Its a "central http-based authentication service". Bah!

I'd have to call it Moria RPG or something.


Daniel.

Michał Bieliński

unread,
Oct 13, 2012, 9:29:53 AM10/13/12
to
Once upon a time, Daniel wrote thus:
> On Wednesday, 10 October 2012 06:11:59 UTC+10, Michał Bieliński wrote:
>> Actually "<+" is two operators. Less than and unary plus. Original
>> BOSS sources I worked on had already dropped the plus in favor of just
>> the relational operator.
>
> Hmm... Do you know what this code would have done?
> "if (dist <+ obj$Bolt_range) then"

It is equivalent to
"if (dist < +obj$Bolt_range) then"

As I wrote above "<+" is not a single thing. It consists of two operators.

> I've translated it to:
> "if (dist < obj_Bolt_range)"

Which is also the same thing.

> I presently have no web hosting and can't afford it, either. Gone are
> the days you'd get it for free with your internet provisioning.

There might be easy remedy for that. I have some space reserved for
other game I work on in my spare time - Prime. BOSS should have been
moved there long ago. While I do this there is nothing preventing me
from creating space for another related project. Expect a mail from
me tomorrow.

> Do you have Delphi or are you just using FPC/Lazarus?

FPC without Lazarus.

--
Michał Bieliński
0 new messages