PHO - Pokémon Hackers Online
Go Back   PHO - Pokémon Hackers Online > Fangame Development > Fangame Showcase

Notices

Fangame Showcase Working on a Homebrew project of some kind? Come and show it off!

Reply
 
Thread Tools Display Modes
Old 8th November 2013, 03:39 PM   #31
Team Fail
Balance and Ruin
Ex-StaffStyle AdminstratorPHO VIP
 
Team Fail's Avatar
 
Join Date: Jul 2010
Posts: 564
Team Fail Team Fail Team Fail Team Fail Team Fail
Default

Quote:
Originally Posted by droomph View Post
Or maybe people shouldn't be trading from flash carts anyways, so this isn't a big problem
It's still fun using hardware. Makes the game more portable.
__________________
twitter | dropbox | youtube | bro

Thank you for your time, PHO. I won't soon forget it.
Team Fail is offline   Reply With Quote
Sponsored Links
Old 20th November 2013, 02:18 PM   #32
Jambo51
Glory To Arstotzka
Ex-Staff
 
Jambo51's Avatar
 
Join Date: May 2012
Location: Scotland
Posts: 85
Jambo51
Default

Quick wee update, I got the noise tracks implemented in the GB Sounds part of the engine, so with the exception of the (as yet unsolved) desyncing issues, that part of the engine is pretty much complete!

Please note that since this engine strives for close as possible replication of the GSC music engine, you can safely assume that, unless I specify otherwise, what is laid out here also applies to the original GSC engine.

Documentation of the functionality and formatting:
Spoiler:
Command Structure
Spoiler:
The majority of commands the engine will take are simply note commands. What I mean by this is that most commands tell the engine what note to play and for how long.

Note that all values listed here are in hexadecimal.

Code:
0x - Play No Note for LengthCalculator(x + 1) frames.
1x - Play C(Octave) for LengthCalculator(x + 1) frames.
2x - Play C#(Octave) for LengthCalculator(x + 1) frames.
3x - Play D(Octave) for LengthCalculator(x + 1) frames.
4x - Play D#(Octave) for LengthCalculator(x + 1) frames.
5x - Play E(Octave) for LengthCalculator(x + 1) frames.
6x - Play F(Octave) for LengthCalculator(x + 1) frames.
7x - Play F#(Octave) for LengthCalculator(x + 1) frames.
8x - Play G(Octave) for LengthCalculator(x + 1) frames.
9x - Play G#(Octave) for LengthCalculator(x + 1) frames.
Ax - Play A(Octave) for LengthCalculator(x + 1) frames.
Bx - Play A#(Octave) for LengthCalculator(x + 1) frames.
Cx - Play B(Octave) for LengthCalculator(x + 1) frames.
This means that ANY value under 0xD0 is simply a note command!

Command IDs falling between and including 0xD0 and 0xD7 each simply set the current octave, working as follows:

Code:
u8 newOctave = 7 - (commandID & 0x7);
Any value >= 0xD8 is a command which requires further parameters, and as such, the structure is laid out below for each command:

D8 Set Frame Delay AND Voice Style
Spoiler:
Format: Track ID = {0, 1, 2}
Code:
D8 XX YZ
Track ID = {3}
Code:
D8 XX
Parameter Meanings: XX is the frame delay. Used in calculating note length.

Track ID = {0, 1}
Z is the fade type and rate. Should be treated as a bitfield where it is split as follows:
Code:
ABBB
Where A is the fade direction (0 is fade out, 1 is fade in) and BBB is the 3 bit value 0-7 inclusive representing the fade speed. 0 is no fade, otherwise, fade at 8 - Y speed (meaning smaller values represent faster fades!)

Y is the base velocity of the note. 0 is no sound, else Y/15th of full volume (Note that max volume is set by Gain, a setting not changed by any commands in this engine. Gain is usually set to 0x200 by default.)

Track ID = {2}
Y is a 3 bit value (2 bit in original engine) representing the velocity of the note.
Code:
0 - off
1 - 100%
2 - 50%
3 - 25%
4 - 75% Note that this velocity is not available on the GSC engine!
Z is the voice of the wave. There are 11 valid waves (0-10 inclusive), but more can be added by simply repointing and extending the array. The code which places the wave into memory has a limiter, so that would also need changed. The maximum number of waves available is 16 (0-15 inclusive).

The waves are taken directly from GSC and RBY, with waves 0-9 being waves 0-9 from GSC, and wave 10 being wave 5 from RBY. RBY's waves 0-4 are the same as GSC's waves 0-4.

Side note - I may implement additional banks of waves if there is enough demand for it.


D9 Set Keyshift
Spoiler:
Sets the Keyshift of the song. Allows minimal control over the note above and beyond the basic note structure. Min value is -12 and maximum is +15. (Reason explained below along with format).

Track ID = {0, 1, 2}
Format:
Code:
D9 XY
X is the number of octaves to subtract from the current note, only a single bit, so can only be either 1 or 0, giving potential base lines of -12 and 0.

Y is the number of notes to ADD to the base line. Has the full 4 bits available to it, thus can range from 0 to 15.

Therefore, with a value of 0x1B, you get an overall note shift of -1 (because 1 * -12 + 11 = -1).


DA Set Tempo
Spoiler:
Sets the tempo of the song.
Track ID = {0}
Format:
Code:
 DA HH LL
Yes, counter intuitively (on a system which is little endian at least), the tempo is held with the high bits to the left of the low bits. It's a single half word however, not 2 separate values.

Is used to calculate note lengths along with frame delay.

The actual workings of this are not fully understood nor are the conversions from BPM to the in game tempo system. All that is definitively known is that smaller values make note lengths longer!


DB/DE Set Duty Cycle (AKA Square Voice)
Spoiler:
Sets the wave pattern used in the tone generators.

Track ID = {0, 1}
Format:
Code:
DB XX
While a full 8 bit value, the only valid values are 0, 1, 2 and 3. The wave patterns look like the following images.


DC Set Voice Style
Spoiler:
Track ID = {0, 1, 2}
Format:
Code:
DC XY
Simply sets the voice style of a track. Identical to the second byte of the D8 command for these tone tracks, although you should note that the original GSC engine does not support this command being used on Track 2 (aka the Wave track).


E1 Set Modulation/Vibrato Parameters
Spoiler:
Track ID = {0, 1, 2}
Format:
Code:
E1 XX YZ
XX is simply the frame delay before the vibrato kicks in.

Y is the depth of the vibrato and has a maximum depth of 15.
The depth is added to the main frequency like so:
Code:
u16 upFreq = baseFreq + (vibratoDepth - (vibratoDepth >> 1));
u16 downFreq = baseFreq - (vibratoDepth >> 1);
Z is the frame delay between peaks and troughs in the vibrato. The smaller the value, the faster the vibrato effect. Can be as low as 0 (see Team Rocket Hideout in GSC) and as high as 15. The actual vibrato effect is activated every (Z + 1) frame(s).

Note that, unlike in the GSC engine, where
Code:
E1 00 00
would not actually disable the vibrato effect, merely have a depth of 0, so no change would be heard, this engine actually disables the process, saving CPU cycles.


E3 Set Noise Set
Spoiler:
As the name implies, this command only works when
Track ID = {3}
Format:
Code:
E3 XX
This command simply sets which set of noise data the noise track should use. Each set contains 13 patterns (of which 0 is always no sound) which are played back frame by frame until the pattern expires, which is denoted by the first byte of the pattern being equal to 0xFF. There are 6 sets of noise patterns and the XX chooses which is being used.


E5 Set Channel Master Volume
Spoiler:
Track ID = {0, 1, 2}
Format:
Code:
E5 XY
This command sets the master volume of the tune. Little is known about how it physically does this.


E6 Set "Tone"
Spoiler:
Track ID = {0}
Format:
Code:
E6 HH LL
Effect Unknown


EF Set Pan Parameters
Spoiler:
Track ID = {0, 1, 2, 3}
Format:
Code:
EF XY
While this sets the pan, it's not yet entirely clear how.


FC Jump
Spoiler:
Track ID = {0, 1, 2, 3}
Format:
Modern Engine:
Code:
FC XX XX XX XX
GSC Engine:
Code:
FC XX XX
The XX's in this stand for the pointer to where the song will jump to. Ironically, this command is not used for looping, in spite of the fact that it would make more sense to use it.

Note that the ROM Bank is assumed in GBC pointers. That is, it uses the ROM bank that is already currently in use, as opposed to a GBA pointer which points to the precise location.


FD Jump with Counter
Spoiler:
Track ID = {0, 1, 2, 3}
Format:
Modern Engine:
Code:
FD YY XX XX XX XX
GSC Engine:
Code:
FD YY XX XX
The XX's once again stand for the pointer to the jump location.

YY, if greater than 0, stands for the number of times the mini-loop will be executed. Thus, the pointer MUST point to a location earlier in the same song structure, otherwise the next mini-loop will not execute correctly.

If it equals 0, the command acts like a jump command.


FE Call
Spoiler:
Track ID = {0, 1, 2, 3}
Format:
Modern Engine:
Code:
FE XX XX XX XX
GSC Engine:
Code:
FE XX XX
Calls a subroutine of music. Stores the original location in the structure. Note that the structure's stack is only 1 deep, therefore, only 1 call can be executed at any one time. Otherwise, the location in the song will be lost. However, it is perfectly OK to loop OVER a call, or to loop inside a call.


FF Return/End
Spoiler:
Track ID = {0, 1, 2, 3}
Format:
Code:
FF
If inside a call subroutine, returns to the calling musical routine, otherwise it ends execution of the track.


More to follow
__________________
I have nothing interesting to add

Last edited by Jambo51; 21st November 2013 at 06:53 PM. Reason: Additional Information; Corrections
Jambo51 is offline   Reply With Quote
Old 20th November 2013, 06:24 PM   #33
Team Fail
Balance and Ruin
Ex-StaffStyle AdminstratorPHO VIP
 
Team Fail's Avatar
 
Join Date: Jul 2010
Posts: 564
Team Fail Team Fail Team Fail Team Fail Team Fail
Default

Looks good so far. Can't wait to see a demo released.
__________________
twitter | dropbox | youtube | bro

Thank you for your time, PHO. I won't soon forget it.
Team Fail is offline   Reply With Quote
Old 23rd November 2013, 02:09 PM   #34
Jambo51
Glory To Arstotzka
Ex-Staff
 
Jambo51's Avatar
 
Join Date: May 2012
Location: Scotland
Posts: 85
Jambo51
Default

Managed to fix the desyncing music issues.
Also, a quick demo:
http://www.youtube.com/watch?v=bhJJmlx3oUM
__________________
I have nothing interesting to add
Jambo51 is offline   Reply With Quote
Old 25th November 2013, 05:21 PM   #35
mewthree9000
Junior Trainer
 
mewthree9000's Avatar
 
Join Date: May 2010
Location: U.S.A.
Age: 28
Posts: 70
mewthree9000 mewthree9000
Default

I can't wait to start using this in actuality! This is like most of my ideas made into reality.
__________________
-Mewthree9000
We all fight a war within ourselves, a war of greatness, a war to become the best.
LIVE THE REVOLUTION, PHO!
Gotta Hack'em All!!




My current projects:
-Pokemon ChaosBlack[v2]
-!!Elite FireRed ROM Base!!
mewthree9000 is offline   Reply With Quote
Old 27th January 2014, 10:16 AM   #36
Jambo51
Glory To Arstotzka
Ex-Staff
 
Jambo51's Avatar
 
Join Date: May 2012
Location: Scotland
Posts: 85
Jambo51
Default

Hey guys, I figured I'd post a wee update for the progress of this. Sadly, progress has stalled somewhat, as I have been forced to write a Malloc system, which requires research and is fairly complex to actually execute.

I've also been working on implementing both text and menu functionality, but as it turns out, these are far from simple to do.

On that front, thanks to daniilS from RHM (not sure if they have an account here), the engine is likely to have the ability to configure which text set you want to use.

By this, I do NOT mean font, I mean different scripts will be available. Currently planned are Latin and Cyrillic scripts, but more may potentially be included in future.

With luck, I'll have a breakthrough with these things in the near future!

I've also been considering an issue that is easily noticed on the 649 Patch. When the 649 loads the Pokédex listing, it hangs badly as it loops through all the data and calculates the information it needs to display. I had an idea to attempt to "fix" this issue on this engine by loading the Pokédex data in chunks, instead of all at once.

What I mean by this is that, on loading, it loads, say, 10 entries, and checks their seen/caught status and populates the first 10 entries based on that, and then stops.

Since only 6-8 entries are displayed at any one time, this can be used in our favour. When the player scrolls down, the dex then loads another few entries, thus the list is populated as the player scrolls through the dex. This should theoretically eliminate any hang, regardless of the overall length of the Pokédex.

Thoughts? Comments? Feedback?
__________________
I have nothing interesting to add
Jambo51 is offline   Reply With Quote
Likes Full Metal ★ liked this post
Old 27th January 2014, 02:19 PM   #37
Pia Carrot
Orange Developer
Administrator
 
Pia Carrot's Avatar
 
Join Date: Aug 2010
Location: Valencia Island
Age: 23
Posts: 811
Pia Carrot Pia Carrot Pia Carrot Pia Carrot Pia Carrot
Default

Quote:
Originally Posted by Jambo51 View Post
On that front, thanks to daniilS from RHM (not sure if they have an account here), the engine is likely to have the ability to configure which text set you want to use.

By this, I do NOT mean font, I mean different scripts will be available. Currently planned are Latin and Cyrillic scripts, but more may potentially be included in future.

Thoughts? Comments? Feedback?
I seem to remember some thread on PC a couple years back about trying to add letters to support a Norwegian translation or something like that, because apparently they don't have their own version there.


Also @daniilS does have an account here, iirc.
Pia Carrot is offline   Reply With Quote
Old 27th January 2014, 04:21 PM   #38
daniilS
VIP
PHO VIP
 
Join Date: Aug 2013
Posts: 59
daniilS
Default

Quote:
Originally Posted by Jambo51 View Post
Hey guys, I figured I'd post a wee update for the progress of this. Sadly, progress has stalled somewhat, as I have been forced to write a Malloc system, which requires research and is fairly complex to actually execute.

I've also been working on implementing both text and menu functionality, but as it turns out, these are far from simple to do.

On that front, thanks to daniilS from RHM (not sure if they have an account here), the engine is likely to have the ability to configure which text set you want to use.

By this, I do NOT mean font, I mean different scripts will be available. Currently planned are Latin and Cyrillic scripts, but more may potentially be included in future.

With luck, I'll have a breakthrough with these things in the near future!

I've also been considering an issue that is easily noticed on the 649 Patch. When the 649 loads the Pokédex listing, it hangs badly as it loops through all the data and calculates the information it needs to display. I had an idea to attempt to "fix" this issue on this engine by loading the Pokédex data in chunks, instead of all at once.

What I mean by this is that, on loading, it loads, say, 10 entries, and checks their seen/caught status and populates the first 10 entries based on that, and then stops.

Since only 6-8 entries are displayed at any one time, this can be used in our favour. When the player scrolls down, the dex then loads another few entries, thus the list is populated as the player scrolls through the dex. This should theoretically eliminate any hang, regardless of the overall length of the Pokédex.

Thoughts? Comments? Feedback?
Yes, I do have an account on here.
Also, the idea of chunks seems good to me, but wouldn't it actually create even more hang when all flags need to be checked, like when using the search function/displaying the little ball icon on the battle screen/using the repeat ball/etc... ?
daniilS is offline   Reply With Quote
Old 18th May 2014, 08:52 AM   #39
Jambo51
Glory To Arstotzka
Ex-Staff
 
Jambo51's Avatar
 
Join Date: May 2012
Location: Scotland
Posts: 85
Jambo51
Default

Well, I'm back with a quick update for this engine, if anybody cares.

I have been unable to get a text writer working in a sufficient manner as of yet, with any text string stalling the execution of the rom, and worse still, not spacing the text correctly.

On the plus side, I was able to create Memory, Tile and Palette allocation code, so I can create things on the fly, and have implemented the inner callback system so the rom can run code once a frame which does not always run - it is only run when requested.

A good example of this is the script runner or the tile animator - both of these are only run upon being requested.

So, any further thoughts?
__________________
I have nothing interesting to add
Jambo51 is offline   Reply With Quote
Likes Team Fail liked this post
Old 18th May 2014, 01:43 PM   #40
Full Metal ★
Unstable?
Ex-StaffPHO VIP
 
Full Metal ★'s Avatar
 
Join Date: Oct 2012
Posts: 312
Full Metal ★ Full Metal ★
Default

Quote:
Originally Posted by Jambo51 View Post
Well, I'm back with a quick update for this engine, if anybody cares.

I have been unable to get a text writer working in a sufficient manner as of yet, with any text string stalling the execution of the rom, and worse still, not spacing the text correctly.

On the plus side, I was able to create Memory, Tile and Palette allocation code, so I can create things on the fly, and have implemented the inner callback system so the rom can run code once a frame which does not always run - it is only run when requested.

A good example of this is the script runner or the tile animator - both of these are only run upon being requested.

So, any further thoughts?
The last bit is a clever way of doing things. I personally reccomend breaking away from the concept of frames, and doing things solely through callbacks. Although, this may be more complicated with C.
__________________

★ full metal.

#busy
Full Metal ★ is offline   Reply With Quote
Reply

Tags
engine, homebrew, jambo51, pokemon

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:46 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc. User Alert System provided by Advanced User Tagging (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Pokémon characters and images belong to Pokémon USA, Inc. and Nintendo.
Pokémon Hackers Online (PHO) is in no way affiliated with or endorsed by Nintendo LLC, Creatures, GAMEFREAK inc,
The Pokémon Company, Pokémon USA, Inc., The Pokémon Company International, or Wizards of the Coast.
All forum/site content (unless noted otherwise) and site designs are © 2006-2013 Pokémon Hackers Online (PHO).
Green Charizard Christos TreeckoLv100

"Black 2" by ARTPOP. Kyurem artwork by XOUS.

no new posts