rozniak / Junkbot

An attempt at an open-source port of Lego Junkbot
GNU General Public License v2.0
31 stars 3 forks source link

Hello! #6

Open 1j01 opened 4 years ago

1j01 commented 4 years ago

I've started working on a Junkbot remake here: https://github.com/1j01/janitorial-android/ Your ripping efforts have been very useful in that, especially with the atlas JSON (which you don't normally get along with a spritesheet) that was useful in quickly integrating the Junkbot animations, and the sound. I tried to rip files from the .dcr using offzip, and only managed to extract some random set of sound files. I'm curious, what did you use to rip the resources? Also, if there's any other ways we could help each other out, that could be fun. I have the brick dragging mechanics working, if you want a reference for that - also with cursor images (extracted from screenshots grabbed with Irfanview).

rozniak commented 4 years ago

Sorry I haven't been posting too much here, been quite tired lately...

The sprite ripping was done via Adobe Director 12 - I used an Xtra I found online with a simple Lingo script that lets you 'convert' a .dcr back into a .dir file (like converting a .swf back into its original .fla). I put 'convert' in quotes because the original Lingo source is not available (as far as I can tell anyway), but it does let you see all the original assets. It was a bit of a pain to find, I might have to see if I can dig out the converted .dir or preferrably the Lingo I used to create it next time I'm booted into Windows.

The sprites are a bit annoying because they need stitching together, @TommytheJerk did this I think - tedious work I only had the patience to do for Junkbot's basic walking anims. :stuck_out_tongue:

For the spritesheets I popped them into my bin packer tool which is a simple WinForms app - it's in the engine tree here (though in another branch atm): https://github.com/rozniak/rzxe

1j01 commented 4 years ago

Thanks for responding!

Oh yeah, I wanted to ask about the levels. I started to write a parser for the level text files before realizing they don't actually have the data of what blocks go where. Do you know if this data is stored as scenes (keyframes?) in the Director project, like so that they could be authored with a visual editor in Director? (I used Flash back in the day, but I don't know how similar it is to Director.) Anyway, I'm sure there's some way to extract it, like writing another Lingo script similar to the "converter" Xtra.

If you could find and upload the .dir or Lingo script, that'd be great, but no pressure. :slightly_smiling_face:

rozniak commented 4 years ago

The text files are the levels, parsing them is actually pretty simple:

types - the objects available in the level as a CSV, store these in an array in the same sequence they appear in the file colors - relevant for bricks, same as above just store these in an array parts - the layout of the level, a CSV where each value itself is semicolon separated values (so split by , first for each 'definition', then split each definition by ; for the values)

The indexes for parts are as follows: [0] - x coordinate [1] - y coordinate [2] - type index (in the array stored earlier) [3] - color index (in the array stored earlier) [4] - starting animation name (0 for objects that don't animate) [5] - starting animation frame? (this seems to always be 1 for any animated object, so I ignored it for now in my parser)

Using that info, and the dimensions for the grid/cell size stored in size and spacing, you can build the complete level. Obviously the decals values are very basic - x, y, then the name of the decal.

You can reference the level parser in this repo if you want, it's in Scene.FromLevel here: https://github.com/rozniak/Junkbot/blob/dev-shell-cleanup/src/Junkbot/Game/World/Scene.cs#L196 (the string[] param is an array of lines read from the text file, and AnimationStore is just where I store the sprite/anim data from the JSON files)

I found the .dir files as well, here they are for both Junkbot and Junkbot Undercover: Junkbot-DIRs.zip

rozniak commented 4 years ago

Oh, and as far as authoring levels goes, there are some references to a level editor within the Junkbot assets - it's been a while since I looked at them though. I am not sure how much has survived in the final game, might just be some sprites.

I did try looking around for info on decompiling Lingo but I didn't find anything. I'm sure it's possible to figure it out but I don't think it's worth the time in Junkbot since it is such a straight forward level format (hence why I started just writing it from scratch 😛 )

1j01 commented 4 years ago

Oh, thanks! Huh, it seemed like there wasn't nearly enough entities listed.. oh, so it's multiple on one line but still giving coordinates.. that's not what I expected! :smile: Yeah I guess I only tried to understand it as an entity per line (in which case there's not nearly enough) or entities separated by spaces, in which case it doesn't correspond directly to the grid, and then gave up.

Thanks for your explanation, and the code reference, and the DIRs. This is all very helpful!

Your readme says "work is under way ripping all game data from the original DCR files" What's left? Is there anything I can help with?

rozniak commented 4 years ago

I think when I was originally looking at it, I just made the assumption that the first values were x and y coordinates, and then used Junkbot to figure everything out (since he is a unique object and a good starting point to work out the format from).

To be honest I am a bit bummed because I have been tired and lacking in motivation to really do anything so I haven't updated much (including the README). What I am working on (albeit very on-and-off) is some more rendering related bits - stuff to do with the UI like the buttons/text. The original game has all the buttons as premade images which we could use but I don't really like that approach - I want a more general method of creating buttons / text so the code is more flexible.

If you want, feel free to add me on discord, I am usually online most of the time and talking about Junkbot a bit more might help renew my interest a bit. :stuck_out_tongue:

My user tag is : rozniak#7774

1j01 commented 4 years ago

I've got level loading working, and I've added most block types! (to some degree of functionality) (I've been working on this at an unhealthy rate, like it's a game jam or something...)

I added decal loading, but I noticed they don't line up right (relative to each other). My guess is the sprites had transparency originally, but was trimmed off when the game was compiled, and only works thru offsets stored somewhere in the compiled bytecode. I see there's a "Trim" option checked on the bitmaps in the Property Inspector. So far my best idea for getting that positioning information is to take screenshots of the game, load them into my version of the game, positioned so it lines up with the level, and have some simple interface for interactively adjusting the offsets per decal.

Also, I noticed you have timing information for the junkbot walk cycle. Is this based on estimates / finding what looks good, or taking measurements from video, or something else?

Edit: just saw your previous message. I'll add you :)