Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:56 17 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: Aklabeth - possible Christmas project for someone

     Page 1 of 2    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3826
Posted: 10:22am 25 Nov 2021
Copy link to clipboard 
Print this post

Hi folks,

I'm kind of busy otherwise I would probably have jumped at this, it's the "proto-Ultima" CRPG and appears to be only 1000 lines of legacy BASIC:

   https://github.com/JustinBaldock/X16-Akalabeth

Best wishes,

Tom
Edited 2021-11-25 20:23 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5695
Posted: 11:28am 25 Nov 2021
Copy link to clipboard 
Print this post

I wasn't aware of that at all. I've never played any of the Ultima series either.
Hmmm... mono wireframe. Could this be the first proper game for the VeGAmite, I wonder? It should be green. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3478
Posted: 03:46pm 25 Nov 2021
Copy link to clipboard 
Print this post

The sinclair QL version seems portable. Single BAS file. Haven't seen (browsing through) any things the CMM2 could not handle. Is full of goto's though. To get that neat, involves pretty much a re-write.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5695
Posted: 06:00pm 25 Nov 2021
Copy link to clipboard 
Print this post

I couldn't really argue with something that looks like it has a Hercules monitor running a program full of GOTOs. :)  Wouldn't do for the CMM2 though. lol
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 08:46pm 04 Dec 2021
Copy link to clipboard 
Print this post

I thought this would be a quick simple port. Turns out de-spaghetti-ing 42 year old Applesoft Basic takes a bit of effort. Over 150 GOTOs and GOSUBs to vanquish...

Here's a quick preview AkalabethPreview showing the monsters. I've taken some liberties and coloured them a bit, but they should be very true to their original shape.

(This is a stripped down preview, my working code is getting close to complete.)
Visit Vegipete's *Mite Library for cool programs.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3826
Posted: 12:18pm 06 Dec 2021
Copy link to clipboard 
Print this post

Neat work Pete, glad (if somewhat jealous) that somebody took up the challenge.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 12:26pm 06 Dec 2021
Copy link to clipboard 
Print this post

  vegipete said  I thought this would be a quick simple port. Turns out de-spaghetti-ing 42 year old Applesoft Basic takes a bit of effort. Over 150 GOTOs and GOSUBs to vanquish...

Here's a quick preview AkalabethPreview showing the monsters. I've taken some liberties and coloured them a bit, but they should be very true to their original shape.

(This is a stripped down preview, my working code is getting close to complete.)


Nice done Pete
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3478
Posted: 02:14pm 06 Dec 2021
Copy link to clipboard 
Print this post

Dear Vegipete,

Great you started the port !. I myself had postponed this for the christmas holidays (it's gonna be sh*tty weather, rain, rain, rain, rain and wet snow...).
But now you beat me to it. !!

Great work, it looks very structured now

Volhout
PicomiteVGA PETSCII ROBOTS
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 05:06pm 06 Dec 2021
Copy link to clipboard 
Print this post

Thanks! It's getting closer. I'm working through the subtleties of the player attacking monsters in the dungeon. After that, monsters attacking and moving and it should be done.

Structure wise, I may be abusing DO : LOOP along with multiple EXIT LOOPs to accomplish some of the spaghetti GOTOs operations. This forces me to try to understand exactly what the original code is doing... sort of.

It does explain why some people loath BASIC so much. Tangled messes of program flow were the potential hallmark of old-school BASIC and rightly should be deplored. But modern structured BASIC can be used much like any other structured language.

GOTO hunting continues...
Visit Vegipete's *Mite Library for cool programs.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 05:43am 20 Dec 2021
Copy link to clipboard 
Print this post

Great Scott! What a slog...

Here's the original Applesoft monster move/attack/retreat/heal code:
4000  FOR MM = 1 TO 10: IF MZ%(MM,0) = 0 THEN 4999
4010 RA =  SQR ((PX - ML%(MM,0)) ^ 2 + (PY - ML%(MM,1)) ^ 2)
4011  IF MZ%(MM,1) < IN * LP THEN 4030
4020  IF RA < 1.3 THEN 4500
4025  IF MM = 8 AND RA < 3 THEN 4999
4030 X1 =  SGN (PX - ML%(MM,0)):Y1 =  SGN (PY - ML%(MM,1))
4031  IF MZ%(MM,1) < IN * LP THEN X1 =  - X1:Y1 =  - Y1
4035  IF Y1 = 0 THEN 4045
4040 D = DNG%(ML%(MM,0),(ML%(MM,1) + Y1 + .5)): IF D = 1 OR D > 9 OR D =
    2 THEN 4045
4042 X1 = 0: GOTO 4050
4045 Y1 = 0: IF X1 = 0 THEN 4050
4046 D = DN%((ML%(MM,0) + X1 + .5),ML%(MM,1)): IF D = 1 OR D > 9 OR D =
    2 THEN X1 = 0: GOTO 4081
4050 DNG%(ML%(MM,0),ML%(MM,1)) = DNG%(ML%(MM,0),ML%(MM,1)) - 10 * MM
4055  IF ML%(MM,0) + X1 = PX AND ML%(MM,1) + Y1 = PY THEN 4999
4060 ML%(MM,0) = ML%(MM,0) + X1:ML%(MM,1) = ML%(MM,1) + Y1
4080 DNG%(ML%(MM,0),ML%(MM,1)) = (DNG%(ML%(MM,0),ML%(MM,1)) + 10 * MM +
    .5)
4081  IF X1 <  > 0 OR Y1 <  > 0 THEN 4999
4082  IF MZ%(MM,1) < IN * LP AND RA < 1.3 THEN 4500
4083  IF MZ%(MM,1) < IN * LP THEN MZ%(MM,1) = MZ%(MM,1) + MM + IN
4499  GOTO 4999
4500  IF MM = 2 OR MM = 7 THEN 4600
4509  PRINT "YOU ARE BEING ATTACKED": PRINT "BY A ";M$(MM)
4510  IF  RND (1) * 20 -  SGN (PW(3)) - C(3) + MM + IN < 0 THEN  PRINT "
    MISSED": GOTO 4525
4520  PRINT "HIT":C(0) = C(0) -  INT ( RND (1) * MM + IN)
4525  IF PA = 1 THEN  PRINT "-CR- TO CONT. ";: INPUT Q$
4530  GOTO 4999
4600  IF  RND (1) < .5 THEN 4509
4610  IF MM = 7 THEN PW(0) =  INT (PW(0) / 2): PRINT "A GREMLIN STOLE SO
    ME FOOD": GOTO 4525
4620 ZZ =  INT ( RND (1) * 6): IF PW(ZZ) < 1 THEN 4620
4630  PRINT "A THIEF STOLE A ";W$(ZZ):PW(ZZ) = PW(ZZ) - 1: GOTO 4525
4999  NEXT : RETURN
It's kind of amazing what all is hidden in there. There _may_ even be a bug that erases monsters, although I don't think the relevant IF statement is ever true. (Line 4055)

Add to that variable naming fun - Applesoft names are only significant to 2 characters, so DNG%() and DN%() are the same. Among others...

Here's my rewrite of the above - much less compact, but hopefully much easier to understand:
' Handle each possible monster on level - there could be one of each.
sub MonsterHandle
 local n%
 for n% = 1 to 10
   if mz%(n,0) then MonsterAction(n%,ML%(MM,0),ML%(MM,0))
 next n
end sub

' Let monster n, located at mx,my, do it's thing.
' Weak monsters will try to run away, unless cornered.
' Distant strong monsters will try to move closer to the player.
' A monster up close to (beside) the player will attack.
' A thief or a gremlin might steal something instead of attacking.
' Mimics won't move closer if near (within 3 of) the player - sneaky critters!
' note: mx & my are passed by reference so that changes are returned
sub MonsterAction(n,mx as integer,my as integer)
 local integer dx,dy
 local float ra
 ra = sqr((px - mx) ^ 2 + (py - my) ^ 2)  ' distance to player
 dx = sgn(px - mx)   ' direction toward player
 dy = sgn(py - my)   '    -1/0/1 for x and y axes
 
 if mz%(n,1) < dngLevel*skill then  ' all weak monsters try to run away
   dx = -dx  ' change direction to
   dy = -dy  '    away from player
   MonsterMove(n,mx,my,dx,dy)
 elseif ra < 1.3 then  ' attack if beside player
   MonsterAttack(n)
 elseif n = 8 and ra < 3 then
   exit sub  ' strong mimic doesn't move closer if within 3
 else  ' far away from player so try to move closer
   MonsterMove(n,mx,my,dx,dy)
 endif
end sub

' Monster n at mx,my will try to move in direction dy, then try dx.
' A weak monster, if unable to move away, will attack if close - ie cornered
' note: mx & my are passed by reference so that changes are returned
sub MonsterMove(n,mx as integer,my as integer,dx,dy)
 local integer d
 if dy <> 0 then '4045 ' no y-move so check for x-move
   d = dng%(mx,(my + dy + .5))   ' What's in the y direction?
   if d = 1 or d = 2 or d > 9 then
     dy = 0  ' can't move that way because wall, trap or another monster is there
   else
     dx = 0  ' : goto 4050   ' perform a y-move only
   endif
 endif
 
 if dx <> 0 then '4045 ' no y-move so check for x-move
   d = dng%((mx + dx + .5),my)   ' What's in the x direction?
   if d = 1 or d = 2 or d > 9 then
     dx = 0  ' can't move that way because wall, trap or another monster is there
   endif
 endif

 if dx = 0 and dy = 0 then ' monster couldn't move
   if mz%(n,1) < dngLevel*skill then   ' weak monster couldn't run
     if ra < 1.3 then  ' desparation attack if beside player
       MonsterAttack(n)
     else
       mz%(n,1) = mz%(n,1) + n + dngLevel   ' heal monster
     endif
   endif
 else  ' movin, movin, movin, let's get that monster movin
   if mx + dx = px and my + dy = py then exit sub  ' should never be true
   dng%(mx,my) = dng%(mx,my) - 10 * n '  erase monster at old location
   mx = mx + dx:my = my + dy   ' passed by reference, must propagate back
   dng%(mx,my) = (dng%(mx,my) + 10 * n + .5)  ' replace monster at new
 endif
end sub

' Monster attacks!
' Unless it's a thief or gremlin, in which case there is
' a 50% chance it will steal something instead
sub MonsterAttack(n)
 local integer t
 if n = 2 and rand(1) < .5 then ' yes, it's stealin thief time
   do
     t = int(rand(1) * 6)
   while pw(t) < 1    ' find something to steal
   print "A thief stole a ";w$(t)
   pw(t) = pw(t) - 1
   if pa = 1 then print "-CR- to cont. ";: input q$   ' pause mode
   exit sub
 endif
     
 if n = 7 and rand(1) < .5 then  ' yes, it's food stealin gremlin time
   print "A gremlin stole some food"
   pw(0) = int(pw(0) / 2)
   if pa = 1 then print "-CR- to cont. ";: input q$   ' pause mode
   exit sub
 endif

 print "You are being attacked by a ";m$(n)
 if rand(1) * 20 - sgn(pw(3)) - c(3) + n + dngLevel < 0 then
   print "Missed"
 else
   print "Hit!"
   c(0) = c(0) - int(rand(1) * n + dngLevel)
 endif
 if pa = 1 then print "-CR- to cont. ";: input q$   ' pause mode
end sub

Visit Vegipete's *Mite Library for cool programs.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 10:53pm 26 Dec 2021
Copy link to clipboard 
Print this post

OK folks, it's release time. All the GOTOs are gone.

It's snowing outside but nice and cozy inside as I put this together for your entertainment!

Visit my site listed below to find Akalabeth for the Colour Maximite 2.

Let me know what you find, or if something doesn't work right.

Known issues:

==> Text when you kill a monster with a long name will likely be unclear. This can be fixed if it's a problem.

==> Pause mode not implemented. I see no purpose for this as the game waits for your input anyways.

Also, there's no Save Game function. Would people really like this?

Enjoy!
Visit Vegipete's *Mite Library for cool programs.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3826
Posted: 08:13am 27 Dec 2021
Copy link to clipboard 
Print this post

  vegipete said  Visit my site listed below to find Akalabeth for the Colour Maximite 2.


Signatures seen to be kaput at the moment so no link visible.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5695
Posted: 09:13am 27 Dec 2021
Copy link to clipboard 
Print this post

Working for me, Tom.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3648
Posted: 09:30am 27 Dec 2021
Copy link to clipboard 
Print this post

Working for me, too.

(Laptop with Linux.)

John
Edited 2021-12-27 19:34 by JohnS
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3826
Posted: 01:41pm 27 Dec 2021
Copy link to clipboard 
Print this post

Right you are, it's the mobile site that doesn't show them, and my phone was misbehaving when I was telling it to show me the desktop site.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3826
Posted: 03:38pm 30 Dec 2021
Copy link to clipboard 
Print this post

Well done Pete, all I can say is that "they don't make them like that any more".

Are you planning to:

1. Send a link to CMM2.fun ?

2. Do any further work on it ? - I think the UI could do with some modernisation and the CMM2 could easily fill those polygons.

Thanks for doing this,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 06:36pm 30 Dec 2021
Copy link to clipboard 
Print this post

I'm undecided what more to do with it.

I do have a maintenance update in the works - a minor bug fix due to variable names, plus some layout alterations.

I have thought of integrating my One Page Contest entry 3D maze engine. Ideally the monsters could then be shown as actual graphic images. I just don't have the skill to draw such images. If an artist out there wants to volunteer...
Toggling between original and 'modernized' would be possible.

For other UI improvements, I'm open to suggestions. I suppose a mouse to select items for purchase is 'modern'. I don't want to go too overboard or too CMM2 specific as ports to other *mites are still easy to do.

Vegipete's Maximite Programs, including Akalabeth
Visit Vegipete's *Mite Library for cool programs.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5695
Posted: 10:44pm 30 Dec 2021
Copy link to clipboard 
Print this post

It would be rather nice to keep the "flavour" of the original, even if some modern touches were to be added. I'm not in favour of a mouse as that's very CMM2-specific (unless it can be easily bypassed anyway). It would be an anachronism almost as bad as playing it with a nunchuk!
Edited 2021-12-31 08:46 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 12:05am 03 Jan 2022
Copy link to clipboard 
Print this post

I've posted an update with some bug fixes and a wider field of view. Enjoy.

Also, here is quick experiment ...


The Next Step
Visit Vegipete's *Mite Library for cool programs.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3826
Posted: 11:10am 04 Jan 2022
Copy link to clipboard 
Print this post

  vegipete said  The Next Step


That's very neat, have you got actual Ultima 1 source, or is it a "workalike" ?

Best wishes,

Tom
Edited 2022-01-04 21:10 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
     Page 1 of 2    
Print this page
© JAQ Software 2024