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

Author Topic: Lufia 2 Compendium Editor  (Read 12578 times)

Zuqkeo

  • Jr. Member
  • **
  • Posts: 40
    • View Profile
    • Yaworg - Yet another website on retro gaming
Lufia 2 Compendium Editor
« on: January 13, 2013, 02:34:30 pm »
Hello all,

This is actually a project I wanted to work on for quite some time. The idea is to load all monsters,items,IPs,spells from a rom and allow the user to modify/edit these freely. I've got some screens of the actual thing running, but I still need to smoothen several things out before I'll upload the actual executable. The C++ source code will be in GPL2 license, so it'll be freely available for anyone. At the moment it can read/write stuff back into the rom, but only stuff that doesn't modify the length of the data in the game (e.g. data values such as HP, ATK etc only). In order to actually get modified scripts new monsters in there I first need to have the tool expand the rom and redirect the relevant pointers.

Here's an example of a common enemy on display in the my current working version. The quircky thing is that its attack script tries to recover some HP, but as far as I know this doesn't work in the actual game.

My main reason for posting here is, because I've gained almost all knowledge about the data in Lufia 2 from Relnqshd's documentation. However, since he no longer actively deals with hacking Lufia I'm wondering if there are other people who can help me fill up the gaps that are left over. For convinience and bookkeeping I've attached the relevant documents in a zip file found here:

 -Effects (containing all battle script commands)
 -IP data format
 -Item data format
 -Capsule Monster data format
 -Spell data format

The last two contain data that I compiled following the same construct as Relnqshd's other documents. The point is that several documents still miss relevant information for making a proper editor. Therefore, I'll gladly accept any missing information and of naturally give you proper credit for it. Here's a short list of things that are still unknown to me at this moment. These battle script opcodes are still blanks to me:

OpcodeRemarks
42 21 00 Used by a lot of IP's (e.g. Thunder Blast) 
42 22 00 Used by a lot of IP's (e.g. Devastation & other dividers) -> perhaps to ensure base damage = actual damage? 
42 23 00 Used by a lot of IP's (e.g. Blaze attack) 
44 ....  Used by a lot of IP's (e.g. Fury Force) 
4D ....  Used by a lot of IP's (e.g. Confusion) 
1D ....  Used by the Dark Warrior's Action script, I have no idea what this does 
30 ....  Used by the Nosferato 
50 ....  Used by Reviver & Miracle IP's 
« Last Edit: January 28, 2013, 01:58:50 am by Zuqkeo »

vivify93

  • Hero Member
  • *****
  • Posts: 1005
  • Summoner
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #1 on: January 13, 2013, 05:49:34 pm »
This would be freaking amazing and I would love you forever for this.
All my life I've tried to fight what history has given me.

ze10

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #2 on: January 13, 2013, 10:19:49 pm »
I have uploaded a zip file with some of Relnqshd's documents I found somewhere on the web. You can see it here:
http://www.romhacking.net/documents/632/
But, if you have an improved zip with updated documents, I guess you should upload to the site too. I wonder if it's possible for you to  update the file I sent.

I also have this URL which contains MANY random files, but it also has a few interesting documents:
http://web.archive.org/web/20091026213446/http://geocities.com/bernardalgain/Lufia2/

I have used that data to make a Lufia II Editor myself. So far, it edits monsters stats, name and pallete. It also edits spells' mp cost and gold cost. It can also edit monster attacks' names. But, the code is a spaghetti mess, because I've done it in C#, a language I've never programmed, and also I don't have much programming experience. Therefore I never uploaded it because I am not sure if it's stable enough for the public. =(

Btw, I think you are that guy I exchanged a few e-mails with a while ago. Nice hearing from you and your editor again. =)
Anyways, I hope your editor is more successful (and more complete) than mine. Good luck! =)

Jigglysaint

  • Sr. Member
  • ****
  • Posts: 316
  • Corruptomancer
    • View Profile
    • Stuff Jigglysaint has done(like discover the Crocomire in MZM)
Re: Lufia 2 Compendium Editor
« Reply #3 on: January 13, 2013, 11:16:16 pm »
I've poked around the rom a little bit.  I've found things like level data, map scripts, chest data, the code that draws the Ancient Cave as well as it's red and blue chest contents(a few tweaks and every floor has like 10 blue chests).

I'd have to though the data I found but if a proper editor is made, it would be awesome.  I do know for sure that pointers for item data and level data are all relative pointers.  If all the IP attacks are specific values, then there must be a table somewhere that can be found and disected.

Artemis

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #4 on: January 14, 2013, 03:25:18 am »
Speaking of monster scripts another obscure piece of code is at the beginning of the attacking scripts of Hades and Warm Eye. It's something like defending while getting mirror status. But aside from not working anyway (I think so) it's also impossible trigger that part (or only possible under very special conditions).

I also find it quite hilarious that out of the four final bosses on Doom Island everyone is slightly bugged in some way.

Gades doesn't use his strongest form - considering there is another stronger but unused version of him in the code. Instead it's used the same Gades you fight during the first half of the game, but at that point of the game it just feels so out of place.

Amon's loop counter concerning the usage of his wave attack can be manipulated by using some IP moves.

Erim: Same as Amon and three of her five attacks aren't addressed properly so that they will be never used.

Daos: Same as Amon and due to very bad coding it's even possible to inflict some status ailments on him.

Zuqkeo

  • Jr. Member
  • **
  • Posts: 40
    • View Profile
    • Yaworg - Yet another website on retro gaming
Re: Lufia 2 Compendium Editor
« Reply #5 on: January 16, 2013, 09:29:31 am »
ze10:
Thanks, I wasn't aware of the link those docs. I'll check them and use those as a base for updating if they contain newer/more information. It is indeed the idea to update them, but only once they're complete.

Jigglysaint:
That does sound like an interesting idea, but I think I'll start with the small stuff first like the monsters/battle scripts and expand from there.

Artemis:
Yeah, I once recall Relnqshd saying stuff like that the entire element system is broken in this game. It almost surprising that it doesn't play that bad at all, but it can use quite a lot of improvements. About the Sinistrals; maybe the programmer's were running out of time and rushed a little too much in the end. Not to mention that they're pretty weak to begin with. I see you Kureji patch improves the situation! It is quite impressive to see how much you've fiddled with the game. Although, my only criticism is that some of the boss battles are drawn out pretty long.

gadesx

  • Full Member
  • ***
  • Posts: 229
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #6 on: January 16, 2013, 11:12:52 am »
interesting, all the thing I made with lufia 2 is using codes only,
for example I found some codes for disable some npcs and they dissapear in each map
for example if there is a npc01,02,03, and they dissapear, all the events with these name in other map dissapear too lol
http://www.youtube.com/watch?v=ngRxcpl3-U4
but is only some codes for the ram, no idea about the position in the rom

npc 1 dissapear
7E062C14
npc 2 dissapear
7E062A14
npc 2 dissapear
7E062BDD

with this in the ancient cave each npc dissapear, but will cause bugs in other maps (the master slime in the B100 not appear with these codes  :D)

Artemis

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #7 on: January 17, 2013, 04:55:25 am »
About the Sinistrals; maybe the programmer's were running out of time and rushed a little too much in the end. Not to mention that they're pretty weak to begin with.

Yeah, that is my impression as well. Especially the errors concerning Gades and Erim should have been noticed while beta-testing - assuming they were not running out of time. And yes, they are so awfully weak, I mean for example why do Daos and Erim have so ridiculously less agility that you can basically heal everything they throw at you without problems in the next round?

I see you Kureji patch improves the situation! It is quite impressive to see how much you've fiddled with the game.

The original monster scripts were somewhat disappointing, because they are just so boring and bland. I mean why create a quite versatile battle-system if you then exploit its possibilities so lukewarm?


And one question: For which version is the editor? For a normal plain vanilla version or for a version patched with Relnqshd's expansion patch?
« Last Edit: January 18, 2013, 08:09:51 am by Artemis »

Zuqkeo

  • Jr. Member
  • **
  • Posts: 40
    • View Profile
    • Yaworg - Yet another website on retro gaming
Re: Lufia 2 Compendium Editor
« Reply #8 on: January 28, 2013, 02:09:22 am »
Okay, I've got a screeny here, which shows that modifying the palette has effect on the sprite shown in the window (Eggdragon/Firedragon share a sprite with an unused palette):

I still have to make the indices link to the correct compendiums so instead of "Show monster string $xx" it'll say "Show monsters string 'Sunny side up'" or so.

Artemis, as long as the format isn't changed the editor will (eventually) be able to support all ROMs. I'm starting out with the US version, but instead of hardcoding the offsets the code maintains a table and selects the offsets based on which ROM is loaded (by checking the header). If the Fixxxer patch doesn't do any really 'strange' things it should be able to load it as well.

However, I intend to make the editor store the data in a different order by expanding the ROM and moving all data tables to the new freespace. This however, will take more effort as all pointer/offset related code in the game needs to be found and replaced. By doing so it should be possible to add new monsters/items/IPs until the game runs into its limitation (e.g. 256 monsters).

Moreover, when the code loads the scripts the offsets are (internally) linked by the actual commands rather that integer offsets. This way, when inserting new commands in between, you don't need to manually recalculate all offsets. This does impose the restriction that the editor will only allow jump offsets that point to the start of a new command instead of an arbitrary byte number, which I think is fine as pointing to a byte halfway through the script makes no sense.

Artemis

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #9 on: January 28, 2013, 05:59:25 am »
However, I intend to make the editor store the data in a different order by expanding the ROM and moving all data tables to the new freespace. This however, will take more effort as all pointer/offset related code in the game needs to be found and replaced. By doing so it should be possible to add new monsters/items/IPs until the game runs into its limitation (e.g. 256 monsters).

That's exactly what relnqshd's expansion patch does (which is part of the fixxxer patch as well) - at least for monsters and IP names. If this were not the case, I would never even have started to make my patches like Kureji Lufia in the first place. So you might want to take a look how it's handled there.

Zuqkeo

  • Jr. Member
  • **
  • Posts: 40
    • View Profile
    • Yaworg - Yet another website on retro gaming
Re: Lufia 2 Compendium Editor
« Reply #10 on: February 07, 2013, 02:27:57 pm »
So far I've almost been able to import all the important data bases (Capsule Monsters/IPs/Spells/Items). I still want to add a tab for the playable characters. Because IP & Spells have little info I joined them together on a single tab. Plus I still can improve the ordering of the buttons/text boxes.


Once that is done I'll look at the way the Fixxer patch moved stuff like you just mentioned Artemis. Following the same principle it should be possible to dynamically write back all the data (with some effort...).

gadesx

  • Full Member
  • ***
  • Posts: 229
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #11 on: February 07, 2013, 06:34:17 pm »
good work dude  :beer:
if you need some help with somethin that require "change a value and try the game" over and over for make
a list for see that makes some value, I can help you btw I need some info of how lufia work
internally for a lufia fangame that I'm making  8)

PD: The really strange in this game is how the script is in the rom, is pseudo compressed or something.  :-\

Artemis

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #12 on: February 08, 2013, 07:13:18 pm »
Guess I forgot that there was already another editor in development by PaD. Everything's in German, however, and as far as I remember it only works for German ROMs.

http://www.sdc-forum.de/lufia/26149-ledit-lufia-rom-editor.html

It seems that the link to the editor isn't working anymore. However, here is PaD's contact data (just click on "Kontaktinformation"):

http://www.sdc-forum.de/mitglieder/pad-11124.html


Zuqkeo

  • Jr. Member
  • **
  • Posts: 40
    • View Profile
    • Yaworg - Yet another website on retro gaming
Re: Lufia 2 Compendium Editor
« Reply #13 on: March 02, 2013, 01:47:25 pm »
It's been a while, but last month I've been ill for most of the time, which doesn't help much of course. Otherwise I'm still working out all the pointers and stuff which is a lot of tedious but necessary work. I should be able to present something by the end of this month. So I'll be back later.

ze10

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #14 on: April 23, 2013, 01:45:12 pm »
I was wondering if there's any news on the development of this editor. It seems that messing around with it will be quite fun, so I'm looking forward to it. =)

Artemis

  • Full Member
  • ***
  • Posts: 217
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #15 on: April 23, 2013, 07:05:47 pm »
About some of the OP codes, here's some information from rlnqshd's documents:

Opcode   Remarks
42 21 00    stores (base ATP * 1.5) in register 80
42 22 00    does the following: reg($2A) = - (reg($80)*2 + target_statreg(base DFP)/2)
42 23 00    stores (base ATP +  temp ATP) in register 80 (there's nothing with a x3 multiplier here, however)
44 ....     ???
4D ....     ???
1D ....     "Cancel and continue"?
                 (clean L2BASM reg $22 to $63)
30 ....     ???
50 ....     A spell or attack where this instruction is used
                 will not be retargetted if it targets a dead party
                 member.
                 Is used for Rally and Valor (since those are the 2
                 spells that affect dead characters).
                 Could be used in other spells or attacks

ze10

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #16 on: June 19, 2014, 08:52:30 pm »
Sorry for the necropost, but I thought this can be useful to some people.

I have uploaded the Lufia 2 editor I was working on: http://www.romhacking.net/utilities/1066/  It's nowhere as nice or complete as Zuqkeo's seems to be, though. I have also released the source code if anyone wants to mess around with it.
« Last Edit: June 20, 2014, 01:45:56 am by ze10 »

Zuqkeo

  • Jr. Member
  • **
  • Posts: 40
    • View Profile
    • Yaworg - Yet another website on retro gaming
Re: Lufia 2 Compendium Editor
« Reply #17 on: November 02, 2018, 06:12:51 am »
Sorry as well for necroreplying this late on my own topic. :o

Ugh... it interests me a lot (in fact I can feel an urge to begin right now), but I know it's so much work to get everything done before the editor is anywhere decent to use. Ambitions, ambitions...

I'll go and look for the source, if anybody still cares.
Also good job ze10 on actually releasing something!

Shade Aurion

  • Full Member
  • ***
  • Posts: 220
  • Shadow Keeper
    • View Profile
    • DudeGoBack
Re: Lufia 2 Compendium Editor
« Reply #18 on: November 02, 2018, 08:12:33 pm »
I still care and Lufia II is still talked about. Hell, i'm doing a Frue Lufia 2 Addendum playthrough now with Vivify's tweaks. This was actually a really interesting thread to read. I'd love a full Lufia 2 editor to be made. Lol, i'd probably even try my had at a Berty and Bart (Jimmy and Tommy) spin off game hack that ties into the story. It would be amazing if Artemis' Frue Lufia could be amended again to have fixes for the sinistral boss fights (w/the unused Gades) and add in cut content. I really feel this game was rushed out unfinished but close to done. It'll always be one of my favourites :3

vivify93

  • Hero Member
  • *****
  • Posts: 1005
  • Summoner
    • View Profile
Re: Lufia 2 Compendium Editor
« Reply #19 on: November 02, 2018, 08:33:43 pm »
Artemis' Frue Lufia already uses the unused Gades, though, to my knowledge. Shoomy-Doomy Gades, as Relnqshd calls him, is used at the top of Shuman Isle Tower and on Doom Island in Lufia Fixxxer Deluxe, which was the basis of Frue Lufia. (Erim's Eerie Light, Thunder, and Dark Zap fixes are in, too.)

On the subject at hand, I am absolutely always interested in Lufia documentation and editors. If you're willing to keep going on this, I would still find this freaking amazing and I would still love you forever for it. :P
All my life I've tried to fight what history has given me.