Page 1 of 1

Project 'keenly'

Posted: Sat Oct 10, 2009 10:07
by youkai
Hi, there! :)

I just want to announce a small project named 'Keenly'. You will find it at its SourceForge project site. You will find a project description there.

Current release: Techdemo 2 (Change log)

Image

I started this project because I wanted to create my first network game quite some time ago. Commander Keen is a great motivation for me. The hard part will be the network layer and so I decided to re-use the classic CK games as a front-end.

Actually there is a second techdemo out that allows you to move around, jump, pogo-jump and shoot. I tried to get some kind of the original keen feeling so that the game will be fun. :)

The source code of this project is portable and it my be compiled on a Linux/Unix system or a Mac. It needs the following libraries:
  • SDL (graphics output, timing)
  • SDL_mixer (audio output)
  • SDL_net (network communication)
  • Qt4 (core lib, multi-programming)
The core access to all keen resources out of the game files is based on:
  • lmodkeen (extract sprites, tiles, fonts)
  • unlzexe (decompress executables)
  • KeenWave (extract sounds, music)
  • adplug (read/convert IMF music)
I would appreciate any kind of feedback. As the project in its current state, it would be compressed to:
  • keen feeling while moving around
  • general usability
  • all kinds of problems with starting the game
At the moment, the project is suspended for a some months due to academic studies. One current lecture named "Middleware and Distributed Systems" could bring me a big step further in this project.

Have a nice day!

Posted: Sat Oct 10, 2009 14:32
by VikingBoyBilly
Multiplayer Keen? :eek
There should be an option above "sounds interesting" that says "HOLY COW IM SOILING MYSELF IN DISBELIEF!" :pogo :rollin :garg :dopefish

Posted: Sat Oct 10, 2009 20:11
by tulip
I'll go with sounds interesting.
I just tried it out, the physics need a little bit of adjustment but are generally not bad, as well as the moving while shooting problem.
I'm looking forward to this being developed further.

Posted: Sat Oct 10, 2009 23:24
by DaVince
Sounds wicked awesome. It's cool that you're extracting and using the original resources.

Perhaps this could be merged with CloneKeenPlus at some point... It plans to have Keen 4-6 support at some point and this sounds like a really good addition to all that, especially since you're already doing a lot of the hard work (platforming system, resource extraction etc).

Posted: Sun Oct 11, 2009 2:35
by Deltamatic
I wonder what the competition would be for. Would people be trying to reach somewhere, collect x amount of items? Would a neural stunner shot kill you or knock you out like a Vortikid? Would there be different characters available (like Keen, Mort, Spot, Lindsey...)? Is so, would they act as characters (specifically in the only one per game area) or classes?

Posted: Sun Oct 11, 2009 9:12
by KeenRush
I think it sounds cool -- something I've always wanted to see which has never been done yet, a true multiplayer Keen which plays over the net. :) I think different game mods would be nice.

Posted: Sun Oct 11, 2009 10:37
by youkai
Deltamatic wrote:I wonder what the competition would be for. Would people be trying to reach somewhere, collect x amount of items? Would a neural stunner shot kill you or knock you out like a Vortikid? Would there be different characters available (like Keen, Mort, Spot, Lindsey...)? Is so, would they act as characters (specifically in the only one per game area) or classes?
My first idea is, that you will have to fetch more than one bullet to get killed. I like your idea, that you get hit and knocked out. But then I think other bullets would have to ignore you. Otherwise you would be defenseless and it would be no fun at all. =)

I just added a link to the change log to my first post.

Ciao

Posted: Sun Oct 11, 2009 11:36
by Bonevelous
I like how it sounds, for sure.

:begging

Posted: Mon Oct 12, 2009 14:00
by Commander Spleen
Too complicated to get this running at the moment. But I'll have some time tomorrow to get it sorted and give it a whirl.

What are you planning for the network layer?

Posted: Tue Oct 13, 2009 6:38
by youkai
Commander Spleen wrote:What are you planning for the network layer?
Well, your question is quite "abstract". =) I will implement a client-server-architecture communicating connectionless with UDP packets for the real-time part. I will do it like the guys at Valve. Okay, I'll try to. ^^

Ciao

Posted: Tue Oct 20, 2009 10:16
by Levellass
BEWARE! Long post!


*How Keenwave extracts Keen 4-6 type sounds*


The first step is decompressing the sounds. To do this you need the AUDIOHEAD and AUDIODCT files from the executable. If Keenwave cannot find these it runs a search subroutine. You *could* use hard coded values for this (Like Modkeen) but since Keenwave is to work with all versions, it manually searches the executable.

To find the AUDIOHEAD, look for the first dword (4 bytes) in the executable that has the value of the AUDIO.CKx size. This will be the LAST 4-byte entry in the header file. Then just move back in dwords until you come to the value 0 (File start.)

To find AUDIODCT, note that ALL ID DCTs have as the root node '$FD $01 $00 $00 $00 $00' (That is, this is the last few bytes of the 1024 byte file.) The FIRST of these DCTs is always the AUDIO one.


Next KeenWave decompresses the AUDIO data. This is hard to explain because of the difficulty BASIC has in working at the byte level (And due to speed problems I had to drastically modify Napalm's original code.) but works roughly as follows.

All you need from AUDIODCT is the 255 huffman nodes, built into the Huffman tree. (If you don't understand how Huffman works, check online or at the Patch Index under 'File Formats-> Keen 4-6' ) KeenWave stores this as NODE

To get the compressed data note that each dword in AUDIOHED is an address to a sound in AUDIO.CKx, so the first is $00000000, the second $0000000D, and so on. If you do this right, the location in AUDIO.CKx will have a dword giving the length of the UNCOMPRESSED data (So even in a hex editor it's pretty simple to see where sounds start.)

After getting the compressed data start reading it into the Huffman tree, bit by bit, outputting bytes as you go, until you reach the uncompressed length. (For BASIC this is time consuming as I must manually travel down the tree for each byte. I am considering a hash table.)


Hopefully you now have perfectly sensible Raw Data. For IMFs, you can play them in Adplug. Adlib sounds, I can do nothing with yet as I have no idea where to even start.

For PC sounds you have the following structure:

Code: Select all

-------------------------------------------------------------------------------
FILE STRUCTURE:
0   4    Length      Length of sound data in bytes
+4  2    Priority    Sounds of a high priority interrupt those with equal or lesser priority
                     (So the 'Got a life' sound will be long, loud and interrupt all other
                     sounds, while the 'walking' sound will get interrupted all the time.)
+6  x    Data        Sound data. Each byte is an inverse-frequency datum lasting about
                     0.07s, much like the Keen 1-3 sounds but using 1-byte entires instead
                     of 2 (Since PC sounds are less important here.)
+x  1    Terminator  $00, ends the sound
-------------------------------------------------------------------------------

What will matter to you is the data, a series of values between 1-255 (Or 0, which is silent.) to play these I use the SOUND command, SOUND [Frequency] [Duration] where the frequency is 1193180 / x * 75 (In this case because the single byte values of Keen 4-6 sounds are 75x less than Keen 1-3 sounds.) and the duration is 1 / 128 * 18.2 (I.e 1/128th of a second.)


Any questions?

Posted: Tue Oct 20, 2009 22:09
by lemm
whoa... we could have tournaments, or team levels... :drool

This could usher in a whole new era of keening!

Posted: Wed Oct 21, 2009 6:21
by youkai
@levellass

Thanks for your instructions. :)

Ciao

Posted: Mon Oct 26, 2009 0:16
by Commander Spleen
The reason I asked about the networking thing is that I'm doing a lot of network coding for some of my own projects, and might be able to contribute if you're interested.

Posted: Mon Oct 26, 2009 2:04
by Shilor
This does seem very interesting. Hope to see more development :)