Welcome to Text Welding 102

11 years ago by Mato

Very busy with real work, so progress is slowish on the sprite welding front. Since I have less time, I’ve been using what little time I have for hacking, so forgive the late/slow responses to stuff.

For now, I was going to answer a question someone asked about how the sprite VWF is actually going to do its stuff dynamically. It’s really pretty simple, but in my search for other informative graphical tutorials, I came up with nothing. So I was gonna make my own explanation real quick and figured hey, might as well make it a normal update. Again, this is technical mumbo jumbo blah blah jargon, so feel free to ignore it if you’re not into that sort of thing. But the following explains how most variable width fonts (VWFs) are implemented in ROM translations.

I’m assuming the difference between a static width font and a variable width font is clear by now. A static width font puts the start of each letter at a fixed (static) distance apart. Japanese text is almost always spaced evenly and in rows/columns, but in other languages we don’t do that. So that’s why variable width fonts come into play. We want letters to only take up as much space on screen as necessary. How to do that programming-wise is a bit complicated though.

So let’s do an example. Let’s say we want to print the word “Boobs” using a VWF. For the sake of brevity, we’ll only look at the first two letters here though. We’re also going to assume 8×8 letters, meaning 8 rows of pixels and 8 columns of pixels for each letter. Each letter has a grid like this:

So, in a fixed width font, the first two letters would be represented by this:

The start of the B and o are separated by 8 pixels because that’s the logical thing to do when handling 8×8 text. (Incidentally, the MOTHER 3 programmers illogically place sprite text 10 pixels apart when they can actually be 16 pixels wide each. Sounds weird, but it’s probably just to space things nicely apart)

But we want a VWF, so this is one way to do it. We’ll assume 1 bit per pixel format. MOTHER 3 later converts this to 4bpp so it can use different colored text, but we’ll talk about 1bpp only for now.

So let’s start with the first letter:

The B there is only 4 pixels wide. We have a table elsewhere in the ROM that has the width of each letter. We check it and it gives us the number we want for the letter we give it. But you also want to take into account that you want a blank column between letters, so we set the width of this B to 5 instead.

Now, we need to somehow make this next “o” fit in the right spot:

How the fark do you do that? The key is seeing everything in binary, you know, 1s and 0s. First, let’s look at how B is actually represented by 1s and 0s. (BTW yes, I know my o sucks. I’m not talented in the arts 😛 )

This is 1bpp, so each pixel is one bit. Each row is 8 bits, which is a byte. So each letter takes up 8 bytes. They’re stored in this order:

ROW 0
ROW 1
ROW 2
ROW 3
ROW 4
ROW 5
ROW 6
ROW 7

For “B”, every time there’s a pixel on, we set the corresponding bit to 1, otherwise we set it to 0. This makes the layout look like this:

11100000
10010000
10010000
11100000
10010000
10010000
10010000
11100000

I’m not even sure if that’ll show up in HTML right. But if you look closely, you can even kind of see the “B” pattern in there.

Now what we’re going to do is “shift” things around with how the “o” is stored, then sort of “stick” that on top of the B’s data. The o starts out as this:

00000000
00000000
00000000
01110000
10001000
10001000
10001000
01110000

Since the width of B is 5, we want to shift all of the o’s bits to the right 5 places. We get this:

00000000
00000000
00000000
00000011
00000100
00000100
00000100
00000011

Graphically, that will look like this:

So far, not too complicated, right?

Now, the next thing we’re going to do is a bitwise OR, which is one of the basic binary operations, to sort of “combine” the B’s data with the o’s data. Wherever there’s a 1 in the new o data, a 1 will be placed in the B’s data. The result is this:

11100000
10010000
10010000
11100011
10010100
10010100
10010100
11100011

You can do the bit math yourself to see how it turned into that if you want. The result is this:

Looking good! But wait, we’re not done yet. What about the rest of the o? We can’t just forget about it! People complained a bunch when we had incomplete hooks on our ys and gs and such way back when, imagine what people would say if we didn’t finish our letters horizontally either 😛

So what we do now is go to a new, fresh tile, which is where we’ll put the rest of the o. This time, though, we need to shift things left. How far left? We’ve already displayed the first 3 columns of the o, so now we need to NOT display those columns. So we shift everything left 3. The result is this:

00000000
00000000
00000000
10000000
01000000
01000000
01000000
10000000

This graphically results in this:

Now we’re done messing around with the o! Look at these two tiles right next to each other, and you have:

Perfect! But we’re not quite done yet, though! We need to update how wide this new tile is. We humans are smart so we can see right away how wide the text in the second tile is, but with computers, you gotta show it how to figure it out. One easy way would be to take the width of the B, which we set to 5, then add the width of the o, which we’ll make 6, since we need to include a blank column. That gives us 11. You can either divide this # by 8 and use the remainder as the new width of the current tile, or you can be risk-taking and simply subtract 8 from the current width. Both will result in 3. This will let the game know where to print the next letter in the current tile.

Now we can move on to the next letter and then the next letter, etc. etc.

And so this is how even a kind-hearted boy from Kokomo, Indiana can go from this:

to this:

Naturally, the current sprite welding stuff we’re doing with MOTHER 3 is a little more complex, as it involves 16×16 text and some memory address math junk, but it’s essentially the same process. There’s also the part where the game converts it into 4 bits per pixel, but that’s not too tough or much to worry about. The real tough issue comes with getting the game to allocate the correct # of sprites, and handling things like newlines and status icons in the middle of text. But that’s just how the game is.

Anyway, hopefully this helps explain the dynamic text welding process in more detail. I know lots of people assumed we’d be doing millions upon millions of premade combinations, but that’d be even MORE work to be honest 😯

Anyway x 2, I’ll keep people updated via mini-updates for the next few days, so don’t fret if there aren’t too many main page updates for a few days. Can’t keep the 1 update every day or two thing going forever 😉

Posted on Saturday, March 29th, 2008 at 3:32 pm by Mato, filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. Comments and pings are currently closed.

117 Responses to “Welcome to Text Welding 102”

  1. PSI Supernova said 11 years ago:

    HOLY BORANGE THIS IS AWESOME

  2. Dan said 11 years ago:

    way to go mato!

  3. Aphrodine said 11 years ago:

    I love you.

  4. spam man deluxe said 11 years ago:

    Feel like I’m always saying the same thing here, but good job. Don’t want you to feel unappreciated!

  5. Morgil said 11 years ago:

    LOL Boobs!

    This was a bit technical and confusing for me, but it’s still cool reading these and getting a sense of your level of progress. I know it’s hard and all, but thanks and please keep up the good work.

  6. ParodyKnaveBob said 11 years ago:

    ha ha tsrif isn’t first anymore

    Thanks for the reply, Mr. Mato. Somehow I’d gotten the impression the main script displayed in sprites, thus crashing everything when it went over the limit. My mistake. Hooray, no need to sprite-weld-per-frame! Boo, M3 is still messy in the script!

  7. Saunis said 11 years ago:

    Nice one! Keep up the good work.

  8. Anonymous said 11 years ago:

    You’re the greatest. Keep it up!

  9. Molo said 11 years ago:

    Hahaha, awesome.

  10. MatCon said 11 years ago:

    Fantastic!

  11. Exp HP said 11 years ago:

    Man, I love all the updates that occur when I’m in the process of reading updates (and the discussions that follow)! It’s a happy moment when I refresh at the end of a discussion to see the “Leave a Reply” thing disappear from the bottom.

    By the way . . . the favicon isn’t displaying on my computer. I’m using Internet Explorer 7, and all I see at the top, the current tab, the link in Favorites, and the taskbar is that lowercase e with the ring around it.
    The only image related problem that I know of with my computer is that GIFs embedded in any website will not animate regardless of what browser I use. But I highly doubt that’s related (favicons are not gifs, and a gif still would show up, it just wouldn’t animate), so I’m stumped.

  12. Twomby said 11 years ago:

    Thanks for the explanations Mato, always appreciated 1

    EXP HP : Try to empty your Internet Explorer Cache to see if it might fix the problem ! Worked for me ! If not, try switching to Firefox, had no problem whatsoever and even the Beta 3 release is more memory efficient than IE7. 🙂

  13. Nick said 11 years ago:

    Hey Mato. Looks like fun, keep it up. 😀

  14. Reanzet said 11 years ago:

    its amazing what one misses when one goes out-of-state…Hooray for sprite-text welding!

  15. Spidah said 11 years ago:

    This looked very boring, but it looks like all is going well with the translation and stuff! Hope to see more updates in the upcoming week.

  16. jozhear said 11 years ago:

    Hurrah! excellent as always, a cool read. it’s cool to see stuff behind the scenes, so to speak.

  17. Aaron said 11 years ago:

    w00t for the Hoosier State! (But not for the Hoosiers, since I’m a Boilermaker…)

  18. starmand said 11 years ago:

    So, the reason why one might want to use sprite text is that you only have to set one bit to 1, instead of setting all the individual bits for each part of the letter?

    I love how this blog has become a great resource to learn little bits and pieces about hacking & programming in general. Thanks again for all the hard work.

  19. Mato said 11 years ago:

    No, actually the method I described was a basic, general version that applies to no one type of text in particular. Sprite text is a bit more complicated because you also have to do things to initialize the sprites correctly. The only advantage of using sprites is that once you have sprite text created, you can show it anywhere on the screen with easy x,y coordinates, and you can turn the sprites on and off with the flip of a bit in OAM land.

    Things get even more complicated when you have to consider how to move from one tile to another, the fact MOTHER 3 uses some sort of buffer struct array, the layout of the 16×16 tiles, etc.

  20. mitch said 11 years ago:

    Pursuant to out agreement, mato:

    http://i27.tinypic.com/2wcgqgz.png

  21. FennecusKitsune said 11 years ago:

    That is such an ingenious solution to the whole sprite text stuff. That was a great explanation. Something I was kind of wondering was, since all these sprites will be generated dynamically, will the overhead of calculating the sprites affect gameplay at all?

    Keep up the good work. It’s very exciting and interesting to see the technical details.

  22. BFM said 11 years ago:

    lol, Kokomo.

  23. yas (I forget what name I used last time) said 11 years ago:

    Mato, your blog is like crack. Intellectually stimulating crack (the worst kind). What am I going to read when the patch is released? If I ever do some ambitious project like this (pfft, who knows) I figure I’ll probably follow your example of blogging. If nothing else, it kinda looks fun 😀

  24. MinunQ said 11 years ago:

    I know this has nothing to do with today’s update, but I was watching the naming screen video, and I noticed that there’s no option to put Japanese symbols in the character’s name. Is that going to be permanent?

  25. JeffMan said 11 years ago:

    Yeah, the alphabets will stay English-only. There simply aren’t enough letter values in 8-bit mode to include the kana fonts.

  26. MasqueDeMask said 11 years ago:

    this update is kinda boring.

  27. Mato said 11 years ago:

    mitch: Damn you rock. If you want, when this is all over, we can sell an art book or something of your stuff somewhere (assuming none of it has copyrighted characters or anything 😛 ) and you can have tons of the profits. Or just nothing at all, but your art (not just this stuff, the stuff I seen on 4cr too) is really awesome 😀

    FennecusKitsune: It shouldn’t affect sprite text much at all, as it’s mostly loaded once, usually between a screen transition. The main text welding that we’ll have to tackle eventually will definitely be something we’ll have to be careful with or things may start looking bad/acting weird if things don’t make it in time for vblank and all that scary hardware jazz.

    yas: Last year I had a crappy log thing going with my EB0 remake hack, after this is all over and if I’m still alive, then I might turn that into something like this maybe. Or there’s always my regular boring (and mostly EarthBound) blog too.

  28. mantendo said 11 years ago:

    Oh wow, you’re updating like every single day now ^^

  29. John Handley said 11 years ago:

    I’m loving these detailed explanations! 😀

  30. Steve said 11 years ago:

    Great article, thanks Mato! I do have one question, though. How do you make the text appear letter-by-letter when some letters appear on multiple tiles?

  31. Exp HP said 11 years ago:

    Steve: The text that this welding hack applies to does not appear letter by letter. This text appears all at once.

    I think all text that appears letter by letter is normal, non-sprite text.

  32. wtfitsed said 11 years ago:

    YAY BOOBS!

  33. TheMetroidMan said 11 years ago:

    Hey Mato I have a question for yah! That random link that you had with the show about Bob Sapp and the asian guys was HILARIOUS! Do you have any other episodes done or was that like a one time thing? My room mates and I were laughing wicked hard while watching it. Back on track, this update really puts things in perspective about how “sprite welding” works and stuff. Hopefully you won’t run into any more trouble down the road! Thanks so much for everything you have done!

    P.S. I know you are contracted for FUNimation but I was wondering if they are still working on putting more Case Closed DVDs out because I f***ing love that show and it made me laugh when I saw your name in the credits for the DVD release. Hopefully this isn’t too many questions! THANKS FOR EVERYTHING :)!!!

  34. mitch said 11 years ago:

    Mato: Thank you very much! Sounds silly, but, that means a lot coming from you. In the mean time, this is just a fun way to get some practice 😀

  35. SAM-E-BOI said 11 years ago:

    WOOT!! New update!!

  36. Twitches said 11 years ago:

    Thanks Mato, your blogs are always so interesting keep up the amazing work!

  37. player1or2 said 11 years ago:

    haha, i laughed at “Now, we need to somehow make this next “o” fit in the right spot:

    How the fark do you do that?”

  38. someone said 11 years ago:

    I’m one of those who assumed that there were going to be so many premade combinations, and you know when you assume you………. well you know the saying.

  39. Moog said 11 years ago:

    A continuation of the earthbound zero to earthbound hack would be delicious, however, first things first 🙂

  40. neo said 11 years ago:

    b(.)(.)bs

  41. G.Wicks said 11 years ago:

    You really have a knack for explaining complex things to un-smart people like me. This entry was really interesting, I’ve always wanted to know just how VWF’s worked, and it’s pretty much like I suspected… sorta. Really cool stuff dude, thanks for letting us inside your head.

    Beeeuuuuuooobs!

    P.S. Every time you mention the EB Zero remake I get butterflies… so I hope you don’t just scrap that, I’m really interested in a well-done EB hack. I think EB is waaaaaaaay overdue for a really solid fan made hack! Plus EBZero pwns children and small animals. But I know, I know…. one thing at a time.

    At this point, Mato, you must realize that you’re a godsend to EB fans all over.

  42. NecrosaroIII said 11 years ago:

    With as much as you have had to play through Mother 3 and analyze each detail, I wouldn’t be surprised if you don’t like Mother 3 anymore, Tomato.

  43. Apterous said 11 years ago:

    Haha Kokomo. Mato, I’m in West Lafayette. =P

  44. Damn Impressed said 11 years ago:

    It must mean something you made this update FOUR HOURS AGO and I’m more than the 50th response. This is my first time writing but I just want to say: Thank you for working so hard. Not only are you working very hard (which is in itself a talent), but you ‘re also just so good at what you do.

    Do you discuss how you edit stuff itself? What is it programmed in? I hope I can find some more information if I dive into some earlier updates.

    Keep up the sexy work.

  45. Janus said 11 years ago:

    Ahh… That’s really cool 🙂

    I award you fifty awesome points. ( ‘_>’)

  46. ty said 11 years ago:

    Look at the size of this update… Its gigantic! How does he do it? 10 arms arms and 3 brains.

  47. ohhhhh said 11 years ago:

    OHHHHHHHHHHHHH if the work keep continue at this way,,, i think we have the project done before 2009 🙂

  48. someone said 11 years ago:

    I’d say a little more in the arms department and 4 times as much in the brain

  49. baxter said 11 years ago:

    Off topic, but Mato, the translated Itoi interviews are top-notch, any more would be greatly appreciated. Having any of that stuff in English is in my opinion very important to the Earthbound community. I mean, if I’m a fan of an artist or director or musician or writer or whatever, I like to go and read a few interviews to gain more perspective and hopefully insight into the artist’s mind. I don’t have that luxury with Itoi, due to the Japanese language barrier, but any more translation you do I’ll look forward even more than individual updates here.

  50. catapult37 said 11 years ago:

    Wow, a whole post just for me! 🙂 Thanks a lot for a fantastic explanation. It’s pretty cool that since it’s 1 bpp you can just use bit shifting, cause it’s super fast. I’m impressed that you take the time to blog about all this stuff, when many programmers can’t be bothered to document their own code that well.

    Also: You’re from Kokomo? Hi from South Bend!!

  51. trebulator said 11 years ago:

    Delicious updates.
    I’m gonna miss the techno-babble after this patch is released; its become a habit to check this site twice a day. 😀

    I have a question, but I’m pretty sure of the answer though… anyways:
    Is it all possible to impliment this into the main storyline, or is it gonna have to stay accessable from the debug menu only? It seems like an insanely awesome part to miss out on.
    –SPOILERS–
    (link removed)

  52. Unsavory Maggot said 11 years ago:

    Hah. I actually expected you to describe how to make it write the entire word instead of the first two letters for some reason. 😉 Still, neat stuff!

  53. Dr. Meat said 11 years ago:

    Why would you want to add that? Yeah it’s a cool curiosity but you’d have to rewrite the game to include it.

  54. trebulator said 11 years ago:

    Nevermind, I found a conversation on this already.
    “The way the story went it would have little relevance, besides a final plot twist that nothing hinted towards. First we’d probably have to analyze, why would this fight happen in the first place?”

    I didn’t play the game all the way through (save corrupted then decided to wait for the patch), so I wouldn’t know.

  55. tobias26 said 11 years ago:

    Next time you say that you’re busy with real life stuff and “didn’t get much done,” and post something as crazily intense and productive as this, I’m calling you crazy. 😀

  56. madlobster said 11 years ago:

    Wow, what a headache. I’d hate to have to do this in a higher-level language such as c++, let alone asm. Looking forward to seeing it finished!

  57. Mato said 11 years ago:

    Holy whoa, how DID such a boring update get so many replies so fast 😯

    First, just wanted to mention I’m not from Indiana, that’s just me referencing some old past stuff that maybe only people who’ve been around the EB scene a while would understand 😛 I’m actually originally from the deserts of AZ, though I now live on the moon.

    Steve: Luckily none of the sprite text gets fake-typed out like that, it all just appears instantly. When we get to the main script text, that will indeed become a very important and probably painful thing to work in. Again, the battle programmer was cool in the way he did his printing, it made all of this stuff a breeze; he wrote some super fancy code that already did all of this bit shifting garbage for us. Sadly it’s not really re-usable code for non-battle stuff 😐

    TheMetroidMan: That was simply one episode of the show. I have probably at least 100 eps of the show on tape, I’ve been meaning to subtitle many of my favorite ones. But you know me, always busy with bigger projects 😐 Someday I’ll get around to doing some more. Glad you liked it though. I’m hoping it’ll get passed around a bit, it’s one of my most favorite things in this world of all time.

    As for Case Closed DVDs, I don’t know what FUNi’s release schedules are really, but I know they dubbed up to at least ep 120 a year or two or three ago, and I’ve subbed a bunch of eps that haven’t been released yet. So they definitely still have stuff they can release, just don’t know when they will. I think they’re bummed by how its sales, even though all fans of the show are huge fans… kind of like EB. At least FUNi didn’t say how this show stinks or nothing 😉

    NecrosaroIII: Working on the game, you don’t really play it too much. You sit there and stare at code and repeat the same 2 seconds of gameplay over and over until a hack is done, then you move on. When I step back and play it for fun, it’s still really cool 🙂 I remember having to play through Bahamut Lagoon and Star Ocean dozens of times each to do thorough testing, but I never got too sick of them either. I guess I don’t think about that when it’s a project I got pride in.

    Damn Impressed: I’m not sure what you mean by “edit”, but yeah, there’ve been posts about what tools we’ve created and what other tools we use. Most of the stuff is done with custom-made data convertors and insertors and such. I use simple ol’ C for most of my stuff, I’m not sure what Jeffman’s tools are done in though. C#/.Net? I don’t know, I haven’t kept up with programming languages for the past couple years. I’m an old C man.

    baxter: One of my plans once this project is done is to go on a translating spree and translate as many interviews as I can. It’s sad that there are so many info-filled interviews out there, but almost none have been translated into English. His big Nintendo Dream interview about MOTHER 3 was especially awesome.

    trebulator: Nah, we’re not gonna add that back in. There’s no way to know how it was supposed to play out to begin with, and most of the data (events, text, actions, etc.) related to it is probably completely missing.

    madlobster: It’d actually be a good deal easier in C probably 😛

    ———

    Whew

  58. mitch said 11 years ago:

    FOUND: Reid’s pants.

  59. Exp HP said 11 years ago:

    My best guess would be Jeffman wrote those programs in C#, Visual Basic, or some other .net language. Those make it very easy to create windows and widgets that function properly.
    Although I think D@mn Impressed was referring to MOTHER 3 itself. That’s in Asm. So the code has no documentation, meaning these poor guys can’t just start hacking it . . . they have to figure out first what the heck it’s doing and why before they can change it, and interpreting undocumented code written by a terrible menu programmer is not easy.

  60. Vague Rant said 11 years ago:

    We need a name … maybe “Operation Hack Mother.”

    Cookie to whoever gets it.

  61. Nutsjesmoar said 11 years ago:

    Boobs rock. Sprite welding rocks. PK rock out.

  62. reidman said 11 years ago:

    You better hope my mom isn’t reading this! She would be pretty upset with your flippant and irreverent use of the word ‘welding’.

  63. Anna said 11 years ago:

    Very cool, Mato. Though I’m with ParodyKnaveBob in being surprised, I thought the main script was just sprite text and once you did this hack, yay! A jiggle here and a wiggle there and the main script works! Bummer to hear that’s not the case. Wishful thinking and selective hearing I guess. =\

    Those of us who are into programmy-stuff love to hear the technical things, so feel free to vent any time. 🙂 And if you need someone who knows how Nintendo handheld hardware works to do any sort of bitchwork my offer still stands, especially if it’s bitchwork that won’t spoil me too badly hehe. 😀

  64. Anna said 11 years ago:

    Oh and I had a stupid question: are GBA games written in C nowadays? Or are they still mostly hand-written in assembly? Or maybe some kind of weird hybrid?

    I’m curious if you’ve ran any kind of C decompiler on the ROM or anything, although I’m sure that even if that worked it’d be of dubious use. However maybe if it worked it might untangle some of the gnarlier knots since it might be easier for your brain to parse it since even the worst C seems easier to visualize than assembly. Then again I could very well be horribly wrong.

    Not sure what I’m going with this except that this inspired me to start a discussion with some of my friends about how if I ever had to use a C decompiler for anything serious, instead of having it be like intvar1 intvar2 intvar57 or whatever boring standard, I’d have it pick from a list of happy words from the dictionary. Rainbow, orange, sunshine, muffin, ponies, monkey, stuff like that.

    It’d be less frustrating to pick apart the code, I think, because when you ran across things like
    if (monkey > muffins) {
    rainbows++;
    }
    how could you not smile at that 😀

  65. Edrees said 11 years ago:

    Mato, you’d be a good teacher too you know. That was a pretty clear explanation! THANKS …oh and as always keep up the amazing work!!!!

  66. Moulinoski said 11 years ago:

    …This seems useful. 0_o At first, I thought you had to do stuff in Binary, though! O_O

  67. someone said 11 years ago:

    Just for the heck of it.

    PK Sprite-weld or PSI Sprite-weld

    My old Earthbound game was weird. It used PSI sometimes, as it should, and PK the rest of the time, like in Mother2.

  68. Mr.vort said 11 years ago:

    When this is released, I will sacrifice many peeps in the microwave.

    In your honor of course.

  69. MotherAddict said 11 years ago:

    I have been watching the updates and progress quietly for about half a year and just want you and your team to know what a great job your all doing and how nice it is of you to use your spare time on the english speaking mother-fan. I also want you to know how interesting these ‘behind the scenes’ updates are.

  70. TheReaper said 11 years ago:

    Well Mato thanks for explaining how to print the word “Boobs” using a VWF,now I finally understand the 1 and 0’s.

  71. Roland said 11 years ago:

    Hey Mato, nice update. Before this, I was really just scratching my head about the whole Sprite Welding deal, and the update really cleared things up for me. I’m glad to see you guys are really going all out with this, keep up the awesome work.
    I have one quick off-topic question. You guys are doing a lot of hacking for this. Approx. how big will the patch file be? And how greatly will it increase the size of the ROM? I know you probably won’t be able to tell until all is said and done, but will it it make to ROM OMG HUEG?

  72. Mato said 11 years ago:

    The amount of code changes is probably less than 1KB. Most of the changes will be in the game data. The final patch will probably be a meg or so, zipped up it’ll be less. It won’t change the size of the ROM though; the ROM is already the maximum possible size for a GBA game.

  73. andeh said 11 years ago:

    you can do it! ^^

  74. Vinchenz Rock said 11 years ago:

    Doesn’t make very much sense on HOW to do the work, but I can see how it would work on the game. Great work, Mato!

  75. Slayzer said 11 years ago:

    The sad thing is, I just learned about this in Assembly at school last Tuesday. It seems this does have a real use. :3

  76. TonE said 11 years ago:

    Hey! question: I am an aspiring animator/comic artist and I do alot of american anime. I was wondering, since it ties in with VG, what should I do to get my ideas out there for developement(and maybe profit). Im only askin’ cuz my horoscope said i should….

    sprit welding looks TEEEEEdious, lol.
    keep it up!

    some of my work is on starmen.net under darkNESSomega

  77. ArashiSai said 11 years ago:

    When this patch is done, I am going to jump around the house yelling YES!!! in celebration, most likely causing everyone around to go WTF?

    And Mato, after 2 years of Japanese studying, do you think I might, within a couple of months, play M3 without the patch? (opens books and notes and starts studying just in case)

  78. ArashiSai said 11 years ago:

    whoops, I meant “be able to play …

  79. jluu said 11 years ago:

    interesting stuff!

    I might try this once I free up some time for myself.

  80. Mato said 11 years ago:

    Anna: I appreciate the offer, but I think we’re okay. Plus part of the reason harmony and exophase and the others helped a little and vanished is because trying to catch up with stuff takes more time than it’s probably worth it. Already the project spans over 85 different files, more if you count the source text files. I’d only consider getting more programming help if I knew 1000% the person would be able to do what we need exceptionally easily (and who we know and trust), but such people are rare. Not to mention, many of the things left to do WILL involve big spoilers.

    I don’t think any GBA games are written in anything these days though 😉 But back in the GBA days yeah, I think it was all high level stuff by then, probably with some asm inlining too.

    TonE: I’m not really sure what you’re asking, I’m also not sure what you mean by “do American anime”.

    ArashiSai: How have you been learning it? Most likely I’d say no. This isn’t exactly related to your question, but it should give you some insight on how to study and when you might be able to do certain things: link

  81. Exp HP said 11 years ago:

    Well, it seems like Mother 1 might take long enough to hold me over for the patch.

    I spent all the free time I had today just grinding in Magicant to raise money (I didn’t have much time to play today). All I needed was one Gold Ring, one Magic Coin, one Boomerang, and two H20 Pendants to optimize Ninten and Lloyd’s equipment. After a full day of grinding, I still don’t have the Coin or either of the Pendants. And I had a 2000$ head start from all that time not spent shopping!

  82. Overload said 11 years ago:

    I’m gonna be going to a game programmers school as soon as I graduate, so hopefully I’ll be able to do stuff like this. Maybe I’d even be able to make a Mother 4 on my home PC if I get good enough. XD

  83. Kumatroa said 11 years ago:

    WOOT Keep up the great work, it’s so close I can almost taste it. Nice job!

  84. Anonymous said 11 years ago:

    I can’t wait for this new patch to come out. Keep up the awesome work!

  85. Clay Handley said 11 years ago:

    Hey there, Anon.

  86. Nutsjesmoar said 11 years ago:

    (text removed just in case)

  87. Mato said 11 years ago:

    Nutsjesmoar: Yes, the names are already correctly spelled.

  88. Nutsjesmoar said 11 years ago:

    cool

  89. Biiaru said 11 years ago:

    Mato, I must say, I often find these technical articles more interesting than the other stuff. You should post up more stuff like this telling us about the inner workings.

    Also, keep up the good work! Really really really can’t wait to play this 😀

  90. Jeffrey said 11 years ago:

    Wow! That looks really confusing, how long did it take you to learn things like that?!

  91. Mato said 11 years ago:

    Most of the stuff I described there is very basic stuff you’ll learn right away if you learn how to program. The method of combining the letter data that way is really the only thing that’s noteworthy.

  92. Mato said 11 years ago:

    Very slight update — I was testing out the latest WIP of the new VBA-M that some cool people are working on when I noticed that it looks like the main script shares a routine with the sprite text routine, the one that basically copies a letter’s tile data from ROM, converts it from 1bpp to 4bpp, and stores it in the appropriate buffer area. I didn’t expect this, and it’s kind of cool, but there’s a chance it might make main script text even harder to do, because the main script text will need to print out letter by letter while sprite text doesn’t. But we’ll figure it out as we get more done. There’s still the possibility it won’t make a difference. It really is hellish trying to juggle work and this and everything right now. I wish I could just work on this for a few good days. Gonna be super busy with work for about 10 more days, but I’ll keep hacking away bit by bit anyway.

  93. KKH3049 said 11 years ago:

    so how would you put it in the code in C+, or C# whatever you use.

  94. Mato said 11 years ago:

    I don’t feel like writing out the whole thing, so here’s some crappy, inefficient pseudocode.

    get current width
    for row 1 to 8
    {
    new_letter2_row = letter2_row >> width
    letter1_row |= new_letter2_row
    next_tile_row = letter2_row << (8 – width)
    }

    width += width of the current letter

    if width > 8
    {
    width %= 8
    make the next tile the active tile
    }

    repeat for all letters

  95. 8BitWalugi said 11 years ago:

    yay! keep up the good work!

  96. Unsavory Maggot said 11 years ago:

    Wow. That link was exceptionally useful. Not to poke and prod, but what university/college did you go to prior to graduating high school? After? And In Japan? When you got back?

    I guess the better phrase would be… where would you recommend an aspiring bilingual student-to-be to go? I’m not exactly looking for any one particular trade to tie me down, but I hope to learn as sufficient an amount as your documentation has suggested, so that I may experience multiple trades in my lifetime.

  97. Exp HP said 11 years ago:

    Funny, that code is a lot like how I would’ve done it. Or, never mind, it’s just that my eyes went straight to the &=, which is the last valid thing in mine.

    Although, in C#, it would’ve been in a class within a module within a class within some more rediculous unnecessary heirarchy. And it would’ve only worked on Windows (meaning it would absolutely not work for a GBA game). Like this:

    class Program
    {

    //
    //…
    //Other code
    //…
    //

    void DrawSpTextLine(string Text);
    {
    int currentSprite = 0;
    int totalWidth = 0;
    for (charIndex=1; charIndex++; charIndex==Text.length)
    {
    /*BitChar is a OneBppBMP (see next comment) representation of a character, with its width included (upon initialization, this is determined from a table). The char2BChar function returns a BitChar based off a character.*/
    BitChar currentChar = char2BChar(Text(charIndex));
    BitChar nextChar = char2BChar(Text(charIndex+1));//error on last element, but easy to fix later
    /*The elements of SpTextBmps are OneBppBMPs (8×8 1bpp bitmaps, that are 8 bytes (row1, row2) that represent a row of pixels) for each sprite in the row of text. They have an operator+ function set up that performs a bitwise OR operation on each row, and a Shift function that shifts all pixels left/right a certain amount.*/
    offset = (totalWidth &= 8)

    SpTextBmps(currentSprite) += …?


    aw, tartar sauce, I found a problem with the rest of my code. I had a working system for how to go to the next sprite (the code you omitted; it’s easier in my example due to the array). My problem was that the code was offsetting to the left and it would’ve made some letters completely shift off the left side and not appear at all! I can’t figure out how to fix it. Rats.

    Um, what do I do? I know, act like Mr. Saturn! BOING!

  98. Exp HP said 11 years ago:

    DANG IT, IT JUST WON’T LET ME POST MY LITTLE PROGRAM HERE!

    I wrote a C# equivalent to Mato’s thing, and I spent a long time doing it (I made up many class types, such as BitChar and OneBppBMP, and defined them fully, down to functions like Shift, operator+, and char2BChar).

    All that hard work wasted. Oh, well. The last part of it didn’t work (the first letter or two in each box would be offset too far left and wouldn’t have shown up).

  99. Mato said 11 years ago:

    Spent about an hour and a half on stuff tonight, not too much has happened except I fixed something and also moved a hack. Also noticed that before you move to a new tile, the game clears that tile out… which isn’t good if you’re tricking the game to stay on the same tile until the time is right. So I tried to disable that, and it seemed to work, but it’s still bleh. If only I could find more time in a day :/

  100. Andrew said 11 years ago:

    im amazed at how good things are looking~! goood job!!!

  101. Dondey Kong said 11 years ago:

    You guys are the shit!
    i remember when i was a little kid scratching and sniffing the fuzzy pickles thing in Nintendo power

    ive waited for the longest time for this shit

    cant wait fellas!
    keep up the great work!

  102. Exp HP said 11 years ago:

    Oh, hey, my post did post!

    Riiiiight…….

  103. Damn Impressed said 11 years ago:

    I read that you were actually a TRANSLATOR, but now you seem to be the one doing the programming, too. I bet there’s nothing you can’t do. If I ship you some coal, will you transmute it into gold and send it back to me?

    What’s really interesting is that you said “I don’t have much time” and then proceeded to make more changes. 99.9% of the time when you read “I don’t have much time for the next week”, it really means “I am so sick of this project and will be slowly removing myself from it through the power of apathy.” But you’re still working hard.

    By the way, has Nintendo contacted you? I’d think what you’re doing is borderline illegal (changing their intellectual property and all that.)

  104. A Fan said 11 years ago:

    DI: Nintendo had an article on it. They don’t seem to care. If anything, they’re being quietly supportive & various staffers may be wanting to *play* it… 🙂 If they were going to stop him, they’d have done so ages ago.

    And Mato, glad to see it’s coming along even this well 🙂 Wish there were a cheat code for this, like “unlimited free time” heh. Surprised you put a conditional around the modulus, though. 7 % 8 == 7 last I checked 🙂 But I don’t think you’re so starved for bytes that one or two matters, this is just a left over habit from Lance’s instruction, which I know you also remember 🙂

    That man was crazy about making us shave a few bytes. I still remember that one routine where you wanted to reused part of it, but you had to preserve ALL registers. So the best way was to have each start at a different place, that did nothing but store your current instruction pointer and jump to the main part (which stored everything again). Then you grab the pointer to yourself off the stack, and look a couple bytes after it, where you hid some data. Now that was screwball, but it saved one or two bytes in the end, even if it made me wonder what he was thinking at first 🙂

  105. Kamon said 11 years ago:

    This is so awesome. I always wondered what went on behind the scenes in something like this. Way to go, guys!

    And as far as I can tell, what they’re doing isn’t technically illegal, as long as they all own a copy of the actual cartridge. At that point, owning a ROM of it on your PC is legal, and they can’t get in trouble for editing what they own I don’t think. As for distributing it, if they put a tag on the download for the patch notifying people that it’s not legal to own/edit the ROM if they don’t own the cartridge, that should be fine too.

    And I had one odd question about the game. Are there any secrets like the Rock Candy cheat in Mother 3?

  106. eb master said 11 years ago:

    Wow, it really goes through all that? I’d have just thought that one could insert some code to make all completely empty columns just not display or some such.

  107. MasterInsan0 said 11 years ago:

    Damn Impressed, I think we’re all hoping that Nintendo doesn’t contact Mato or anyone else in the translation group. I mean, they know about it, so I’m just sorta hoping it’s either done before the higher-ups get around to dropping the hammer, or they let it slide since they know the fans want it.

    Honestly…the first is probably more likely, because they knew the fans wanted M3 in the first place, and they ignored us. Still, I think most translations slip by relatively unscathed, especially if the company has no plans to bring the game to our shores.

  108. shade said 11 years ago:

    “Hacking away…”

    I just pictured a ‘Mato with an ax, going ballistic on a Hostile Elder Oak, and little green ones and zeros flying out, rather than wood chips.

    May the psychokinesis be with you. I just wanna see PK Starstorm in action again.

  109. Inzoum said 11 years ago:

    A Fan: “Surprised you put a conditional around the modulus, though.”

    If you look again, you’ll notice that within that conditional statement, that pseudo-code doesn’t only apply the modulus, it also moves the pointer onto the next tile. Checking whether the max width has been exceeded is essential to determin whether a new tile is needed, and if so, where should the next character on that tile print.

    There is one thing missing, though… if a character is broken in half at the end of a tile, that conditional statement should also print the other half on the new tile (with a negative offset) before moving on to the next letter…

  110. Mato said 11 years ago:

    Damn Impressed: It’s a long read, but here is a lot of interesting background info which includes Nintendo-related stuff. I think aside from releasing the game themselves, the next best thing they can do is look the other way when it comes to this project. Everyone knows about it, even Reggie, who’s gone on record about it. If they wanted to do something, they could’ve (and thus maybe should have?) long ago.

    A Fan: My pseudocode there would save cycles (doing division is pretty costly too) and make more sense to people reading it. Which is the point of pseudocode 😛

    Kamon: The Rock Candy thing was more of a glitch than a trick, but there’s one that’s almost equally as cool in MOTHER 3 – you can almost do a New Game+ type of thing. I forget how to do it but it involves copying a save to another slot and then erasing it and starting a new game there or something. I forget.

    Inzoum: that’s done by this: next_tile_row = letter2_row < < (8 - width) in case that wasn’t clear.

    Getting this all to work with MOTHER 3’s code is pretty sucko though 😐

  111. Coconut of Enlightenment said 11 years ago:

    Just marking my place.

    Thanks for the update!!!

  112. Blog Reader #31415 said 11 years ago:

    Alright, I have a question, but I don’t really know how to ask it… Well, let me see…

    Are the sprites for the text created by the game instantly, based on the data and calculations that you described? Or it’s something else?

    If it’s something else, then I really didn’t get this >_>

  113. Mato said 11 years ago:

    I’m not sure what your question is, to be honest. The sprite text is created on the fly by the game by copying font data from the ROM. The method I describe above is how to make it so the sprite text “welds” together to create a VWF.

  114. Anna said 11 years ago:

    Wow good luck Mato. This is why I really wish I could lend a helping hand somehow–I don’t have piles of free time either but the way things are for me at the moment I have a decent amount that I really wish I could “donate” somehow. This alone is rad but you do so much for the Mother community and have so many other rad projects–! I still have never gotten around to playing Earthbound 0 for instance, too DQ-grindy. I’d rather play your version for the first playthrough. 😀 And the Itoi interviews and all that other stuff you translate and oh yeah I was really enjoying your Mother 2/Earthbound comparison the other day… I’m impressed, Tomato, you are a true Mother machine and the more I learn about Mother fandom I’m not sure it would even exist the way it does without you. 🙂 I really wish there was a way you could just work Mother projects all day! PK-Callin’ Reggie’s office for you to be a full time Mother/Earthbound promoter and translator! XD

    Seriously like, it’d be rad if there was a Tomato Channel on the Wii. It would be all Mother interviews and information such as translated Itoi stuff (technically speaking, it’d use Opera and connect to a special http server only accessible to subscribers), as well as a launch board for playing Mother 3 and Earthbound 0 Remake, and maybe the original Earthbound and any other neat projects for a few extra Wii points (the price of the game, of course!) I’d pay subscriptions for this, totally. I’d easily pay something like 500 Wii Points a quarter to see new features and updates you do, then typical import rates for the games (of course, those wouldn’t expire). I’d go higher/more frequent on the subscription, even, if there was piles of new stuff constantly. 🙂

    Unfortunately I’m not so unrealistic to think this could ever actually happen, although it would quite possibly result in the maximum amount of dollars Nintendo could squeeze out of the Mother franchise from us westerners and fans. A fan can dream, can’t they? 🙂

    Anyway, back to reality. I COMPLETELY understand that being pretty much a complete stranger of dubious dedication I don’t have much to offer and I knew this at the time I asked, but I couldn’t live with not at least putting it out there! In the meantime I’ll just keep trying to intercept time consuming questions that I can [mostly?] answer where possible or something. 😀

    Oh and I’m sure you’ll keep us updated, but on the off chance there IS something you might need grind-worked with semi-skilled labor on the horizon let me know ASAP so I can start playing with a script and the menu patch haha.

  115. Unsavory Maggot said 11 years ago:

    Actually, I just had a nugget of curiousity. With the way you plan on it welding your VWF together, I was wondering if the game would consider all of that as one letter — such as your example, the B and half of the o in the first part of Boobs, and the second letter being the remainder of the first o and the second o and… hopefully you get what I’m getting at here. 😉 Is it still going to look like it’s printing one letter at a time, or is it going to print one and a half, maybe two or three letters?

  116. Mato said 11 years ago:

    Unsavory Maggot: The sprite text doesn’t get fake-printed, it all appears at once. That question’s been asked a few times already 😉

    Anna: Your technical answers to people’s questions does help out a bit, thanks for that. I’m a bit pressed for time to answer stuff lately, so it’s appreciated.

    And yeah, I do probably work too hard to spread MOTHER stuff around. I don’t even know why, I mean I like the series and stuff a good deal, but I’m not sure what it is that makes me want to do all this stuff. I definitely got lots of non-EB stuff I’d like to pursue, so why do I stick with EB stuff so much. It’s a mystery.

  117. Pulling the 8th Needle — A Mother 3 Fan Translation Interview | Shh Mom! said 8 years ago:

    […] Other sites mentioned in the article: Earthbound Central Fangamer Extra Reading: Jeff provided a link to a blog post Tomato wrote on rendering text that goes into some technical details: Check it out here. […]