PROJECT SF Development Blog


Default Name Autofill

Hi again, everyone! Just as a heads up, this blog post will be a little bit more technical than usual!

For a long while now (seemingly since April 7, 2021 according to the development server!), I've been wanting to do two things with
the introduction sequence when starting a new save file being:

  1. Removing the ability to name the rival character
  2. Having the player be gven a default name in the name input screen that can also be changed like Hugh in B2W2
This was much lower on my priority list for a while, but here and there the motivation would come to try investigating it further.
Thanks to a lot of help received from people in the community like PlatinumMaster (Plat), Hello007 (Hello), and the late Bond697 (Bond)
just to name a few who have helped in documenting many areas of the game code, progressively made these goals easier to attain.

With Plat and Hello in particular, with their work to create a code injection system, I originally was attempting to
do these modifications using it. The main struggle in this case, however is that here, I only really needed to edit
two particular "states" within the new game introduction sequence rather than the entire state machine that controlled
this section of the game.

While I did eventually get the game to call some of my custom code, when I tried to call a function from the vanilla game,
the game would instead hang. At a point, I felt that handling this by hex editing the assembly code in the ROM itself
would actually be the easier solution in this specific case.

Surprisingly, the easier thing to deal with between the two things I wanted to do was actually removing the rival
naming portion of the introduction. Essentially, the game after it is done being in a certain state it'll explicitly
say which state is the "next" state. In this case, I jumped over the states relating to naming the rival character
straight into the part that confirmed their name. Since the introduction sequence uses its own script commands,
after doing this, I removed the parts that showed the rival, the banner behind the rival, along with the confirmation
question itself asking if you wanted to go with whatever name you put in.

With this removed, this did two great things. 1) I now had free space to write my own code now that I skipped over
two states in the state machine in order to skip naming the rival, and 2) I could also reuse some of the existing
code for filling in Hugh's name into the text box for filling in the player's name.

A major problem I initially had when writing my assembly code was that even with having more free space in theory,
I still needed to do a lot of what was being done in Hugh's autofill behavior and having to add on even more to
account for the gender branch. In trying to do that, I ended up with 8 extra instructions and a function call,
I ended up needing to find 20 bytes of free space, and I didn't really have that many bytes to spare.

After some thinking, though, there were two things I realized (many things seem to be coming in twos with this!)
  1. The function getTrainerGender() returns 0 if the player is a boy and 1 if the player is a girl, and since
    the default names were at indices 17 (boy) and 18 (girl), I could simply figure out the index by doing
    getTrainerGender() + 17 to get what index was needed for the text it was going to read. This would mean
    mean I wouldn't have to deal with any actual branching which cut down on a lot of instructions.
  2. The function getTrainerGender() was a one-liner that I could just write directly into the function I was editing.
    The other benefit of inlining this, too, is that I didn't have to shuffle data around more to get it in the right
    place for calling the function.
By doing this, I was able to get the gender branching down to only 4 new instructions!


While I thought I was in the clear just adding the gender branch to Hugh's code, I forgot about the icon of the player
also changing based on their gender.

Katsumi may be a gender neutral name, but this most
definitely is not the girl player character!
With a little more hackiness, I realized since the few things that are done with the state that prepares
the naming screen for putting in the player's name, there isn't anything special particularly done with it
compared to what is done to prepare for entering the rival's name. Because of that, I just tried having
it jump back to the code that is normally run for the player name input, and to my surprise it worked
just fine!

And just like that, two birds were killed
with one stone!
Now with that done, I finished dealing with most of the major coding needed for the new game sequence!
Getting this done honestly makes me feel really happy, and it's also somewhat surprising, too, that
my experience with my schoolwork has actually helped me out in doing hack work better.
(One would hope that a person would learn when going through school!)

Between this and the last post, I feel really reinvigorated to work on this more, even if it's
just little by little. Being able to actually see this on hardware as well and being able to
(mostly) play through a large portion of what me and the team have cooked up also just feels
really nice! And, the fact that I'm even getting the joy of playing Pokémon from something
I'm behind is really just crazy to me.

I hope to see you all again with more progress soon, but here are some pictures of
Project SF running on my own 3DS to tie up this post.
“Technology truly blows me away!
Now people all around the world
can communicate and collaborate
at the blink of an eye!”
- Local Conquista City Resident
Well then,

Start of the Neocities site!


For most people, this blog post won't be seen until much later, but for those who are here reading, hi, hello, ¡hola!, bonjour, やっほー, etc.
Progress has slowed a little bit primarily due to how busy this semester has been, but hopefully the pace will pick up again with time.

In terms of recent developments, as you've likely seen on the home page (at least as of writing this), I've finally gotten around to
making the official promo art for the player characters Katsuro and Katsumi!

...Or Vick and Tori. Or whatever you all decide to name them. The jury is still out on this one.

Regardless, I'm really surprised at how good the art turned out! Honestly I'm even surprised myself that I made it!
But anyway, that's enough chatter. The main benefit now of having finished promotional art of the protagonists is that they're
also being used for the player select when starting a new game.

Pretty cool, right?

It's a bit funny too seeing the initial sketch given that when I made it, for some reason it didn't seem like my hand wanted to
cooperate with me...

Something of note to me, though, is that I feel like the final product of the protagonist art compared to the initial reference
sheet I made for Katsuro in December of 2020, my art style manages to both feel the same but also really different in how polished
it feels. I think lots of little things like having more decisive line art and finer detail rendering with things like rim lighting
helped in pushing my art to feeling more professional.

But anyway, excited for the next blog post and thanks for reading!