Keen 1 Randomiser [v1.1 now out!]

Here is where to post about the latest Commander Keen fangame or modification you've finished, a new website you've made, or another Keen-related creation.
User avatar
Multimania
Vortininja
Posts: 84
Joined: Sat Nov 10, 2007 8:10
Location: Hiding in a small, cramped corner of the BwB megarocket.
Contact:

Keen 1 Randomiser [v1.1 now out!]

Post by Multimania »

It's been 30 years :birthday since Keen 1 came out, so most of us have worked out where all of those pesky spaceship parts are hiding on Mars. So to shake things up a bit, here's the Keen 1 Randomiser: a program which shuffles various items, levels, etc. in Keen 1 around. Hopefully this'll give people a chance to spend some more time exploring levels that normally get skipped, and cursing how difficult it is to find the Pogo Stick now!

Homepage: https://davidgow.net/keen/randomiser.html
Download (v1.1): https://davidgow.net/files/rndkeen11.zip
Source Code: https://github.com/sulix/randkeen

To use it, just download it (Keen 1 is included), and run RNDKEEN1.BAT. You'll get a slightly different game every time:
  • Level entrances are shuffled: you have no idea what level you're about to play.
  • The spaceship parts (and pogo stick) could now be in any level.
  • Lollies (point items) are shuffled within a level.
  • A couple of other minor cosmetic differences.
  • Don't worry, the Yorp statues will give you some useful hints about where things are.
If you want to play the same randomised game again (or have a race on the same version), you can use the /SEED <seed> command line parameter to play a particular numbered seed. (You can check which seed you're playing from the status screen: it replaces the "EXTRA KEEN AT" screen.)

There's some more info in the README file and on the website. Note that it's compiled with DJGPP, so will need at least a 386 to run. (DOSBox works fine, too.)

Please give it a go, and hopefully see Keen 1 in a whole new light (i.e., without the Pogo for half the time, and never having enough ammo! :crazy )

Edit: Updated the link to version 1.0a: see this follow-up post.
Edit 2/3: Updated the link to version 1.0b, then 1.0c: see this follow-up post.
Edit 4: Version 1.1 is now out: see this follow-up post.
Last edited by Multimania on Sun Mar 14, 2021 6:59, edited 4 times in total.
User avatar
Roobar
Vorticon Elite
Posts: 3267
Joined: Tue Jan 08, 2008 16:12
Contact:

Re: Keen 1 Randomiser

Post by Roobar »

That's interesting! I begun right with the secret level, but without ammo or pogo. I was not able to beat the first level that way though.
User avatar
Nisaba
Janitress
Posts: 1597
Joined: Fri Jan 01, 2016 23:34
Location: The Outpost
Contact:

Re: Keen 1 Randomiser

Post by Nisaba »

yeah!
a Marooned on Mars radomiser! I love that idea. Can we use this mechanic for other Vorticon games and mods as well?

but Roobar is right. We need some mechanic to make sure that you can access the Pogo right away. other than that this is a really neat idea. this might rules out every levelpack we have seen so far
out now (link) : Image
User avatar
Quillax
Vorticon Elite
Posts: 554
Joined: Sat Mar 14, 2015 14:41
Location: Quillax Ship
Contact:

Re: Keen 1 Randomiser

Post by Quillax »

Oh wow, this sounds really cool! I'll have to try it out someday! I like how the website looks!

Roobar, what area were you having trouble with? From what I looked in the map, it seems that all of Secret City can be accessed without the pogo (and ammo if you lure some of the Yorps and Gargs away cleverly).
Quillax Ship - Where you can download all of my cool, keen mods and super-marvelous fangames!
NY00123
Vorticon Elite
Posts: 508
Joined: Sun Sep 06, 2009 19:36

Re: Keen 1 Randomiser

Post by NY00123 »

That's been unexpected! On the other hand, it feels appropriate for Keen 1's 30th anniversary.

I gave this a couple of tries. It first used seed 2079. As in the case of Roobar, I started right in the secret level. I couldn't progress much further from the starting point, due to the lack of ammo and a garg on the (only) way forward.

My second attempt, this time with seed 1952, was more successful. It was indeed different to spot instances of re-positioned creatures, mostly the vorticons. I even spotted recolored bricks in Capital City.

One thing I couldn't reliably do, was reaching the secret level teleporter. Reason is that there was a garg, rather than a tank robot. Maybe the chances the garg won't reach Keen for enough time aren't exactly zero, although they're probably still low.

The last level I visited was where the Second Ice Shrine is usually located i.e., to the right of the usual location of the Vorticon Commander's Castle. It was a different Shrine level, and as things turned out, it had the last part required for the ship (IIRC it was a joystick).

Thus, I technically completed all levels, except for where the Secret City and the Vorticon Commander's Castle are usually located.

Let's see if this will bring an inspiration in the future.
User avatar
Multimania
Vortininja
Posts: 84
Joined: Sat Nov 10, 2007 8:10
Location: Hiding in a small, cramped corner of the BwB megarocket.
Contact:

Re: Keen 1 Randomiser

Post by Multimania »

Glad people have found it interesting. I was largely inspired by the A Link to the Past Randomizer, which shuffles the contents of the various chests in the game. Keen is somewhat less complicated, fortunately, though I'm sure there's a lot more you could do.

I've uploaded a new version (v1.0a) of the randomiser, which adds some options to make it a bit easier. I still think it should be possible to play through a lot of the game without the pogo, but it's certainly a bit more fun to get it sooner. To wit, there are a few different options to choose from:
  • /NOENEMYSHUFFLE — disable the randomising of enemy locations. This should make the in-level teleporter and similar easier to access.
  • /STARTPOGO — always start with the Pogo Stick.
  • /STARTAMMO n — start with n ammo.
  • /EXTRAPOGO n — hide [n] extra Pogo Sticks throughout the game. (They'll still be at the end of levels, though.)
These can be combined. Note that they might change what seed is what: so for the seeds to mean the same thing, you need to use the same options.

Personally, I'm finding that adding between 6 and 12 /EXTRAPOGOs gets me a Pogo Stick earlier, but not instantly, and combined with /STARTAMMO 15 early enemies aren't much of a problem. There are still a couple of things (like the secret level teleporter) that /NOENEMYSHUFFLE is needed to make possible. I'd be curious to see what — if any — of those options are most fun for people.

Of course, if it's too hard, you can just run again with a different seed until you find one you like. Ideally, all seeds would be possible, though, so a future version will have to find other ways around the problems.

As for running it against other Vorticons games / mods: it should be possible to get it to work, but there are a lot of hardcoded tile numbers for things. The real problem is that Keen 2 & 3 don't have the ship parts, and moving the mangling machine or the tantalus rays around is both harder and less fun to play. I'm sure it wouldn't be too hard to get it to work with Keen 1 mods which don't use tileinfo, though.
User avatar
Nisaba
Janitress
Posts: 1597
Joined: Fri Jan 01, 2016 23:34
Location: The Outpost
Contact:

Re: Keen 1 Randomiser

Post by Nisaba »

immediate tool support.
that's awesome! thanks so much for the update
out now (link) : Image
User avatar
KeenRush
Android Dummy
Posts: 2560
Joined: Sat Oct 27, 2007 20:57
Location: KEEN1.EXE
Contact:

Re: Keen 1 Randomiser

Post by KeenRush »

It's a nice idea -- I've seen these for some more popular old games like Mario 64 but never thought that Keen could have one as well.

It feels kind of strange to open a level and suddenly not find the one you've known to be there for about 30 years... :dopekeen Or seeing the color of something being different than you were quite sure it was...

One improvement which might be fairly easy to do would be hard-coded random placements for keycards. Here's how I would do it (the simplest way I can think right now): For every keycard color assign a value not used by another tile (such as 650, 651 etc -- although I'm too lazy to check those specific ones aren't unused, but near the end of tileset there are many). Then, for every original level (manually): Replace a card tile with the tile assigned to it. Then move around randomly and place that same tile (like 650) around the level in logical places -- ie, areas accessible with the same cards than the card one is replacing, so that the card can be accessed even if it's in a different place; for instance, for a yellow key that needs to be collected before a red key, place the yellow tile indicators only in areas that can be accessed without that other key. And of course so that the key isn't placed above a row of fire tiles in a way that it's impossible to get it. And so on. Then modify the randomizer program to scan the level, list all tiles of 650, replace one of them with yellow key card and all the other instances with the blank background tile, and do the same for the other color keys. Now the created levels should have semi-random positions for cards. Since most of the background tiles are gray, there are many many potential locations for cards. I think something like this should be done, would be cool!
Edit: I realized that of course in this case one could just use the original card tiles as card indicators, no need to use unused tiles, simply place many card tiles of the same color and make the program replace all but one of them with the blank tiles.
My newest mod - Commander Keen: Sunset: viewtopic.php?t=8568 | codename H.Y.E.N.A.
User avatar
TheBigV
Vortininja
Posts: 63
Joined: Mon Oct 21, 2019 13:43
Location: LXTerminal
Contact:

Re: Keen 1 Randomiser

Post by TheBigV »

I'd like to report an issue. When you die on a level that originally had a ship part, you will lose the ship part that level used to have even if that ship part is now on different level. That can make a game unwinnable if the player isn't careful.

I suggest you could either make it add a patch to not remove the ship parts (since it's hard to die after getting them anyways), or make it add a patch to correct which levels take which parts.

Also, I tried seed 314 and it was unwinnable because it started on a level that required a pogo. (Note that I did this before the 1.0a update came out.)
User avatar
Multimania
Vortininja
Posts: 84
Joined: Sat Nov 10, 2007 8:10
Location: Hiding in a small, cramped corner of the BwB megarocket.
Contact:

Re: Keen 1 Randomiser

Post by Multimania »

KeenRush wrote: Tue Dec 15, 2020 10:09 One improvement which might be fairly easy to do would be hard-coded random placements for keycards. Here's how I would do it (the simplest way I can think right now): For every keycard color assign a value not used by another tile (such as 650, 651 etc -- although I'm too lazy to check those specific ones aren't unused, but near the end of tileset there are many). Then, for every original level (manually): Replace a card tile with the tile assigned to it. Then move around randomly and place that same tile (like 650) around the level in logical places -- ie, areas accessible with the same cards than the card one is replacing, so that the card can be accessed even if it's in a different place; for instance, for a yellow key that needs to be collected before a red key, place the yellow tile indicators only in areas that can be accessed without that other key. And of course so that the key isn't placed above a row of fire tiles in a way that it's impossible to get it. And so on. Then modify the randomizer program to scan the level, list all tiles of 650, replace one of them with yellow key card and all the other instances with the blank background tile, and do the same for the other color keys. Now the created levels should have semi-random positions for cards. Since most of the background tiles are gray, there are many many potential locations for cards. I think something like this should be done, would be cool!
I had an idea for doing something like this, but was going to hardcode rectangles of "okay positions" and randomise all items (points, keys, etc) within the same area. I like your idea much better though: it's simpler and more flexible, and probably will create cooler-looking results. I'll have to experiment with it a bit.
TheBigV wrote: Tue Dec 15, 2020 22:01 I'd like to report an issue. When you die on a level that originally had a ship part, you will lose the ship part that level used to have even if that ship part is now on different level. That can make a game unwinnable if the player isn't careful.

I suggest you could either make it add a patch to not remove the ship parts (since it's hard to die after getting them anyways), or make it add a patch to correct which levels take which parts.
Okay, so version 1.0c is now out, which fixes the first issue (as well as a couple of other bugs). The ship part is now removed only if Keen dies in the correct level. (This was actually slightly trickier than it should have been, because it's technically possible for there to be multiple ship parts in the same level.)
TheBigV wrote: Tue Dec 15, 2020 22:01 Also, I tried seed 314 and it was unwinnable because it started on a level that required a pogo. (Note that I did this before the 1.0a update came out.)
Darn — I'd naïvely assumed that all levels except 16 were completable without a Pogo (and that has a Pogo in it, so should be fine.) But no matter how many times I tried, that jump in the right-hand side of level 15 eluded me. Maybe that's something to fix in the level (by shrinking the fire, or giving more headroom for the jump), or maybe it's worth reworking the randomiser to avoid putting that level before the Pogo is accessible. I suspect the former would be more fun — it _looks_ like that level should be completable without the Pogo, but it is less of a "pure randomiser" if I fiddle with the levels too much.


Anyway, the changes for v1.0b are basically all bugfixes:
  • Spaceship parts are no longer lost if Keen dies in the level they were originally found in.
  • Yorp statue messages about level locations are no-longer backwards.
  • The RNDKEEN1.BAT file now uses MS-DOS line endings, so will work on real MS-DOS machines. (DOSBox handled the UNIX newlines fine.)
  • The in-game random number generator is now seeded with a value derived from the randomiser seed. (This means that enemy behaviour, et al, is technically deterministic with the same seed now, but probably won't cause any player-visible changes.)
v1.0c fixes another bug in the spaceship part removal.

You can download it here:
https://davidgow.net/files/rndkeen1c.zip

Edit: Replaced 1.0b with 1.0c. You can still download v1.0b here if you like bugs for some reason.
shikadi
Vorticon Elite
Posts: 449
Joined: Sat Feb 09, 2008 21:13
Location: Belgium

Re: Keen 1 Randomiser

Post by shikadi »

Maybe a stupid question, but how do I setup DJGPP so that I can use it to compile this from the source code to work in dosbox?
nothing usefull here
User avatar
Multimania
Vortininja
Posts: 84
Joined: Sat Nov 10, 2007 8:10
Location: Hiding in a small, cramped corner of the BwB megarocket.
Contact:

Re: Keen 1 Randomiser

Post by Multimania »

Exactly how you set up djgpp will depend on what OS you're running (and how many development tools you want to install).

I'm running Linux and using djgpp as a cross-compiler. There used to be djgpp packages in the debian/ubuntu repositories, but I think they've gone now. The build-djgpp project has scripts which will download and compile djgpp, as well as some pre-built packages for most OSes. So you could grab the mingw32-standalone versions for windows, and that should work as well.

Otherwise, you can get the DOS version of djgpp from the djgpp website. It's a bit of a pain to set up, as it involves downloading a bunch of files, unzipping them together (e.g. in C:\djgpp), and setting the PATH and DJGPP environment variables, e.g.:

Code: Select all

set PATH=C:\DJGPP\BIN;%PATH%
set DJGPP=C:\DJGPP\DJGPP.ENV
The randomiser's code is all in the randkeen.c file, so you just need to run gcc against it:

Code: Select all

gcc -o RANDKEEN.EXE randkeen.c
(If you're running a cross-compiler under Linux, you'll need to put the name of the compiler binary in place of. On my system, it's /usr/local/djgpp/bin/i586-pc-msdosdjgpp-gcc, but you'll just want to put the path to the i586-pc-msdosdjgpp file in, or set your PATH accordingly)

It should be possible to compile it for non-DOS systems as well, but you'll still need DOS to run the game, so unless you really want to debug it with non-DOS debugging tools, it's not really worth it. Similarly, you probably could get the code to compile with other compilers for DOS, though it does use some C99 features, so most older compilers won't handle it.

Hope that helps!
shikadi
Vorticon Elite
Posts: 449
Joined: Sat Feb 09, 2008 21:13
Location: Belgium

Re: Keen 1 Randomiser

Post by shikadi »

Multimania wrote: Wed Mar 03, 2021 7:32 Hope that helps!
You definitely did. The prebuilt mingw package did succeed in compiling the randomkeen.c. Thank you.
nothing usefull here
User avatar
Multimania
Vortininja
Posts: 84
Joined: Sat Nov 10, 2007 8:10
Location: Hiding in a small, cramped corner of the BwB megarocket.
Contact:

Re: Keen 1 Randomiser

Post by Multimania »

I've just uploaded version 1.1 of the Keen 1 Randomiser.

The big change is that the spaceship parts (and the pogo stick), as well as keycards, are now spread throughout each level. This is based on the technique that KeenRush mentioned above: there are custom maps which have several joysticks (or keycards), and remove all but one of them.

To make it harder to get stuck by not collecting an item before exiting the level, the exit door won't work until you've collected the item in a particular level.

There are also some changes to the main menu, and a fix for a Yorp statue text bug.

Happy Keen Day!
User avatar
Quillax
Vorticon Elite
Posts: 554
Joined: Sat Mar 14, 2015 14:41
Location: Quillax Ship
Contact:

Re: Keen 1 Randomiser [v1.1 now out!]

Post by Quillax »

This now has a KeenWiki article!

I wasn't sure if it should be a tool or a mod, but I decided to go with tool since I can't figure out a good way to word the article as a mod.

I played this a few times recently, and it's pretty fun! I wonder how easy it would be adapt to Keen 1 mods -- I tried using it with Mort's Rescue. I edited RNDKEEN1.PAT so that it includes patches from the mod, including tile properties, and then ran the patch file with CKPatch. That's because the randomizer will completely overwrite the patch file, so it looks like one would have to modify the source to make it work a Keen mod. It worked fine for the most part, but in a few levels, Keen refuses to go through the exit, even if he already collected the key item. I'm not sure what's going on here -- the ship part tile properties remain the way they are, although Keen now starts with a pogo stick, so maybe that has something to do with it?
Quillax Ship - Where you can download all of my cool, keen mods and super-marvelous fangames!
Post Reply