Keen Game Engine (for lack of a better name): VGA Keen DEMO

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
keenmaster486
Vorticon Elite
Posts: 542
Joined: Sun Mar 20, 2016 18:29
Location: Tranquility Base
Contact:

Post by keenmaster486 »

gridlock wrote:Gamebird composed the track.
Yes, thank you Gamebird for the excellent Atroxian Realm soundtrack!
gridlock wrote:Anyway, I'm intrigued by this engine so far. A lot of people have tried to recreate the Galaxy engine, but I've seen very few attempts that have gotten close. Though this still has a ways to go, I'm hoping you'll succeed. Good luck!
Thank you, sir! I'm working hard at it. I was doing some tests today, and the main problem I'm having is speed. The graphics routines are blazing fast, but QB's math is so darn slow that each if statement gobbles up 2 whole FPS! Arrgh. If I cut out all the logic statements and stick with just the drawing and scrolling stuff, I end up with 80 fps (350 while static!) as opposed to 30. I would use QB 7.1 (apparently it's faster) but DirectQB doesn't work with it. I'd have to crack into the DQB workings and compile it somehow for QB 7.1, and I don't have the knowledge or expertise to do that.

By the way, does anyone have a utility that converts Keen levels from the GAMEMAPS file into individual raw data files? I would like to do that so I can test my engine with the original Keen levels, to better copy the original.
I flermmed the plootash just like you asked.
User avatar
Levellass
S-Triazine
Posts: 5265
Joined: Tue Sep 23, 2008 6:40

Post by Levellass »

Raw data in what form?
What you really need, not what you think you ought to want.
User avatar
Fleexy
Tool Smith
Posts: 1432
Joined: Fri Dec 12, 2008 1:21
Location: Abiathar C&C

Post by Fleexy »

KeenRush's Galaxer1 utility comes with an Abiathar extension called EasyAslev. That extension adds a couple menu items to Abiathar, one of which lets you export the current level as a simple single-level file. Those files consist of the level width, level height, then the background data, foreground data, and infoplane data, with each datum as a UINT16LE. Let me know if you need more info.

Alternatively, it'd be fairly simple to write a PowerShell script that loads FleexCore2, opens the level files, and spits out a file like this for each level in the set.
User avatar
keenmaster486
Vorticon Elite
Posts: 542
Joined: Sun Mar 20, 2016 18:29
Location: Tranquility Base
Contact:

Post by keenmaster486 »

Hmm, so I exported the Shadowlands level to a single file.

It appears to have some kind of header reading "Fleex NGFModShadowLands" or something. Do the level width and height directly follow from that?

I need to know exactly how the data is structured. For instance, this is how I save my level files:

Code: Select all

for j = 0 to width
   for k = 0 to height
      put <which_tile>
   next k
next j
<which_tile> is a decimal number from 0 to <total_#_of_tiles>, encompassing both the background and foreground tilesets (the engine makes no distinction; you can place a background tile in the foreground for instance)

Does the data (for instance, for the background tiles) look like that or something else?

Also I'm having trouble actually reading bytes - I'm not getting what I expect; when I read as 16-bit integers I get large, mostly negative decimal numbers. Is that normal? I know Keen usually reads things as hex, but my system works in decimal. That is, tile number 0 is the upper left of the background tile bitmap, tile number 1 is directly to the right of that, all the way down to the last tile which is at the lower right corner of the foreground tile bitmap.

Here's what I've got so far:

Code: Select all

'Level converter: converts Abiathar single-map files
'into LEVEL##.DAT files for KGE4

CLS

OPEN "shadlnds.map" FOR BINARY AS #1
DIM lx AS INTEGER, ly AS INTEGER

'Skip the header:
FOR i = 1 TO 14
   GET #1, , blah%
NEXT i

'Get the level width and height:
GET #1, , lx
GET #1, , ly

PRINT "Width:" + STR$(lx), "Height:" + STR$(ly)
PRINT "First 20 UINT16's of level data:"

FOR i = 1 TO 20
   GET #1, , byte%
   PRINT byte%
NEXT i

CLOSE
And it outputs this:

Code: Select all

Width: 61     Height: 66
First 20 UINT16's of level data:
-32484 
-32689 
-32768 
-27648 
 9216 
-7743 
-18384 
-1966 
-16640 
 9984 
 2496 
-27416 
 11602 
-30443 
 25286 
-22287 
 31428 
 8251 
 18574 
 29347 
The level width and height are exactly correct, but everything else... I have no idea.
I flermmed the plootash just like you asked.
User avatar
Fleexy
Tool Smith
Posts: 1432
Joined: Fri Dec 12, 2008 1:21
Location: Abiathar C&C

Post by Fleexy »

Ah, it looks like you exported a normal ASLEV. They have a weird format which is designed to save disk space. I should have mentioned that the extension will add an "Export Simple" option, which I think is under the Tools menu. The resulting file will have a much easier format, which is still in binary. Note that the reader should interpret all numbers as positive (unsigned).
User avatar
keenmaster486
Vorticon Elite
Posts: 542
Joined: Sun Mar 20, 2016 18:29
Location: Tranquility Base
Contact:

Post by keenmaster486 »

Ahh... no export simple option is listed. I do have the extension; it's listed in the "extensions" tab as EasyAslev 1.0. Do I need a later version?
I flermmed the plootash just like you asked.
User avatar
Fleexy
Tool Smith
Posts: 1432
Joined: Fri Dec 12, 2008 1:21
Location: Abiathar C&C

Post by Fleexy »

My mistake, it's actually called "Simple Export." It can be found at the bottom of the Tools menu when viewing a level. If the extension loads successfully, its registered tools should show up.
User avatar
keenmaster486
Vorticon Elite
Posts: 542
Joined: Sun Mar 20, 2016 18:29
Location: Tranquility Base
Contact:

Post by keenmaster486 »

Ha ha, thank you! Success! It worked!

I am now converting levels lickety-split with my little command-line tool.

Of course, the way in which original Keen did poles, doors, etc. is completely different from my implementation, so I'm having to redo all of that special stuff. And my tile properties file is horribly incomplete, so many of the tiles are broken. Otherwise it works great.

BTW I thought you might want to know that I'm using Abiathar in Linux with Wine/Mono, and it works perfectly. I haven't run into a single problem yet.
I flermmed the plootash just like you asked.
User avatar
Nisaba
Janitress
Posts: 1597
Joined: Fri Jan 01, 2016 23:34
Location: The Outpost
Contact:

Post by Nisaba »

keenmaster486 wrote: I'm using Abiathar in Linux with Wine/Mono, and it works perfectly.
nifty, nitfy.
I also run Abiathar under MONO/Wine which works quite smooth if rendered with max. 100% zoom. but increasing this value to say 200% it becomes extremely laggy. navigating is mostly impossible. also there are some issues displaying some rendering stuff like the Tile Properties, the Key Linker and so on. in conclusion one can use Abiathar "out-of-the-box" after installing MONO but has to be aware of some usage limitations. Did you also noticed something similar?

MoffD gave me the hint to alternatively installing the Microsoft NET runtime into wine. but I haven't tested this workaround yet...
out now (link) : Image
User avatar
keenmaster486
Vorticon Elite
Posts: 542
Joined: Sun Mar 20, 2016 18:29
Location: Tranquility Base
Contact:

Post by keenmaster486 »

Yeah, I noticed the lagging at higher zooms, but I didn't try to do enough with it to notice the other limits. Maybe on future versions of Wine and Mono those problems will be fixed.
I flermmed the plootash just like you asked.
User avatar
MoffD
Vorticon Elite
Posts: 1220
Joined: Thu Jul 05, 2012 17:30
Location: /dev/null
Contact:

Post by MoffD »

Nisaba wrote: also there are some issues displaying some rendering stuff like the Tile Properties, the Key Linker and so on. in conclusion one can use Abiathar "out-of-the-box" after installing MONO but has to be aware of some usage limitations. Did you also noticed something similar?

MoffD gave me the hint to alternatively installing the Microsoft NET runtime into wine. but I haven't tested this workaround yet...
Yeah, that's why I was suggesting NET, it fixes a few of the graphical problems (linker view etc...) When testing it with Fleexy, I found that a few NET functions are stubbed and need to be implemented in MONO. After installing NET I think just about all the problems went away, but I think it runs slower.
Levellass wrote: I recently had to send a Keen game to a modern gamer guy. They wondered where the mouse support was and I felt so old.
AUGH! I'm too young to feel old!
mortimermcmirestinks wrote: Now I wish MoffD wasn't allergic to me.
Levellass wrote:You're an evil man.
Image
User avatar
keenmaster486
Vorticon Elite
Posts: 542
Joined: Sun Mar 20, 2016 18:29
Location: Tranquility Base
Contact:

Post by keenmaster486 »

OK, another update, probably the last for a while (although the last time I said that, I was completely wrong :P)

New features added:

-Level conversion from Abiathar simple single-level files
-World Map
-Basic sprite/enemy routines (so far only slugs)

The sprite routines have thrown a wrench into the works since they add just that many more conditionals (which QB is horribly slow at). Even having just 8 slugs in a level such as Slug Village more than halves the framerate! >:

So I'm really going to get cracking on moving this thing over the QB 7.1, which, apparently, is faster (I'll do some tests to be sure). Unfortunately this means significant portions of the engine will have to be rewritten, using some library other than DirectQB since it's incompatible with QB71. Oh well.

Download link: https://drive.google.com/open?id=0Bwrva ... 3VOcGsyM0U

Demo video: https://youtu.be/a-3VlnlOCGM

Stay tuned for more updates!
I flermmed the plootash just like you asked.
User avatar
kvee
Vortininja
Posts: 67
Joined: Sat Sep 26, 2015 11:17
Contact:

Post by kvee »

keenmaster486 wrote:Demo video: https://youtu.be/a-3VlnlOCGM
Dude, nice job!
User avatar
Levellass
S-Triazine
Posts: 5265
Joined: Tue Sep 23, 2008 6:40

Post by Levellass »

Aaaah conditions; truly they are an ancient nemesis.
What you really need, not what you think you ought to want.
User avatar
keenmaster486
Vorticon Elite
Posts: 542
Joined: Sun Mar 20, 2016 18:29
Location: Tranquility Base
Contact:

Post by keenmaster486 »

Another new version, this time probably the last one as I've reached the absolute limit of what QB45 can do and I'm simply not willing to rewrite the entire engine in QB71, which is only marginally faster anyway (I did some tests. It's about 5-10% faster, which is not nearly enough).

There are no new features except for a few new enemies and some more levels converted from Keen 4. The main improvement lies in speed. I've got this thing absolutely as fast as it can possibly be given the fundamental structure of the engine and the fact that it's written in QB45. On levels like Crystalus, though, which currently has 28 sprites, it really chugs, even at 60000 DOSBox cycles :lol. Oh well.

Maybe someday I will rewrite this in FreeBasic but I don't see that happening anytime soon as FB doesn't have a screen scrolling routine like DirectQB's. I might rewrite it with unoptimized scrolling for modern systems, but I don't like that because it isn't DOS >:

I guess at this point I'm devoting what limited development time I have to this: http://www.vogons.org/viewtopic.php?f=5&t=49819

Download link: https://drive.google.com/open?id=0Bwrva ... GxLNV9JbmM
I flermmed the plootash just like you asked.
Post Reply