• [Axe]How To make your own character 5 1
Currently:

### Author Topic: [Axe]How To make your own character  (Read 22037 times)

0 Members and 1 Guest are viewing this topic.

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### [Axe]How To make your own character
« on: September 30, 2014, 12:07:24 pm »
(Still in the works. You can start making your character but nothing guarantees that you'll never need to come back to what you've already written. Spriting doesn't have this kind of risk though. If you are really in an urge to make a character and can't wait for this to be done, you can also have a glance at Fox/Falco's source.)

Random Notes

When using the Axe method, you actually compile as a program then convert it into an appvar. That's why I'll say "program" and "appvar" everywhere without distinction.

If you are fluent with Asm, I'd advise you to use the Asm tutorial instead.

When spriting, be sure that your character is the right size compared to Fox. Here are some of Fox's sprites for reference.

Notes to make your life easier

You can include the SMASHH program into your program. It only includes definitions, not code nor data so you can include it wherever you want in your program.
This will not only be a lot more readable for you to write "°AirNull" than to write "pi00000011" but this will also allow some specification changes (I hope that will never happen but we never know) because if you wrote "°AirNull" everywhere, just change the SMASHH and the °AirNull constant is changed everywhere while if you wrote "pi00000011", you'll have to change them all "by hand".

I'd also advise you to use your own macros, like "38→°FoxGravity" so that you can quickly change a constant everywhere in your program.

How do characters work, without details (you'll have details below)

Basically, they work with states. When your character is standing, doing nothing, it's in a state that we can call the "Standing state". It will leave this state when you press Jump for example, to go to the "Jumping state". Another example is the "Dashing State", that repeats itself (not entirely true) until you stop pressing the arrow key you pressed to start this state, or when you press Jump, etc.

This is necessary to have the game list your character and not list random appvars that don't have the right header.

The header starts with a one byte number, which for now is 1. This is actually not used for now, but in case specification changes happen (which I still hope will never happen), you'll have to put 2 here then 3, etc so that the program knows which specification your character is following.

You then need to put "SSBOCHAR"[00]. This is what the program uses to check if the appvar is a SSBO character or not.

The following two bytes are the size of the program.

Then, you put a 16x14 icon for the character selection menu (28 bytes).

You finish the header with the name of your character, obviously null-terminated.

For example if you are making Fox, here's what it should look like for now. I didn't say that your Axe source needs to start with a dot followed by the name of the compiled program but you must do that obviously.
Code: [Select]
.FOXPprgmSMASHH[]→°FoxBEGIN[01]"SSBOCHAR"[00]Data(°FoxEND-°FoxBEGIN^r)[00000000000000000000000000000000000000000000000000000000]"Fox"[00][]→°FoxEND

General Information

1 byte: gravity (not used anymore, can be recycled for something else)
1 byte: air speed
1 byte: traction
1 byte: max number of jumps (2 in general, 5 for Jigglypuff)
2 bytes: max horizontal speed (not used yet)

Then follow the adresses of states that the program will need to have quick access to. A counter example is the second frame of the Down Aerial. You only access that one after the first frame. That first frame however needs to be quickly accessed to when the player asks for a Down Aerial.
All of those adresses take two bytes.
Since for now you have not written any state and have the adress of none, just put the adress of the standing state everywhere, you'll change that as you go along.

Anyway, in that order:
Standing, Airing, Dashing, GroundJump, AirJump, Landing
AirNeutralSpecial, AirSideSpecial, AirDownSpecial, AirUpSpecial
GroundNeutralSpecial, GroundSideSpecial, GroundDownSpecial, GroundUpSpecial
DashAttack
SideSmash, DownSmash, UpSmash
NeutralAir, ForwardAir, BackAir, DownAir, UpAir
LedgeGrabbed

Just a little precision. Axe compiles program "in" the RAM area it will be executed. For Asm users, I mean there is no way to say .org 0. However, state adresses need to be the ones related to the beginning of the data, not absolute ones assuming the program will be located at a precise location. This is why you'll have to put a "[]→°DB" right after the header and a "-°DB" after all your adresses (and this is why I said at the beginning that if you were fluent with Asm, you'd probably want to use your favorite assembler to build the appvar rather than using Axe).

So this is what you have for now:
Code: [Select]
.FOXPprgmSMASHH38→°FoxGravity[]→°FoxBEGIN[01]"SSBOCHAR"[00]Data(°FoxEND-°FoxBEGIN^r)[00000000000000000000000000000000000000000000000000000000]"Fox"[00][]→°DBData(°FoxGravity)Data(5)Data(20)Data(2)Data(255^r)Data(°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r)Data(°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r)Data(°FoxStand-°DB^r)Data(°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r)Data(°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r)Data(°FoxStand-°DB^r)[]→°FoxStand$that state is not done yet but since you wrote its adress above, you need that adress to exist[]→°FoxEND$ dont forget that the °FoxEND must be the last line of your program, it's not because you wrote it at a previous step that what you add at the next step must be written after it
We now have quick access to the Standing state... which we didn't implement. That's what we are going to do.

States

States have those fields:
2x2 bytes: pointer to sprite facing right, pointer to sprite facing left
2x1 bytes: teleportation (X,Y)
1x1 byte: flags
2x2 bytes: speed
1x1 byte: arrow key influence
1x2 bytes: adress to next state by default
<depends>: commands
1x1 byte: 0, end of commands.

- I guess there's no problem with the sprite pointers, except maybe the sprite format, which is just 1 byte for the width in bytes (width in pixels divided by , one byte for the height in pixels, then usual data to describe pixels, 1 bit per pixel.
- Teleportation should be straightforward too. Basically, if you want your character to have its position changing when entering that state, put non zero numbers here. Notice that those numbers will obviously be added to your current position. And since they are 1 byte numbers, you can only move from -128 to +127. This is actually not implemented yet.
- Flags change the behaviour of your state.
--- °Inv when set will grant your character invincibility during that state (not implemented)
--- °Piv when set allows you to pivot (change the direction you're facing)
--- °AbsX when set will set your X speed to the specified X speed in the speed field, and when not set will add the X speed in that field to your current X speed
--- °AbsY is obviously the same for the Y speed
--- °SetKnockBack is unused
--- °GroundNull states that when in that state you are on the ground and can't use attacks
--- °GroundOK states that when in that state you are on the ground and can use attacks
--- °GroundDash states that when in that state you are on the ground and can use dash attacks
--- °AirNull states that when in that state you are in the air and can't use attacks
--- °AirOK states that when in that state you are in the air and can use attacks
--- °Aerial states that this state is an aerial attack (don't follow the example of the Fox I made, he doesn't use that flag when he should)
--- °Ledge states that you are currently holding a ledge
- Speed is the X speed and Y speed we mentionned when talking about °AbsX and °AbsY
- The arrow key influence is a number that, when non-zero, will allow your character to be moved horizontally during that state. It is for example used in the Air (falling) state but it may be set to zero in most attacks. The higher it is, the more the character can be moved of course.
- The adress to the next state by default is pretty straightforward too
- Commands (will) have their section below in that tutorial but are not used in the standing state so first read and understand the following example

The Standing state is a very simple example (plus, it's the state you gave the adress everywhere so it would rather be defined soon).
I am throwing it without more explanation because I don't know what to say, it you have questions, feel free to ask.

Code: [Select]
.FOXPprgmSMASHH38→°FoxGravity[]→°FoxBEGIN[01]"SSBOCHAR"[00]Data(°FoxEND-°FoxBEGIN^r)[00000000000000000000000000000000000000000000000000000000]"Fox"[00][]→°DBData(°FoxGravity)Data(5)Data(20)Data(2)Data(255^r)Data(°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r)Data(°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r)Data(°FoxStand-°DB^r)Data(°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r)Data(°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r,°FoxStand-°DB^r)Data(°FoxStand-°DB^r)[]->°FoxStand .état debout normalData(°FoxStandSprR-°DB^^r,°FoxStandSpr-°DB^^r) .spriteData(0,0) .téléportationData(°Piv+°GroundOK)Data(0^^r,0^^r) .VData(0) .arrowkeys influenceData(°FoxStand-°DB^^r) .état suivant par défautData(0)[021B]->°FoxStandSpr[004000A001300208052407142834660EF1946FF821F4DCE2A4C794CF95C84E3863F037F80FFC0F3C0B1C079603DE01CE03DE039E010C][021B]->°FoxStandSprR[020005000C80104024A028E02C147066298F1FF62F84473BE325F32913A91C720FC61FEC3FF03CF038D069E07BC073807BC079C03080][]→°FoxEND
Notice that flags can be added in the flags field. Writing "or" instead of "+" is advised however, in case you add twice the same flag (since or_ing  it twice gives the same result as or_ing it once) but "+" is more compact so I use it.
« Last Edit: November 16, 2014, 03:14:54 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### narabuster

• LV1 Newcomer (Next: 20)
• Posts: 18
• Rating: +0/-0
##### Re: [Axe]How To make your own character
« Reply #1 on: September 30, 2014, 03:03:09 pm »
Well, this might be very helpful.

Since I'm more comfortable with Axe, I'll decide to use when I'm more experienced with commands and sprite-making.

But this should prove useful for regular calc game makers. It's pretty nice!

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: [Axe]How To make your own character
« Reply #2 on: September 30, 2014, 03:46:38 pm »
I am not sure you noticed what subforum we are in. This tutorial doesn't teach you how to make a character in any game, it teaches you how to make a SSBO character. I probably should have made it clear in the title.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55858
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: [Axe]How To make your own character
« Reply #3 on: September 30, 2014, 04:06:33 pm »
I might try to make a Reuben character when I have a chance, assuming I can figure it out and that it supports multiple frames. .
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: [Axe]How To make your own character
« Reply #4 on: September 30, 2014, 04:18:05 pm »
It does support multiple frames. The tutorial is not complete but you can try Fox's Down Aerial or his Up Smash to be convinced of that
That's actually what the "address of the next state by default" is for. If you have several frames, put here the address of the next frame. Otherwise, put the address of the state you want to come back to after you finished your move. This can become more complicated if you want more possibilities but you get the point
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### narabuster

• LV1 Newcomer (Next: 20)
• Posts: 18
• Rating: +0/-0
##### Re: [Axe]How To make your own character
« Reply #5 on: September 30, 2014, 05:13:07 pm »
Quote
This tutorial doesn't teach you how to make a character in any game, it teaches you how to make a SSBO character.
That's what I meant. Sorry, I was the one who should've been a bit more clearer. If you want to put that little note in the topic anyway, that would be nice for anyone else who makes that mistake.

Still, it will take me some time before I'm ready to code an SSBO charcter.

#### GodOfSocks

• LV0 Newcomer (Next: 5)
• Posts: 2
• Rating: +6/-0
##### Re: [Axe]How To make your own character
« Reply #6 on: November 15, 2014, 12:17:23 am »
Hi
Found this quite interesting, and since I've been a fan of Marth (Even though i had no idea who he was) since I was little, I made a few sprites of him for this.
I don't really know if they're good or not, but if i get positive feedback I'll finish them.
Now, the problem is that I know absolutely nothing about programming, so someone else would have to do that part for me...

Thoughts?

#### bb010g

• LV6 Super Member (Next: 500)
• Posts: 427
• Rating: +22/-1
• I do stuff
##### Re: [Axe]How To make your own character
« Reply #7 on: November 15, 2014, 12:54:22 am »
Hi
Found this quite interesting, and since I've been a fan of Marth (Even though i had no idea who he was) since I was little, I made a few sprites of him for this.
I don't really know if they're good or not, but if i get positive feedback I'll finish them.
Now, the problem is that I know absolutely nothing about programming, so someone else would have to do that part for me...

Thoughts?
Nice looking.
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 35s, Casio Prizm, TI-Nspire CX CAS, HP-28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: [Axe]How To make your own character
« Reply #8 on: November 15, 2014, 04:16:06 am »
Your work is absolutely stunning but actually, I think it is too stunning
I mean that your Marth is as tall as my Fox even though he should be taller. But if you were able to make a Marth of this size, I doubt you'll fail to make one with more pixels

Great work anyway, and thanks for your interest
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### GodOfSocks

• LV0 Newcomer (Next: 5)
• Posts: 2
• Rating: +6/-0
##### Re: [Axe]How To make your own character
« Reply #9 on: November 15, 2014, 11:43:11 am »
Thanks for bringing that up before I did more sprites
I'll get working on it, thanks for the feedback. c:

How's this?

(Whoops, didnt mean to double post)

Edit(Eeems): Merged double post
« Last Edit: November 15, 2014, 03:35:26 pm by Eeems »

#### chickendude

• Posts: 816
• Rating: +90/-1
##### Re: [Axe]How To make your own character
« Reply #10 on: November 15, 2014, 08:52:46 pm »
Wow, those look great! When the sprites are done, adding in the stats shouldn't be too difficult, i can do that if no one else steps up to the plate. Great work so far! Hayleia, is there really no established size for sprites? They can be any size (any height/width)?

#### aeTIos

• Nonbinary computing specialist
• LV12 Extreme Poster (Next: 5000)
• Posts: 3913
• Rating: +184/-32
##### Re: [Axe]How To make your own character
« Reply #11 on: November 15, 2014, 08:55:44 pm »
Holy s**t! Those sprites look amazing!
I'm not a nerd but I pretend:

#### TIfanx1999

• ಠ_ಠ ( ͡° ͜ʖ ͡°)
• CoT Emeritus
• LV13 Extreme Addict (Next: 9001)
• Posts: 6173
• Rating: +191/-9
##### Re: [Axe]How To make your own character
« Reply #12 on: November 15, 2014, 09:12:31 pm »
Thanks for bringing that up before I did more sprites
I'll get working on it, thanks for the feedback. c:

How's this?

(Whoops, didnt mean to double post)

Edit(Eeems): Merged double post

Those look great!, and welcome to Omnimaga!

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55858
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: [Axe]How To make your own character
« Reply #13 on: November 16, 2014, 02:17:17 am »
What's the minimum and maximum width and height possible for a character? If 24x24 is supported, then I might have an idea in the future.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: [Axe]How To make your own character
« Reply #14 on: November 16, 2014, 02:32:26 am »
Fox actually has 32x32 sprites so 24x24 is supported obviously
I think the maximum supported by Badja's sprite routine was 256x256, and the minimum is 8x1 (width of 8, height of 1).
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.