berusky icon indicating copy to clipboard operation
berusky copied to clipboard

Convert game to Free Hero Mesh

Open zzo38 opened this issue 2 years ago • 2 comments

I had thought to implement this game also in Free Hero Mesh. It should not be too difficult to do, and is the programming language designed specifically for this purpose. Doing so, will have many advantages, including:

  • It is Free Software/Open Source Software.

  • It is a programming language specifically designed for this use, and as far as I can tell (I have used it very often), it does not have a segmentation fault, nor undefined behaviour.

  • You can easily define new classes of objects in the game.

  • It includes automated regression testing; if you modify the game rules you can automatically test that it does not break the working of the existing levels. If you have solutions already recorded, then you can also automatically check that it has been implemented correctly, if all of the recorded solutions are working.

  • Keeps track of which levels you have solved and which are not solved.

  • It will automatically record the moves you make, and you can rewind and replay the moves as often as you want to do it.

  • There is a text-based level import/export format, that you can write other programs to convert levels to/from the Free Hero Mesh, without too much difficulty.

  • Customizable key/mouse bindings.

  • Does not have the other bugs mentioned in this repository (I checked (at least, I checked the ones written in English; some are Czech and I do not know what they mean, so I don't know if it has that bugs or not)).

However, also some possible disadvantage:

  • Does not have Czech code page (code page 852) currently. However, it can be easily added, if you have such a file. (It is my intention to use the proper Czech orthography if you want to write any Czech text. However, it is not needed if you want to write in English; the existing capabilities are suitable for English, already.)

  • Only known to be working on Linux (including Raspberry Pi). Probably it does not work on Windows as it is, but is probably possible to modify to make it work on Windows too, if wanted.

  • All pictures must use a fixed palette of 256 colours; you cannot define your own colours.

  • Does not currently have music. (However, sound effects do work in Free Hero Mesh, already; but music does not work yet.)

  • Animation like Berusky game has insect moving across from one tile to the next one, is not done; an object moves immediately to the next tile (however, animation within a tile is possible).

  • Possibly, other problems that I had not found yet.

zzo38 avatar Jul 05 '22 05:07 zzo38

That's interesting, Thanks. The version here uses English only so Czech should not be an issue. The image sprites are originally created as 256 bmp images and they're using fixed color palette.

stransky avatar Jul 11 '22 07:07 stransky

I wrote a implementation but it is untested so far and may have some mistakes (although I have verified that there is no syntax error):

; Berusky implementation in Free Hero Mesh
; I agree to this code to be public domain.

($Insect
  Player Input
  (Image
    "INSECT1E" "INSECT2E" "INSECT3E" "INSECT4E" "INSECT5E"
    "INSECT1N" "INSECT2N" "INSECT3N" "INSECT4N" "INSECT5N"
    "INSECT1W" "INSECT2W" "INSECT3W" "INSECT4W" "INSECT5W"
    "INSECT1S" "INSECT2S" "INSECT3S" "INSECT4S" "INSECT5S"
  )
  (Strength 1)
  (Climb 5)
  (:select
    Misc1 eq dup =%selected if
      LocateMe
      :pickax %pickax if $Pickax 0 %pickax SetInventory else $Pickax 0 DelInventory then
    then
  )
  (:move %selected if Move if Dir 2 / 5 * Misc1 + =Image then then)
  (INIT Image 5 mod =Misc1)
  ('1 0 =:select)
  ('2 1 =:select)
  ('3 2 =:select)
  ('4 3 =:select)
  ('5 4 =:select)
  ('UP N =:move)
  ('DOWN S =:move)
  ('LEFT W =:move)
  ('RIGHT E =:move)
  (HIT From #TOUCH Dir 0 ,Send)
  (#KEY_ADD %key lnot if 1 =%key $ColorKey Misc1 1 SetInventory 1 then)
  (#KEY_DROP %key if 0 =%key $ColorKey Misc1 DelInventory 1 then)
  (#PICKAX_ADD %pickax 9 lt if %pickax 1 + =%pickax 1 =:pickax then)
  (#PICKAX_DROP %pickax if %pickax 1 - =%pickax 1 =:pickax then)
)

($Floor
  (Image "FLOOR")
  (Density 100)
)

($Wall
  (Image "WALL")
  (Density 1)
  (Height 20)
)

($Exit
  (Image "EXIT" "EXITOK")
  (DefaultImage 0)
  (Density 5)
  (Height 10)
  (#TOUCH Image if WinLevel then)
  (#READY 1 =Image)
)

($Box
  (Image "BOX")
  Shovable
  (Density 5)
  (Height 10)
  (Weight 1)
)

($Bomb
  (Image "BOMB")
  Shovable
  (Density 5)
  (Height 10)
  (Weight 1)
  (HIT From $Box is if From ,Destroy . Destroy . bit15 then)
)

($WhiteKey
  (Image "KEY")
  (Density 5)
  (Height 9)
  (#TOUCH
    @keys 5 lt if
      $WhiteKey 0 @keys 1 + dup =@keys SetInventory
      @keys 5 eq if $Exit #READY 0 0 Broadcast . then
      Destroy . bit15
    then
  )
)

($OnePass
  (Image "ONEPASS")
  (Density 10)
  (Height 2)
  (Departures InPlace)
  (DEPARTED $Wall Loc 0 0 Create . Destroy .)
)

($WhoPass
  (Image "WHOPASS1" "WHOPASS2" "WHOPASS3" "WHOPASS4" "WHOPASS5")
  (Density 10)
  (Height 2)
  (#TOUCH From ,Misc1 Image ne 3 lsh)
)

($ColorKey
  (Image "KEY1" "KEY2" "KEY3" "KEY4" "KEY5")
  (Density 5)
  (Height 9)
  (#TOUCH Image From ,Misc1 eq if From #KEY_ADD 0 0 ,Send if Destroy . bit15 then then)
)

($ColorDoor
  (Image "DOOR1" "DOOR2" "DOOR3" "DOOR4" "DOOR5")
  (Density 5)
  (Height 9)
  (#TOUCH Image From ,Misc1 eq if From #KEY_DROP 0 0 ,Send if Destroy . bit15 then then)
)

($Stone
  (Image "STONE")
  (Density 3)
  (Height 10)
  (#TOUCH From #PICKAX_DROP 0 0 ,Send if Destroy . bit15 then)
)

($Pickax
  (Image "PICKAX")
  (Density 5)
  (Height 9)
  (#TOUCH From #PICKAX_ADD 0 0 ,Send if Destroy . bit15 then)
)

Also, it does not have multiple pictures for each class, but this can be fixed easily. Furthermore, some levels of Berusky have multiple bugs of same colours and only one can be moved; this implementation allows all of them to move simultaneously. It can be changed and other things can be added/improved too; things can also be implemented differently if that is believed to be a better way, too.

Pictures must be in a separate file; this file specifies the names of the pictures that will be used for each class.

zzo38 avatar Jul 12 '22 20:07 zzo38