Reverse engineering (was:Temporary modding) thread

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
spoilspot
Posts: 10
Joined: Sat Apr 14, 2012 2:52 pm

Re: Temporary modding thread

Post by spoilspot »

Can't you read them with a simple text editor? I'm using sublime text and I was able to read level01.lua just fine.[/quote]

I've tried Sublime text as well, and I can change "spider" to "blob" - it just doesn't work (cannot load malformed bytecode).
I also tried changing the preceding \x0b to \x09 (it seems to be length + 5) but that didn't make it any more valid.
I tried changing spider to blob\0\0 to keep the length, but that was too optimistic.

I.e., there might be some other places in the bytecode that doesn't work if the string changes length, so as others have reported, I can only change strings to something of the same length.

Edit: I figured it out - it was too simple :) You can use the LUA source code from the first page directly in as a replacement for the bytecode, instead of editing the byte-code. The source can be edited with a normal text editor.

Now I just need a source file for levels containing spiders.
SpoilerShow
As far as I can see it's levels 3, 6 and 8.
Guess I'll have to figure out how to decipher LUA bytecode :)
/L
Last edited by spoilspot on Sun Apr 15, 2012 6:04 pm, edited 1 time in total.
Punchy
Posts: 3
Joined: Sun Apr 15, 2012 2:37 pm

Re: Temporary modding thread

Post by Punchy »

finally found out how to enter developer mode(with map editor!)
1. download the console.lua and put it in the Grimrock folder
2. Open the console by §
3. enter config["developer"]=true
4. enter config:apply()

edit:
okay after looking at the bytecode of MapEditor.lua you can't realy do much with the editor:
remove or add collisionboxes, teleport to mouse (press t) switch through levels of a dungeon (page up and down)
one interessting bit MapEditor got a mapDump function, but right now i can't get the instance of the running map editor. mainFSM should retur it by getState() but it doen't ...

edit2: still haven't found the actual map editor instance, but took a look at the levels, they aren't actually that dificult to implement(just view the function calls, write lua with the function calls and then you could load in what you want)
Wurmwood
Posts: 13
Joined: Thu Apr 12, 2012 8:03 pm

Re: Temporary modding thread

Post by Wurmwood »

How were you actually performing the mapeditor commands? I can do other things like spawn("iron_gate") or other model names to make them appear on the map, but as far as other commands, I have not gotten anything to work. You can spawn items on the ground as well, like
SpoilerShow
spawn("gold_key") or spawn("tome_wisdom")
seebs
Posts: 268
Joined: Sat Apr 14, 2012 8:58 pm

Re: Temporary modding thread

Post by seebs »

There's 389 keys in _G. Can't see them all at once, because the console is pretty small. Oh, you can change that; look for "Maxlines\x03\x0A" around 0x50, change 0xA.

And you can add code on the fly with dofile('foo.lua').

So I've been working on some debugging tools.

I'm about halfway to a trivial character editor on the console.
windebieste
Posts: 5
Joined: Sat Mar 03, 2012 8:36 am

Re: Temporary modding thread

Post by windebieste »

Please unlock modding area of forum. That would actually be useful.

I hope you have a good reason to keep it locked because the Modding Community will move on with or without it anyway.
seebs
Posts: 268
Joined: Sat Apr 14, 2012 8:58 pm

Re: Temporary modding thread

Post by seebs »

Okay, I have some debugging tools.

http://www.seebs.net/tmp/debug.lua

Long story short: Grab that Console.lua, get it working. Add 'debug.lua' to your Grimrock directory. dofile('debug.lua') at the console.

Now you have some tools for exploring data. For instance:

p = d.partymembers()
d.dump(p[1])

Unfortunately, the data will quickly scroll off the fairly tiny console, but there's some tools for that.

NOTE:

This allows you to break the game pretty badly. I crashed it to desktop a few times. Certainly, the ability to instantly level your whole party to 50 could CONCEIVABLY result in some kind of lessening of the fun of the game.

If you wanna break stuff, I'm not gonna stop you, but:
1. Please don't fuss at me about it. OWN FAULT.
2. Please, please, PLEASE do not try to make it the devs' problem. They are not at fault here.
bkawcazn
Posts: 20
Joined: Fri Apr 13, 2012 6:49 pm

Re: Temporary modding thread

Post by bkawcazn »

spoilspot wrote: Now I just need a source file for levels containing spiders.
SpoilerShow
As far as I can see it's levels 3, 6 and 8.
SpoilerShow
And level 13
User avatar
Loktofeit
Posts: 90
Joined: Tue Mar 06, 2012 3:59 pm

Re: Temporary modding thread

Post by Loktofeit »

Holy shmiz, there's a damn talented crowd here. :)
seebs
Posts: 268
Joined: Sat Apr 14, 2012 8:58 pm

Re: Temporary modding thread

Post by seebs »

ymgve wrote: Got the console working! It even works without extracting stuff! Drop this file in your grimrock dir and it should work: http://dl.dropbox.com/u/1593421/Console.lua

What I've done is changed "developer" in the lua file to "mouseLook" - as long as you have that variable set to true in your config file, it should work. Also, for those with US or other keyboard layouts, you might need to change the character at offset 0x07C1 in Console.lua to a character you are actually able to type on your keyboard.
I'm a bit confused. What are the differences between this file and the normal one, just the name changed? And if so, can't we just set "developer" to true in the .cfg file?

Definitely change maxLines (0x0A at about 0x50, right next to the text "maxLines") to something larger. :)
seebs
Posts: 268
Joined: Sat Apr 14, 2012 8:58 pm

Re: Temporary modding thread

Post by seebs »

Side note: TRICKY! The ".level" field in the nodeToEntity table is a lie -- it's actually facing, not level. So far as I can tell, you are in one level at a time.
Post Reply