News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Kickle Cubicle Level Editing  (Read 5363 times)

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Kickle Cubicle Level Editing
« on: May 21, 2020, 01:40:48 pm »
Hi,
I'm a fan of Kickle Cubicle, saw a wonderful potential in level editing from a post by a user named Quick Curly
http://www.romhacking.net/forum/index.php?topic=20232.0

So far debugging I've found the following info regarding level editing
1) Data for a stage lives at 0600 in ram once loaded.
2) Data for a level is loaded during the minimap "blinky" sequence
3) For level 1, I can find the start of my data in ROM 17AB2; the hex is 80.
4) Tile specific Knowledge
 -- if a hex value starts with 8 for it's first 4 bytes, don't modify the 8. Only the right 4 bytes are modify-able to a degree.
 -- Slight exception to the hex values starting with 8, they can be increased to a value larger than 8. No effect seemingly happens
 -- hex value starts with with an 8 control more than 1 tile
 -- hex value starts with 4 usually control 1 tile.
 -- hex value starts with 0 should not be modified (most of the type) as the screen gets REALLY wierd, usually cutting off your level by a significant number of rows.
5) I can copy data from other levels wholesale (not row by row) and it'll load properly.
---------------

I tried just going through all of the data and modifying each nybble one by one. I see what I can modify but don't entirely love the results.
For instance the first hex at 17ab2 controls the first 7 tiles. I know from playing there are levels that have the first 3 tiles blank, tiles 4-6 are "walkable" from the start and 7-8 are water. This seems to be far more precise control than what I see offered.


---------- Tl;DR
If anyone knows the compression or TSA format for the Kickle Cubicle level data I'd appreciate some guidance. I don't believe I'm the first to investigate this game by a longshot but there isn't a nice write-up that I can find.

Cyneprepou4uk

  • Sr. Member
  • ****
  • Posts: 455
  • I am the baldest romhacker
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #1 on: May 21, 2020, 07:58:32 pm »
Decompressing is pretty simple

Code: [Select]
04:A11A: B1 0E     LDA ($0E),Y
 04:A11C: 10 11     BPL $A12F
 04:A11E: 29 7F     AND #$7F
 04:A120: 48        PHA
 04:A121: C8        INY
 04:A122: B1 0E     LDA ($0E),Y
 04:A124: 85 0D     STA $0D
 04:A126: 68        PLA
 04:A127: 9D 00 06  STA $0600,X
 04:A12A: E8        INX
 04:A12B: C6 0D     DEC $0D
 04:A12D: D0 F8     BNE $A127
 04:A12F: 9D 00 06  STA $0600,X
 04:A132: E8        INX
 04:A133: C8        INY
 04:A134: E0 E0     CPX #$E0
 04:A136: D0 E2     BNE $A11A
 04:A138: 60        RTS

Code checks if the loaded byte from the table is positive (less than 80), in that case this byte has to be written into ram a single time, then continue reading from the table.

But if it appears to be negative (80 or higher), then code cuts off higher bit of that byte, loads following byte as a counter, and writes cutted byte into ram as many times as counter says so + 1 additional time, then continue reading from the table.

Lets describe an example of the 1st level

Code: [Select]
80,06 01 44 80,0C 81,02

Byte 80 - negative, then write byte "00" 7 times (06 + 1)
Byte 01 - positive, write byte "01" 1 time
Byte 44 - positive, write byte "44" 1 time
Byte 80 - negative, then write byte "00" 12 times (0C + 1)
Byte 81 - negative, then write byte "01" 3 times (02 + 1)

And so on
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #2 on: May 22, 2020, 09:08:21 am »
FANTASTIC! Thank you!
It was that combination of the 0 decimals.
Will play with this, get a better understanding, and time to start working on a document for folks so we aren't reinventing the wheel.

Quick Curly

  • Full Member
  • ***
  • Posts: 110
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #3 on: May 22, 2020, 03:00:31 pm »
Hey there! How's it going? It's awesome to meet another Kickle Cubicle fan!
I assume that you already have the two documents for the level data, as seen on the Kickle Cubicle Data Crystal page.

Kickle Cubicle level data in data order
Kickle Cubicle level data in game order

I'm not sure if they will be useful at all, but here are my old notes going back as far as 2009. They're not complete (or necessarily accurate) by any means, which is why I never released them, but hopefully they are a decent beginning ground towards general documentation, and maybe can save a little bit of time with your documenting process. :)

Kickle Notes 5/22/2020 (200.7 KB)

Do you have specific goals in mind for a potential project? Are you planning to create a utility for the game, and/or are you simply planning to create a straight level hack to provide a new Kickle experience?
In any case, I'm interested and I hope that you'll keep us updated! Best of luck!

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #4 on: May 22, 2020, 03:32:22 pm »
I do have a goal, the hopes will be to build a level editor so folks can make maps a bit easier.
The game seems well programmed enough that it shouldn't be a hassle once mapping behaviors and tile values occur.
Today I have all of the tile combinations (00 -FF) mapped out. Kinda interesting really:

0-7 == single block mapping
8-F == double block mapping

In that order however 8/0 map to the same set of tiles so:
80 === 00 but 8 signifies for multi blocks, 0 for single.

I'll post all of this sometime in the evening.

.... Guess I don't need to post this as Curly's notes contain ALL of this info I have found. AT this point I'm just looking at your manual and tinkering. I saw your added notes and didn't digest until WAY after I mapped tiles
« Last Edit: May 22, 2020, 11:59:32 pm by th60ftatomicman »

AirborneMuffins

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #5 on: May 22, 2020, 04:09:00 pm »
I have nothing to add, but wanted to voice my support to anyone working on anything regarding this wonderful game. Seeing it on the front page in any form brings me joy.

Googie

  • Hero Member
  • *****
  • Posts: 942
  • I'd like to solve the puzzle... Jiggers!
    • View Profile
    • My work in progress ROM Hacking site
Re: Kickle Cubicle Level Editing
« Reply #6 on: May 22, 2020, 09:14:21 pm »
I loved this game when I was a teenager, I never coulda beat the extra levels after I beat this game. I'm glad this game is getting the love it deserves. :D

Jorpho

  • Hero Member
  • *****
  • Posts: 4450
  • The cat screams with the voice of a man.
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #7 on: May 23, 2020, 12:05:11 am »
If you enjoy Kickle Cubicle, may I suggest Little Medusa if you missed it?
https://gbatemp.net/review/little-medusa.856/
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #8 on: May 27, 2020, 10:18:15 am »
Quick Update of Progress -- working on POC. Using this as my side project from mainline work.
You'll see I haven't gotten TOO far but at this point, I can load the raw HEX data, format it in the text area below into a semi-more readable solution (group hexes combine with their counter..ex 80,06 and spaces seperate the hex values)

and I have a few a grid which loads in real time with your modifications. In the last modification I make it shows a tile that I don't have an Icon for yet.

My hopes are to host this on AWS and just have a nice web editor for folks to do their modifications. You'll be able to edit and do what you want with the level code.

I still have to add in a ton of functionality and imagery but I'll slowly work on it.
Adding in the handling of enemy data today in hopes of getting my foundation so hopefully this doesn't end up in the "dreams and wishes" bin many projects fall into.

Hope this raises some cheer for the potential to modify this game!

-- sadly image is not showing. made a gif earlier. I'll get on that as I finish things up on 0.01 of this thing.




« Last Edit: May 27, 2020, 02:24:54 pm by th60ftatomicman »

Googie

  • Hero Member
  • *****
  • Posts: 942
  • I'd like to solve the puzzle... Jiggers!
    • View Profile
    • My work in progress ROM Hacking site
Re: Kickle Cubicle Level Editing
« Reply #9 on: May 28, 2020, 11:45:35 am »
If you enjoy Kickle Cubicle, may I suggest Little Medusa if you missed it?
https://gbatemp.net/review/little-medusa.856/

I have this game, I enjoy playing it, it's a really cool game. :D

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #10 on: June 17, 2020, 02:28:52 pm »
Tl;DR -- see v0.01 screenshots below
To run
  • Clone Repo (or download zip from github link)
  • gp into the WIP folder
  • run: npm start
  • once it says the server is up, goto localhost:8080/index.html

A WIP but certainly at a milestone!
Project is now public on github here: https://github.com/the60ftatomicman/KickleCubicleLevelEditor
At the moment the instructions are a bit bland (I apologize) however I'll get things up and running

It took some time to extract (90% correct) the level data and enemy data from the documents.
I need to add more tile icons
I need to add more enemy icons (only a few are in there)
after this we'll be v0.10

I'll get a timeline up on what I would like to improve (alot) soon! I was just excited to get the little I have done out the door for now to generate some interest.

If you're code savvy and can develop in angular by all means I could use the help!

 -- if you don't see the screenshots below goto:
https://github.com/the60ftatomicman/KickleCubicleLevelEditor/blob/master/Screenshots/v001/intial_load.png
https://github.com/the60ftatomicman/KickleCubicleLevelEditor/blob/master/Screenshots/v001/level_switching.gif
https://github.com/the60ftatomicman/KickleCubicleLevelEditor/blob/master/Screenshots/v001/modifying_map.gif



Googie

  • Hero Member
  • *****
  • Posts: 942
  • I'd like to solve the puzzle... Jiggers!
    • View Profile
    • My work in progress ROM Hacking site
Re: Kickle Cubicle Level Editing
« Reply #11 on: June 20, 2020, 08:24:21 pm »
I dig the pics, they looks really cool.  :thumbsup:

FCandChill

  • Hero Member
  • *****
  • Posts: 540
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #12 on: June 20, 2020, 11:51:44 pm »
I loved this game when I was a teenager, I never coulda beat the extra levels after I beat this game. I'm glad this game is getting the love it deserves. :D

Yeah, it's really good game. I'm a fan of hard as nails puzzle games.

Project is now public on github here: https://github.com/the60ftatomicman/KickleCubicleLevelEditor
At the moment the instructions are a bit bland (I apologize) however I'll get things up and running

It took some time to extract (90% correct) the level data and enemy data from the documents.
I need to add more tile icons
I need to add more enemy icons (only a few are in there)
after this we'll be v0.10

I'll get a timeline up on what I would like to improve (alot) soon! I was just excited to get the little I have done out the door for now to generate some interest.

If you're code savvy and can develop in angular by all means I could use the help!

I find the choice of JavaScript interesting. Unfortunately, I don't have experience with level editors to help out currently and have my hands full with other project. I would suggest finding pre-existing utilities that are out in the wild and seeing how they tick. Thing is, most aren't in JavaScript...

I looked at the code for a bit. If it were me, I would have done a few things differently: I wouldn't have used Powershell (just a preference, it has its limitations), and I would have read the graphics straight from the rom instead of storing them as PNGs. Just some preferences though. Still a pretty cool utility you have going on.
« Last Edit: June 21, 2020, 12:06:46 am by FCandChill »

Quick Curly

  • Full Member
  • ***
  • Posts: 110
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #13 on: June 25, 2020, 09:08:10 am »
It took some time to extract (90% correct) the level data and enemy data from the documents.

Quote
Editor Questions
Why does the enemy data look awful?
I have the wrong enemy data input! I pulled the enemy data via powershell scripts from parsing the CurlyNotes_AKA_almostEverything.txt file. This knowing led to a few levels with wierd (or in some cases NO) data.

I did mention that the information was likely not all correct, but what exactly was incorrect? Can you be more specific? I pulled all the data bytes directly from the ROM back when I was still working on a hack that I haven't touched for over 4 years now, so I can't guarantee you (nor did I try to) that I didn't somehow miss something.

Also, if the document had incorrect information in it, then why would you submit it to Romhacking.net? I never did because I wasn't trying to rush to release an unrefined document. I only roughly put it together from all my collective mini-notes so that I could provide it to you.

I don't mean for any of that to sound aggressive or harsh, but I can't help but feel a little confused since you used the document as a reference, claimed that some of it is incorrect, and unless I'm missing something, never tried to bring it to my attention before uploading it to this site and your GitHub. To be clear, I don't mind you using it. I guess I just wish that it and/or I wasn't an excuse something didn't work out. It's not like I wanted to provide the wrong information to you, or anyone else who might have tried to use it.

From you saying the "enemy data" specifically is wrong without additional details yet, my first thought is that it's possibly due to offsets that the original game had in those spots like for levels 7D-7F. While the pointers for the level layout data are the same for all of them (just more level 01 repeats), the enemy data is different for each (and I can only assume that they are just garbage pointers for non-existing, not actual "levels" to begin with, and who knows if those bytes have another purpose or none at all).

That, and/or maybe it has something to do with the enemy identifiers. I never did get around to the specific purpose of each byte and how it all works, so it would probably take some time if there was an issue to work out there.

In any case, if there's something wrong, I don't want to provide misinformation if I can help it. I can't always figure everything out, but I'm more than willing to try... to try. So, we can look at the data again in the ROM if you want, if you provide me with some more details.

As for the level editor itself, congratulations on what you've put together so far.

EDIT: I misunderstood the situation and it's my fault. Sorry.
« Last Edit: June 26, 2020, 04:19:17 pm by Quick Curly »

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #14 on: June 26, 2020, 09:30:46 am »
Oh man, my apologies; I will have to redefine that statement!
The extraction process is to blame and I didn't make that clear in the statement.
What you wrote up is an AMAZING compendium of information that is thus far accurate.

TL;DR -- Curly's guide is correct. My extraction process and cowboy coding led to the 90% accuracy.

Manually pulling data from your guide always provided proper location for enemies which I did for all of Garden land. Sampling in other lands for good measure to verify the guide was accurate. Never steered me wrong when manually extracted.

The extraction process for the hex data was as follows (Skipping the details on how I store the data and what not, will update in a future post if people wanna actually hear my armchair architecting)

1) Pull map data via a powershell script (Convert_to_Hex.ps1) I wrote that comes through romMap_LevelData_OrderByLevel.txt and just goes to those memory locations in the ROM and extracted the data.
2) Pull Enemy data from your guide via ANOTHER powershell script (pull_enemy_data.ps1)
-- This was the start of my woes; as I made the CLASSIC index error of counting from 0 in one instance of tracking things, and 1 from another.
-- This was shameful and would ultimately lead to my 90% (WAG estimage) proper enemy data extraction
3) Run the MERGE script which combined the existing map level_*.json files with the enemy_*.json files
-- Like a fine cheese these level_*json files were hand crafted at first since I thought that'd be a not terrible waste of time. I also planned on releasing level by level slowly after some strict scrutiny but after looking at what I had to do to host this as a website I was like "NAAAAH, ill put it out there in hopes that people will get some use of it as I expand and we'll laugh at the early iterations of it!" This combined with the earlier indexing error cause a few levels to either have NO data (garden land F had this problem) or messed up data.
-- A testimony to your guide, when I find these errors its easy just to copy and paste from your guide to fix the level! I just haven't gotten to it as that's release 0.04 or something?


 The ONLY caveat was discovering that the enemy grouping guide was a bit generic for many enemies! It's not wrong but from working with your the data you provided I found the more accurate way to describe enemy grouping tags is something like (static hex)(variable hex value)(static hex)(static hex)(02 or 03 depending on if it's first or second grouping definition)

example for MAX (20)([0-9A-Fa-f]{2})(0B)(03)(0(2|3))

Since regex is a language only understood by elder gods this seems like a good idea to omit from the guide.

June 30, 2020, 02:19:49 pm - (Auto Merged - Double Posts are not allowed before 7 days.)



Added, simplified guides. Will probably EOL this post and move to a new thread to track progress of this now!
Simplified Image for tile modification.
« Last Edit: June 30, 2020, 04:43:37 pm by th60ftatomicman »

Googie

  • Hero Member
  • *****
  • Posts: 942
  • I'd like to solve the puzzle... Jiggers!
    • View Profile
    • My work in progress ROM Hacking site
Re: Kickle Cubicle Level Editing
« Reply #15 on: July 06, 2020, 03:44:52 pm »
Cool snapshots, just curious on how the progress is going. :D ;)

Arcade-Elite

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #16 on: July 06, 2020, 10:45:33 pm »
If you guys ever get that done, there was a bootleg that was never finished of kickle cubicle called Mirrior devil world only had 5 levels done. Be cool to see some one hack that as well just to finish it. Or make a better clone..

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #17 on: July 06, 2020, 10:56:00 pm »
Good, and bad; but first a gif of things in action


The good:
Simple stuff like correct level data, sprites are full size now; you can see what direction the data is facing!
Along with the guide users can not actually edit stuff. It's VERY primitive and clunky but it's theoretically more useful than just FCEUX and the hex editor at this point.
Bugs are showing but not super hard to fix most of the time.

The bad:
The editor is nowhere near perfect. The text area's provided are a bit wonky in their use. As I refresh the data it moves the cursor position...it's annoying. v0.5 is addressing saving and loading, along with ROM modification (if file provided); doing this because it seemed nicer to have before the simple editor mode (v0.06) but Im now debating that. Having drag and drop and list add-able enemy data might be a nicer change.

The ugly:
My UX skills still leave much to be desired. Life is also taking an impact as I am trying to get a bit more sleep these days; and a new project has begun for me at my day job. Also I can't stop thinking about NES golf and wondering how the level data in THAT works which means my interest is slowly fading. I'm the type of person who likes to queue up 5-6 projects and finish them VERY slowly as I start stop all of them. Just ask my arduino project I was working on prior to this. The update Q's keep this interesting so by all means keep those post coming!

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Kickle Cubicle Level Editing
« Reply #18 on: July 14, 2020, 02:14:59 pm »

The great simplification has begun.
v.5 is now going to be making the easier edit mode for characters. possibly tiles? Drag and drop tile placement seems lofty but hey... anything can happen with time.

At the moment there are some performance issues with how I am replacing data in simple mode.(you can see the the gif above I fry the whole level just by clicking too fast)

Also of note I did do a good breakdown of NES GOLF since it made me literally lose sleep thinking about it. See that in my other thread.