V2 project - Extra Tilesets

Completed patches for Keen1.
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

V2 project - Extra Tilesets

Post by lemm »

MULTIPLE TILESET PATCH FOR KEEN:VORTICONS

This set of patches allows you to use multiple tilesets in Keen 1 and 2 (and, when I get around to it, keen 3). A tileset (.TLS) contains all the tile graphics, tile information, and tile animation. You can edit the .TLS using Tileset Tool (make sure you download the latest version). You must import all non-tile graphics using KeenGraph.

Some highlights:

1. Unique 910-tile tilesets for every level
2. 4 or 8 frame animations including custom animation patterns and masked animations
3. Sloped tiles.

Whether you are starting a new mod, or you want to "upgrade" an existing one, you should start off by using the example mod provided as a base and building upon that. First, make sure you can run the example mod. Next, make your tileset and ensure that it works. DO NOT try to import tileinfo from existing projects or keen executables; ALWAYS start fresh for each new project. Also ensure that you have set the correct number of animation frames in the patch file. Ensure that a second tileset works (if you are using one), and import the rest of your graphics. You may have to the reduce size of xBMPyyyy.bmp, since the increased number of tiles limits the amount of room for other EGALATCH graphics. Finally, start adding in other patches a few at a time, and playtest intermittently to ensure that no patches are conflicting with V2.

There is extensive documentation in the archive that contains information on how to design tilesets.

Download:
V2: http://files.commanderkeen.org/users/omp/v2-0.0.2.zip
Tileset Tool:http://www.keenmodding.org/viewtopic.php?t=1309
KeenGraph: http://www.keenmodding.org/viewtopic.php?t=1164
Last edited by lemm on Thu Aug 26, 2010 11:36 pm, edited 3 times in total.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

First up, can the two bin files be combined together (Keep things simpler.) and secondly, are these names final so I can modify KeenGraph? And I do not quite understand your .TLA format, if you explain it, I could make a TLI->TLA converter so people can use tileinfo to set new animation properties.


Condensed patch:

Code: Select all

%ext ck1
%version 1.31

#Each level has its own tiles and tileinfo
#Note: requires 32-bit processor (or dosbox)
%patchfile $2CE0 cg.bin
%patchfile $2F20 xtratile.bin
%patch $4B71 $E8 $72 $E4 $90 $90 $90
%patch $4C8F $90 $90 $90
%patch $8041 $E8 $B2 $AF $90
%patch $8EA8 $E8 $61 $A1

#Files used: (.TLI, TLG and TLA)
#If files are not present the fame will not load them. .TLG
#files are tilesets, .TLI files are tileinfo and .TLA are tile anim
#properties.
#Here use a different set of files for each level; for example
#level01 uses TLSET01.TLG, level03 TLSET03.TLG, and so on. You
#do NOT have to use different files for each level, just change
#the "xx" patch.
%patch $14F55 "TLSETxx.TLy" $00  #Basic name
                           "00"  #LEVEL80, 81 and 90.CK1
                           "01"  #LEVEL01.CK1
                           "02"  #LEVEL02.CK1
                           "03"  #LEVEL03.CK1
                           "04"  #LEVEL04.CK1
                           "05"  #LEVEL05.CK1
                           "06"  #LEVEL06.CK1
                           "07"  #LEVEL07.CK1
                           "08"  #LEVEL08.CK1
                           "09"  #LEVEL09.CK1
                           "10"  #LEVEL10.CK1
                           "11"  #LEVEL11.CK1
                           "12"  #LEVEL12.CK1
                           "13"  #LEVEL13.CK1
                           "14"  #LEVEL14.CK1
                           "15"  #LEVEL15.CK1
                           "16"  #LEVEL16.CK1

%end 
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Post by lemm »

Code: Select all

I could make a TLI->TLA converter so people can use tileinfo to set new animation properties
Thanks. That would be doubly awesome.

Here's what I think I will do:

I will try to add one more call to my code at the "One Moment" screen, meaning that the tile portion of keenmoded EGALATCH.CK1 and patched TileInfo files will be completely unnecessary. All tile-related data for each tileset will be on one .TLS (tileset) file, TLS = TLI+TLG+TLA.

Then it's a snap to change tilesets! Just load in 1TIL00xx.bmp + 1TIL00xx.TLI to your converter, which spits out one .TLS. You wouldn't even have to use modkeen if you just wanted to fiddle with tiles. Or, if you just wanted to make a levelpack with custom tilesets, this would let you change the tiles very easily.


Okay, then I will move my code into the part of memory responsible for creating the animation planes, since that code will never be used. This way, there will only be one .bin file (cg.bin is just used to make room), and therefore more room for other large patches.

I still want to figure this out though.. I'll post again shortly.


Tile Animation data

All tiles have four frames. It's just that if you select no animation in TileInfo, then all four frames have the same graphic. Also, there is room for 700 tiles, but not all of that is used. I'll just pretend there are 700 tiles though.

Frame 0 of tile 0 is at $0 (add $16A6C in the game, add 0 in a TLA file)
Frame 0 of tile 1 is at $2 ( ditto)
Frame 0 of tile 2 is at $4
...
Frame 0 of tile 699 is at $2BA
Frame 1 of tile 0 is at $2BC
Frame 1 of tile 1 is at $2BE
Frame 1 of tile 2 is at $2C0
....
Frame 2 of tile 0 is at 2*$2BC = $578
....
Frame 3 of tile 0 is at 3*$2BC = $834

Finally, what do i mean when i say Frame x of tile y is at offset z? ("Tile y" means tile id number from 0 to 699, like the data in a LEVEL.CK1 file)
Simple: The memory at offset z refers to the graphic in 1TIL0000.bmp at 32*tilenum. So if the word at offset Z is 128, then tile y during frame x will display the graphic for 128/32 = tile 4 in 1TIL0000.bmp (i.e. the fifth tile, if the first is tile 0)


So once the game is past the loading screen, there is nothing that says "tile y is a 2-frame animation" for example. There is just memory that says, "if the screen is on frame x, display graphic z/32 for tile y. That is why I said you could make custom animation patterns.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Righto, this may need a bit of collaboration; currently I've set KeenGraph to create .TLG files from bitmaps when importing. However, if you do this patch using .TLS files, I may abandon this from KeenGraph entirely and make a dedicated converter to compile TLS files.

It would read the patchfile and compile TLS files from tileinfo and bitmaps in the directory (Needed for tileinfo to work.) I could then include your patch and bin files all in a neat little stand-alone package.


Now, as I see it now, the TLA format is as follows:

Each file is 5600 bytes long (4 frames x 700 tilesx 2 bytes per tile.)

Each file consists of 4 'planes' of 700 tiles (Frame 1, frame 2...)

Within each frame each tile has a word pointer to the tile graphic in the tile data. Each tile takes up 32 bytes.

This means that all tiles 'animate' and that you can thus have 3-tile animations and all that other jazz you pointed out. It is also possible for tiles to animate to tiles that aren't next to them in the tileset.


EDIT: Program complete! Get it here: http://levellord.rewound.net/TLS.zip
Last edited by levellass on Fri Oct 09, 2009 9:14 am, edited 1 time in total.
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Post by lemm »

Precisely.

And I moved the patch to it's new location, so cg.bin isn't needed, and TLA files work. There is still a lingering flicker during the ID software scroll up at the beginning of the game, but that can be worked around.


Anyways, yes, let's go with the TLS files, in the order TLI,TLG,TLA. I think a standalone converter is a better idea.
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Post by lemm »

Okie doke, patch is done and it works from the startup screen and it takes .TLS files.

Updated first post.
Kdash
Posts: 405
Joined: Sat Feb 26, 2005 5:45 pm

Post by Kdash »

How far off is a Keen 3 version of this patch? :)
User avatar
Fleexy
Site Admin
Posts: 490
Joined: Fri Dec 12, 2008 1:33 am
Location: Bloogton Tower

Post by Fleexy »

genius314 wrote:How far off is a Keen 3 version of this patch? :)
Or Keen 2...

And while you're at it, could you please make in in-level teleport for Keens 2 and 3?

And while you're doing THAT, could you please get a masked animation thing working?

And... [LEMM OVERLOAD IN MODULE FLEEXY AT 7527:0991]
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

One more thing, does the TLI file contain standard animation data like normal TLI files? Or is that removed because it's not necessary? Also, how many tiles are in this segment, the usual amount or 700 like in the TLA segment?
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Post by lemm »

TLI has 611 tiles, the animation data is still present. It is not modified in any way from the TileInfo supplied to your converter.


In the not to distant future, though, I might want to use the animation space for sloped tile information.


Keen 2 and 3 version could be done in 15 minutes.
Kdash
Posts: 405
Joined: Sat Feb 26, 2005 5:45 pm

Post by Kdash »

lemm wrote:Keen 2 and 3 version could be done in 15 minutes.
Cool! I could really use this patch in my third mod.

In fact, with a patch like this, there's much less reason to go to Keen 4-6 modding.
Which leads to my next question... Is this possible in Keen 4-6?! :P
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Post by lemm »

Keen 3 version.
http://files.commanderkeen.org/users/omp/xtkeen3.zip


Why is the tile info file 715x12 when there are only 624 tiles in keen3?
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Because ID intended for there to be that many tiles (Same with Keen 2) but were unable to do so with memory constraints.

This will be harder in Keen 4-6 since each level already does this to some extent, it loads only the tiles it needs from the EGAGRAPH.


Also, I think that Keen 3 version should be posted in the Keen 3 patches section.
Kdash
Posts: 405
Joined: Sat Feb 26, 2005 5:45 pm

Post by Kdash »

Okay... so how exactly do I use this, now? How do I get each tileset into separate BMP's, and how do I import those back into the game?
User avatar
Fleexy
Site Admin
Posts: 490
Joined: Fri Dec 12, 2008 1:33 am
Location: Bloogton Tower

Post by Fleexy »

I think you have to wait for levellass to make the .BMP+.TLI->.TLS converter.
Post Reply