Level Viewer for KEEN VORTICONS and GALAXY (and more...)

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
Fleexy
Tool Smith
Posts: 1432
Joined: Fri Dec 12, 2008 1:21
Location: Abiathar C&C

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by Fleexy »

Here's a PowerShell script that clips the 32-pixel-wide borders off all PNG files in the current folder:

Code: Select all

Add-Type -AssemblyName System.Drawing
gci *.png | % {
 $img = [System.Drawing.Bitmap]::FromFile($_.FullName)
 $clipped = [System.Drawing.Bitmap]::new($img.Width - 64, $img.Height - 64)
 $g = [System.Drawing.Graphics]::FromImage($clipped)
 $srcrect = [System.Drawing.Rectangle]::new(32, 32, $clipped.Width, $clipped.Height)
 $g.DrawImage($img, 0, 0, $srcrect, 'Pixel')
 $g.Dispose()
 $clipped.Save($_.FullName.Replace('.png', '-clip.png'), 'Png')
}
You can paste all of that right into the PowerShell console. For purposes of getting to the right folder, the "cd" command works exactly as you'd expect.
User avatar
Nisaba
Janitress
Posts: 1597
Joined: Fri Jan 01, 2016 23:34
Location: The Outpost
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by Nisaba »

@Fleexy splendid! gonna batch it for the ease of use.
out now (link) : Image
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by K1n9_Duk3 »

Nisaba wrote: Sun Feb 19, 2017 23:19 it seems to me that the VorticonsViewer v.1.3 stopped displaying the level title in the window-manager header...
Yeah, the BlitzMax libraries won't let me change the title of the main window after it is created, so I wouldn't be able to change the title (without having to close the window each time). Version 1.0 was able to display the level file name because you couldn't change the level while the program was running.
Quinton wrote: Mon Feb 20, 2017 0:35The only thing I think it could need is a way to remove the borders when exporting them (so people wouldn't have to do it manually), but that's just a minor thing.
It would have been possible to do that, but since the viewer has to support multiple games, I decided against it. Some games (Shadow Knights and maybe Dave 2) use "holes" in the border to indicate where the player can leave the level. In Rescue Rover, the border is only 1 tile (but still 32 pixels), and DDICI, Slordax and Hovertank don't even have a border.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Quillax
Vorticon Elite
Posts: 554
Joined: Sat Mar 14, 2015 14:41
Location: Quillax Ship
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by Quillax »

I used this for many other mods, and it's still working pretty great, although I did come across a few issues. Here's a list of them (along with a couple suggestions):
  • Some Vorticons levels don't seem to really like VorticonView. When I open those, the program says the level is in an unknown format, and then closes. This includes most levels from The Fastest Gun in the Universe, some levels from IceKeen, some levels from the Keen 1 Level Competition Level Pack, and some levels from the Keen 2 Level Competition Level Pack.
  • A few Vorticons levels seem to be missing some sprites when viewed with VorticonView. This includes the secret level (level 14) of Tom Bailey's 1st Levelpack (Keen and many Gargs are missing) and the level in Airefresco's Keen 2 Levelpack (the bottom-left corner of the map is missing Keen and many enemies).
  • I tried to open Keen 59 with GalaxyView, but while the levels loaded quite well, the graphics loaded as gibberish. I'm assuming that this might have to do with the file size of the EGA files of the mod.
  • It'd be nice if transparent graphics were viewed like how they are in-game, rather than just not being seen. For an example, the Slops from Keen 58 are just seen as a black outline in GalaxyView, although they are seen with green on their inside in-game.
  • Since the palette in Vorticons and Galaxy mods can be changed, it'd be great to at least have the ability to make the level viewers display different color palettes.
Quillax Ship - Where you can download all of my cool, keen mods and super-marvelous fangames!
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by K1n9_Duk3 »

Thanks for the kind word. It's good to hear that I wasn't just wasting my time when I wrote these programs.

I'm not too much into Keen mods (especially not Keen 1-3 mods) myself, so that's probably why there are some issues regarding mod support. Just keep in mind that mods using CKPATCH or hacked executables could change pretty much every aspect of the game. This means making sure that my tools support every mod ever made would be a huge amount of work, so that's most definitely not going to happen.

It would have been nice if you had included a few screenshots to show the actual issue (not error messages, but for things like "missing" sprites, it would be nice to have a screenshot of the level viewer and another screenshot directly from the game for comparison). And it would also be nice if you could include download links for the mods you mentioned. I was able to find the mods on the Keenwiki, but I'm not sure if they are identical to the files you were using.
  • I'll look into the "unknown format" issues. I'll be use the "Fastest Gun in the Universe" mod for testing, but I noticed the mod uses some low-level patches. I don't know if the patches change the way the game reads the level files, but if they do, there probably won't be any support for this in the viewer.
  • I had a look at Airefresco's Keen 2 Levelpack and the viewer seems to be displaying the sprites at the same position as the number icons (when sprites are disabled), so this issue might be related to the level fomat itself, like the previous one.
  • The automatic chunk type detection appears to fail for Episode 59's EGAGRAPH file. This is the first time I've seen this happening. Passing the correct values via a GFXINFOE.CK4 file or a modified GalaxyView.ini might fix this.
  • The "fake transparency" effect only works properly with the EGA tile drawing routines used by the game. Since the level viewers draw the tiles using the OpenGL or Direct3D API, it is pretty much impossible to draw the tiles exactly like they would appear in the game. But it would be possible to make the "transparent" parts visible in the viewer by using other features of the API such as alpha blending.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
KeenRush
Android Dummy
Posts: 2560
Joined: Sat Oct 27, 2007 20:57
Location: KEEN1.EXE
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by KeenRush »

Hi, just noticed this convo by accident. Due to a bug in akeen 0.1 (the first version), levels saved in that editor aren't supported by most - if any - other Keen editors (akeen 0.1 was used to make The Fastest Gun In The Universe). Except for the old KeenEdit for DOS, if I remember correctly. The game, however, reads the levels perfectly. Any bugs went unnoticed for a while because despite using and testing the level editor extensively (I made at least two level packs and one full mod before noticing it), the actual game never had any problems with my levels, everything was always in game just as displayed in my editor, so I never encountered the problem. I can't remember what the bug was; I simply wrote the entire level-write operation again while perusing the level format more carefully, and then other editors began making sense of my levels.

However, I'm not the only one to have made some mistake. I've encountered at least one level that wasn't made in my editor but would not open correctly in my editor but would show up correctly in Keen. :p I think they did the same mistake I did with akeen 0.1 -- whatever that mistake was.
My newest mod - Commander Keen: Sunset: viewtopic.php?t=8568 | codename H.Y.E.N.A.
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by K1n9_Duk3 »

Update:
galaxyview_17.zip
vorticonview_14.zip
KeenRush wrote: Thu Jun 08, 2017 7:36However, I'm not the only one to have made some mistake.
Yeah, I have to admit that my RLEW routines had a bug. It didn't handle run lengths of 0 correcty (which are completely useless and shouldn't be in the level data to begin with IMHO). This RLEW bug was responsible for the missing sprites and icons.

The "unknown format" issue was caused by either too few or too many bytes in the RLEW encoded level data. This prevented the level viewer from detecting the compression type correctly (Dangerous Dave in Copyright Infringement uses the uncompressed version of the level format, all the other games use RLEW compression). I have improved my compression detection code and also added an option to open the level anyway when the detection fails.

The garbage graphics in Episode 59 were caused by the EGADICT.CK4 file that comes with the mod. The mod doesn't use this file, it uses the one in KEEN4E.EXE instead. Simply remove or rename the file and the level viewer works perfectly fine.

The new version of the Keen: Galaxy level viewer adds support for semi-transparent tiles and sprites. In the editor, they are displayed using alpha blending, which means the graphics will not look like they would in the game. But in the images exported with F3 (or CTRL+F3), the graphics should look exactly like they would in the game.

I missed Quillax's point about palettes earlier. At least in the Keen: Galaxy viewer, you can change the palette by modifying the settings in the INI file. Just have a look at the Rescue Rover 2 settings to see how this is done in the INI. In Keen: Vorticons, the palettes are hard coded. Maybe later versions will allow you to change the palette via the INI file as well.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Levellass
S-Triazine
Posts: 5265
Joined: Tue Sep 23, 2008 6:40

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by Levellass »

K1n9_Duk3 wrote: Fri Jun 09, 2017 0:47 Yeah, I have to admit that my RLEW routines had a bug. It didn't handle run lengths of 0 correcty (which are completely useless and shouldn't be in the level data to begin with IMHO). This RLEW bug was responsible for the missing sprites and icons.
If it's useless, pointless, should never, EVER be stumbled across... but is still possible in any way, you WILL have to deal with it, it's an iron law of programming.
What you really need, not what you think you ought to want.
User avatar
Nisaba
Janitress
Posts: 1597
Joined: Fri Jan 01, 2016 23:34
Location: The Outpost
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by Nisaba »

K1n9_Duk3 wrote: Fri Jun 09, 2017 0:47
@K1n9_Duk3
TLDR: missing sprites-layer

I'd like to ask for tool support, in order to extract the Suburb Shenanigans' level images. When I run GalaxyView I get this log file:

Code: Select all

...
GAMEMAPS file is Z:/games/keen/Suburb_Shenanigans/GAMEMAPS.CK5"
GAMEMAPS header is "TOMv1.0 "
EGA graphics found.

Trying EGA Graphics...
Couldn't find "EGADICT.CK5"
Couldn't find "MAPDICT.CK5" (most games don't need this file)
Couldn't find "GFXINFOE.CK5"
Gotta find the right EXE now...
Looking for executables in "Z:/games/keen/Suburb_Shenanigans/"...
Trying "Z:/games/keen/Suburb_Shenanigans/CK5PATCH.EXE" (18320 bytes) ... unknown.
Trying "Z:/games/keen/Suburb_Shenanigans/KEEN5E.EXE" (266032 bytes) ... unknown.
MAPHEAD was NOT loaded!
Looking for executables in "Z:/games/keen/Suburb_Shenanigans/"...

File "CK5PATCH.EXE" has a size of 18320 bytes.

File "KEEN5E.EXE" has a size of 266032 bytes.
This might be the start of a MAPHEAD: 165200
This might be the start of a a DICT: 232068
This might be the start of a a DICT: 233092
looking at the log file I decided to add an EGADICT.CK4 file to the folder and repeated the process. this time around I was able to open all level images. your program gives me a background-, foreground- and tileinfo-layer. Unfortunately it doesn't provide a sprites-layer as well. I suspect that I need to add either a "MAPDICT.CK5" or a "GFXINFOE.CK5" as well... but to be honest, I have no idea. so I hope you can help me with this issue.
out now (link) : Image
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by K1n9_Duk3 »

Nisaba wrote: Tue Jan 01, 2019 15:46I'd like to ask for tool support, in order to extract the Suburb Shenanigans' level images.
The problem seems to be that you have an "unknown" version of KEEN5E.EXE in your folder. Sprite display is only supported for "known" versions or games that provide their own sprite definitions in a SPRITES.INI file in the game folder. Your uncompressed KEEN5E.EXE is 266032 bytes, but I think it should be 266096 bytes for Keen 5 EGA v1.4 (Apogee release). Maybe the file you're using was decompressed by a program other than UnLZEXE 0.8, which means the EXE header is slightly different and therefore the file has a different size and all the offsets are different. Try putting the original (lzexe-compressed) KEEN5E.EXE in the folder.

I wrote this level viewer before I learned how the EXE header for 16-bit MS-DOS executable works, which is why the viewer has these problems.

But you should know that the sprite display probably won't be usable anyway, depending on how many aspects of the game were changed by patches. To get anything usable out of it, you would probably need to write your own sprite definitions for the mod. You can do that by creating a file named SPRITES.INI in the game folder(!) and copying the entries from the [SPRITES_KEEN5] section of GalaxyView.ini into a section named [SPRITES] in the new file. This will override the sprite definition found in GalaxyView.ini and it will allow the sprite display to work even if the viewer does not recognize the executable (assuming that all the vital files, including EGADICT, can be found in the game folder).
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Nisaba
Janitress
Posts: 1597
Joined: Fri Jan 01, 2016 23:34
Location: The Outpost
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by Nisaba »

K1n9_Duk3 wrote: Tue Jan 01, 2019 21:46The problem seems to be that you have an "unknown" version of KEEN5E.EXE in your folder. [...]
Success! the correct 266096 bytes KEEN5E.EXE executable did the job!
thanks for the support. now I can update the wiki with some fresh images!
out now (link) : Image
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by K1n9_Duk3 »

I just wanted to let you know that I uploaded updeted versions of my level viewers for Keen: Vorticons and Keen: Galaxy.

The main feature found in both viewers is that you can now use the + and - keys on the num block to zoom in and out instead of being limited to 1x, 2x, 3x and 4x zoom level via the function keys F4 to F8.

GalaxyView also got a few additional features, like listing the total amount of points in a level/all levels, more sprite definitions etc.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Nisaba
Janitress
Posts: 1597
Joined: Fri Jan 01, 2016 23:34
Location: The Outpost
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by Nisaba »

This is great! Thanks a lot for the update.
As you all might already know, amongst others I am taking care of wiki related stuff like adding and updating level graphics. Without any doubt Galaxy-View and Vorticon-View make life so much easier. Both tools simplify an otherwise needlessly complicated job.
It is great so see the new point counting feature. This gonna be very usefull. Thanks for that! Gotta check out the other new features as well
out now (link) : Image
User avatar
Quillax
Vorticon Elite
Posts: 554
Joined: Sat Mar 14, 2015 14:41
Location: Quillax Ship
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by Quillax »

I've been getting the missing sprites layer problem with Was I No Net, even with the latest version of GalaxyView. Here's the log file that got generated last time I opened up the mod's files:

Code: Select all

GAMEMAPS file is "C:\KeenMods\l.darkdave1985.was_i_no_net.k4.2018-08-06\GAMEMAPS.CK4"
GAMEMAPS header is " FLEEXY "
EGA graphics found.

Trying EGA Graphics...
Couldn't find "MAPDICT.CK4" (most games don't need this file)

Graphics Reader initialization:
===============================

Chunks total: 4752
Tiles appear to start at chunk 521 (0x0209) and end at chunk 4735 (0x127F)

Tile values from GFXINFO appear to be correct:
  tile_8_count = 104
  tile_8_start = 521
  tile_8M_count = 20
  tile_8M_start = 522
  tile_16_count = 1296
  tile_16_start = 523
  tile_16M_count = 2916
  tile_16M_start = 1819
  tile_32_count = 0
  tile_32_start = 4735
  tile_32M_count = 0
  tile_32M_start = 4735

Fonts appear to start at chunk 3 (3 fonts total)

Pic values from GFXINFO appear to be correct:
  numpics   = 115
  offpic    = 6
  offpicstr = 0
Reading Pic info from chunk 0

PicM values from GFXINFO appear to be correct:
  numpicm    = 3
  offpicm    = 121
  offpicmstr = 1
Reading PicM info from chunk 1

Sprite values from GFXINFO appear to be correct:
  numsprites = 397
  offsprites = 124
  offsprstr  = 2
Reading Sprite info from chunk 2

MAPHEAD says:
RLEW flag: $ABCD
Map 0 starts at position $00002E09
Map 1 starts at position $00008179
Map 2 starts at position $0000B941
Map 3 starts at position $0000EA39
Map 4 starts at position $00019977
Map 5 starts at position $000215D3
Map 6 starts at position $000287B1
Map 7 starts at position $0002A867
Map 8 starts at position $0002E63B
Map 9 starts at position $00031CF3
Map 10 starts at position $0003531D
Map 11 starts at position $0003BAE7
Map 12 starts at position $00042DC3
Map 13 starts at position $0004A99D
Map 14 starts at position $00050F4B
Map 15 starts at position $00057EFD
Map 16 starts at position $0005B1EF
Map 17 starts at position $00063F83
Map 18 starts at position $0006435D
Map 19 starts at position $00064681

Reading map entry 0 from "C:\KeenMods\l.darkdave1985.was_i_no_net.k4.2018-08-06\GAMEMAPS.CK4"...
Plane 0 Offset: $00000009
Plane 1 Offset: $00001993
Plane 2 Offset: $00002B9F
Plane 0 Size: 6538
Plane 1 Size: 4620
Plane 2 Size: 618
Map Width: 61
Map Height: 66
Map Name: ShadowLands
Reading plane 0...
un-carmackized size: 6536 bytes
un-carmackizing took 0 ms.
un-RLEW'd size: 8052 bytes
Reading plane 1...
un-carmackized size: 4618 bytes
un-carmackizing took 0 ms.
un-RLEW'd size: 8052 bytes
Reading plane 2...
un-carmackized size: 616 bytes
un-carmackizing took 0 ms.
un-RLEW'd size: 8052 bytes
Done. Map is loaded.

Trying to read tile graphics... done.

Preparing sprite display...
Sprite section = DEFAULT_SPRITES.CK4

Reading map entry 1 from "C:\KeenMods\l.darkdave1985.was_i_no_net.k4.2018-08-06\GAMEMAPS.CK4"...
Plane 0 Offset: $00002E33
Plane 1 Offset: $00005359
Plane 2 Offset: $00007DB1
Plane 0 Size: 9510
Plane 1 Size: 10840
Plane 2 Size: 968
Map Width: 70
Map Height: 86
Map Name: WAS I NO NET
Reading plane 0...
un-carmackized size: 9508 bytes
un-carmackizing took 1 ms.
un-RLEW'd size: 12040 bytes
Reading plane 1...
un-carmackized size: 10838 bytes
un-carmackizing took 2 ms.
un-RLEW'd size: 12040 bytes
Reading plane 2...
un-carmackized size: 966 bytes
un-carmackizing took 1 ms.
un-RLEW'd size: 12040 bytes
Done. Map is loaded.
If I open the mod's GAMEMAPS.CK4 with GalaxyView 1.7, I get a warning telling me that it's not a valid GAMEMAPS file, although it lets me proceed and shows the background, foreground, and infoplane layers but not sprites. GalaxyView 1.8 doesn't give any messages, but it still can't display the sprites. I quick tried GalaxyView 1.8 with Atroxian Realm and The Sunnylands and the sprites displayed just fine with those mods.

I once used Abiathar's level export feature with the mod's level, and then imported it into a clean copy of Keen 4 (with the maphead.ck4 file that came with The Omegamatic). Yet, GalaxyView is again unable to display the level's sprites, so there seems to be a problem with the level itself.

On an unrelated note...
K1n9_Duk3 wrote: Fri Jun 09, 2017 0:47 The new version of the Keen: Galaxy level viewer adds support for semi-transparent tiles and sprites. In the editor, they are displayed using alpha blending, which means the graphics will not look like they would in the game. But in the images exported with F3 (or CTRL+F3), the graphics should look exactly like they would in the game.
Are there any plans of adding this support to VorticonView as well? It'd be great for making the Maltimers from The Mortrix display properly, for one. (Example of how they look in a VorticonView-exported map vs. example of how they look in-game.)
Quillax Ship - Where you can download all of my cool, keen mods and super-marvelous fangames!
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Level Viewer for KEEN VORTICONS and GALAXY (and more...)

Post by K1n9_Duk3 »

Quillax wrote: Mon Jan 29, 2024 8:22 I've been getting the missing sprites layer problem
I was aware of the missing sprites problem in GalaxyView and I fixed that problem a while ago, but I haven't had an opportunity to upload a new version.

If you look at your v1.8 log file carefully, you'll see that it says "Sprite section = DEFAULT_SPRITES.CK4", but such a section does not exist in GalaxyView.ini! If you open the GAMEMAPS.CK4 file from an unmodded version of Keen 4 in GalaxyView, your log file should say "Sprite section = SPRITES_KEEN4", and the GalaxyView.ini file does indeed contain a section named SPRITES_KEEN4.

There are multiple ways to fix the missing sprites problem in GalaxyView v1.8 without having to wait for an updated version:

1. Delete or rename the GFXINFOE.CK4 file.

2. Edit GalaxyView.ini and do some Search & Replace. Search for SPRITES_KEEN4 and replace it with DEFAULT_SPRITES.CK4 (make sure you do not replace SPRITES_KEEN4_DEMO). You can do the same for Keen 5 (replace SPRITES_KEEN5 with DEFAULT_SPRITES.CK5) and Keen 6 (replace SPRITES_KEEN6 with DEFAULT_SPRITES.CK6) if you want.

The first option is easy, but you will need to do this for every mod. The second option is a permanent solution.

The reason why GalaxyView v1.8 uses the "wrong" sprite section for the mod you're trying to view is that GalaxyView found all the essential data files in the mod's folder (EGADICT, EGAHEAD, GFXINFOE, MAPHEAD) and therefore didn't need to look up the game's executable and extract the missing data from the executable (or the executable's section in the INI file for the GFXINFO values). That's why it uses the default sprite section ("DEFAULT_SPRITES.CK4" in GalaxyView v1.8, "" in earlier versions) instead of the one that's used for the supported versions of Keen 4 listed in the INI file.

---

The next version of VorticonView will support semi-transparent sprite images the same way GalaxyView does. It will also support most "Extended" Vorticons mods - including that semi-broken mess called PRELUDE - and introduce a few other neat new features.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
Post Reply