Difference between revisions of "How Pikmin 2 loads text"

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search
m (Espyo moved page How the Game Loads Text to How Pikmin 2 loads text without leaving a redirect)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
+
{{DISPLAYTITLE:How ''Pikmin 2'' loads text}}
 
== Intro ==
 
== Intro ==
  
Line 25: Line 25:
 
[[File:burn in pickles.png|300 px|After i got the game to use only half as many treasure name entries]]
 
[[File:burn in pickles.png|300 px|After i got the game to use only half as many treasure name entries]]
 
[[File:textindex.png|300 px|This text is after the last valid index, so while it loads fine when loaded by index, its impossible to load it by ID because this game is dumb]]
 
[[File:textindex.png|300 px|This text is after the last valid index, so while it loads fine when loaded by index, its impossible to load it by ID because this game is dumb]]
 +
 +
[[Category:Notes]]
 +
[[Category:Pikmin 2]]

Latest revision as of 16:58, 16 February 2019

Intro[edit]

The way Pikmin 2 loads text is very complicated. That is why I am making a page to describe what I've learned about how it works and how I made new treasures that have text associated with them. The first thing to note is that the game loads text in 2 different ways. In cutscenes, text loaded in text boxes is loaded by its index in the BMG file. Every other part of the game uses the text's ID.

The way index loading works is simple. You enter what index the game should load in the cutscene's STB and it loads the text, even its brand new text after the last vanilla message. If the game only called text by index, we could easily add as much new text as we want. But it doesn't, the game ONLY loads text this way for cutscenes.

Loading text by ID is where things get messy, and unfortunately, its what the game does 99% of the time. you can change the ID of existing text boxes and it works fine. but adding new text boxes messes with the whole system. New text messages have to be put at the end of the list or you break the game loading by index. Unfortunately, the game will NOT load text by ID if the text's index is higher than the highest index in the vanilla game. In other words, you CAN NOT add new text entirely unless its being loaded by index, which is unlikely unless you're somehow making all new cutscenes.

How I Made Custom Treasures Have Text[edit]

Now to explain how my custom treasure has text that loads. Of course, all text associated with the treasure collection screen and piklopedia is loaded by ID. In the games boot.dol there is a line that tells the game to start reading treasure IDs at ID 0101_00. There are also lines that tell the game where to start reading Olimars log and Sales Pitch. Normally the treasure names stop at 0301_00 for the 201 vanilla treasures. After that there is a gap in IDs until 0401_00 where it starts reading Olimars journal entries. Olimars log goes to 0601_00 where the Sales pitches pick up right after starting at 701_00. It's good theres a gap between each group because that allows me to use ID 0302_00 to ID 0400_00 for treasure name text without having to change ID numbers for Olimar Journals. The issue is that, as I said before, I cant just add new text and move everything else forward, or all text messages past the highest vanilla index wont load. This means I have no choice but to overwrite Olimars Journal entries while changing their IDs to be in sequence starting where the vanilla entries end. I can then move Olimars Logs to replace sales pitches. Thankfully, theres no part of the code that tells the game to STOP reading text IDs after 301_00, and it just keeps using text for each treasure until theres a gap in IDs, where it stops.

It's worth noting that the game uses 2 copies of a treasures name for the collection screen and the pikopedia. After I post this, I'm going to experiment with it because I think I might be able to make the game use only 1 entry for each name, which would mean the names wouldn't overflow into olimars log and olimars log would only overflow into sales pitch for the first 50, keeping 151 sale pitch entries. This could be a big help, but no guarentee it will work.

Edit: It worked! this means treasure names only use half as many message ID. They finish around 0250_00 and leaves me with room to add olimars logs without adding any new text boxes and replacing anything. I'll update this again when its all done and I know exactly how to fit everything.

One more thing worth noting is that new treasure can not be assigned to any part of a set. It's not in otakara_config.txt, trust me its hard coded. This means even if I made custom text for the new treasures sales pitch, you would never unlock the ability to see it in game.

Thanks for reading! - PikHacker

This is treasure 202 in the pilopedia, complete with displayed name After i got the game to use only half as many treasure name entries This text is after the last valid index, so while it loads fine when loaded by index, its impossible to load it by ID because this game is dumb