From ProjectWiki
Jump to: navigation, search

Touhou Fangame for Nintendo DS


Project Status: On Hold (Temporarily)

What is this?

Since late December 2007 have been working on a little touhou style game for the nds. Still working on it.. u_u Will write a bit about it here. Do not expect much updates, usually not motivated to edit wikis... For now will update as can and probably upload occasional screenshots. ^^

What's Touhou? From wikipedia:
"The original Touhou Project (東方Project, Tōhō Purojekuto?), also known as Toho Project or Project Shrine Maiden, is a series of manic shooters made by Team Shanghai Alice. They are notable for being successful dōjin soft because of their intricate bullet patterns, original music, their greater focus on characters than most shooter games, and being a one-person project."

Why make?
Am very fond of the original games, the music, graphics, characters. Found an iosys flash animation and put it on the homepage without knowing what it was from. Then got more interested after seeing the characters various places and finally seeing this video on youtube and downloading the Perfect Cherry Blossom and Imperishable Night demos. <3

After googling for Touhou NDS found Spuzkaizer's unfinished game, had always been thinking while playing PCB and IN about how they must work, and thought to do some experiments. By the next morning had a simple bullet engine and just kept working from there. ^^

dev blog

Here i will talk somewhat informally about development progress. Due to the large size of this blog have moved all entries past 2008.09 to here... enjoy ^^


Oh, feel bad I have not updated this blog in quite some time. In april I got new job working with a semiconductor manufacturer to develop demos so they can showcase their products to the gaming industry. (omg omg dream job!!) I love working with hardware and doing electronic engineering as well as software. Also until this week was working another full time job, and got a job contracting w/place in los angles. Srsly I have been busy girl. ;; I am still working on my own project just that progress is exceedingly slow. u_u;

Have done some new musics in spare time:

Will probably take a break from it all very soon, i need it. ^__^;;;


mmleditor work in progress

Good morning! Thought I'd mention here my current project. I have been very fascinated with MML and since finding the NDS_BGMDRV have wanted a way to edit MML easily. Sakura i could never get to run (tho it looks quite good), and 3ML doesn't support the 'Macro' in MusicMacroLanguage. >_< So I have began to create an editor using the QT widget library so that it will be easily compiled for linux, mac, or pc. I will soon create a GIT repository and it's own wikipage, but for now please enjoy this screenshot. Thank you. ^^


Have heard that the NitroFS driver and possibly the Thfifo subsystem is incompatible with various cards. So I have ordered an AK2 as well as a M3real so that I may better test it along with my old old NeoFlash and DSExtreme cards I have been relying on. Hopefully can find some explanation for these inconsistencies. ^^


Happy New Year 2 U! Found a problem in my PNG loader function for thdslib!! I never close the filehandle, causing it to eventually run out of resources. Finally I can restart THDS over and over without it running out of memory :DD

Hate to be overly optimistic, but do hope I find the memory corruption bug now. Think that is what is causing random graphics glitches (stuck or missing sprites) and possibly would explain why my replays get out of sync intermittently. ^^


Mary XMas! :D Deck the halls with danmaku! ^^


3ML screenshot of Break the Sabbath score. :D

Lots going on in life atm. Still plodding along @ thds however. Working on an arrange of Break the Sabbath from Lotus Land Story and the related Akyu's Untouched Score CD. Really sorry to anyone following blog and waiting patiently.

Normally do not release work in progress materials but since again i been sorta busy and not coding on game or writing to blog here is a WIP version of Break the Sabbath. So far just working on transcribing the original score into 3ML editor. Do this by listening to Akyu's, The original OST, and other versions I like then just recording what I hear. One trick I learned from ^^Flandre^^ @ rizon is to use the pc98 emulator to isolate individual tracks making for more accurate transcriptions. Mostly try to go for original score, and then add a few parts and change things to match my tastes.

Will probably add drums later tonight if i'm not too long working @ day job :p Then will export the 3ML as midi and do further editing and proper arranging in Rosegarden Midi Sequencer. Prefer to transcribe into 3ML because it results in very tight and controlled scores, and since it was how the originals were created feel it adds an audible sense of authenticity hard to capture doing direct midi sequencing.

Note: did i mention its one of my fav++ songs?! ^____^

10-29 - update plz enjoy the With Drums Version!!!! Still very much a wip, but it sounding rly ossum already :D

Also, while transcribing BTS friend send me the music video of old 90s technoey hit Mr.Vain, made me lulz a bit so made this MrVain vs. Touhou101. Idea was to sorta Mr.Vain vs Touhou battle, 101 because its very basic and repetitive. Only spend ~ 2hr on this but still entertains and makes me giggle a bit. :p


Been very busy still, but always thinking of touhou. Managed to get a new desktop PC able to play Touhou 12 Unidentified Fantastic Object this week. As expected it is very beautiful and fun. Still on break from DS deving. Just started new full time job last week, and trying to get settled in. At least now I should be able to afford a DSi & newer flash cards for testing. Found out, and fixed, a problem with NitroFS initialization due to some flash cards copying the header to GBA ram when launching .nds files. This explains the mixed and confusing reports I'd get from some ppl saying their card works and others saying same card did not. If u have the GBA expansion in will affect results on these flashcards. *sighs*;;;

Been considering if its better to clean up current Touhou for DS project or start on Touhou DS 3(d) :p It would of course use the 3D engine instead of multiplexed sprites. Also the game would be largely dynamically loaded using the developing module loading library. (Some info here) The thought is to provide graphical, audio, bgm, collision detection, and some other required libraries, but using dynamically loadable modeules for the actual game control logic, patterns, menus, everything else. Also making any new projects completely open source. Mostly was just embarassed of unfinished results, but feel going open from start may provide some useful feedback.

This way too it would be much easier for others to create spells and add characters and levels. Or even create non shooter games using the framework of dynamically loadable modules. Still thinking about it. u_u;;;;


Shamefully i have not worked on game in a month. Have been busy returning to Louisville, and had taken on two different consulting jobs to try and make up for the four month money pit that was attempting to get a job in LA. Heard back from one company there i interviewd with who said "You were certainly the brightest candidate we have ever interviewed. Sorry it did not work out." @___@ Thats both totally ossum, and confusing, but glad they didnt hate me! u_u;;;

Since i have not been available to dev. Have decided to release my original Touhou For NDS game which was abandon 2 years ago, since i did not make the graphics, or the music, and was using PA_Lib which very limited. So without further ado, here!:

  • thds01new.nds Demo of current and probably soon to be abandoned newer touhou, seriously a work in progress..

Please place these files in the root directory of cards in order to work, except the .gba and .sc versions i believe can be placed anywheres. They are both FULL of bugs and problems. Feel free to mod the sources as you wish. If you wish to credit the author please link to this page and use my pen name of erisu. Deeply sorry these are both not in a fully 100% playable state. ._.);


Still alive. :P Haven't worked much on the game itself proper, have been quite busy here looking for work. Really picked a bad time >_<' But keeping at it. On the side working have been refactoring Thmp3 to improve efficiency, add a few requested features and resolve a few complaints. Will have version 2 soon ^^

Did some experiments with dynamic linking on the nds. Someone (hmmmmz....) kept telling me it was impossible and a wast of my time and wouldnt fit etc etc, but this really didn't take much space or cpu at all. Granted it's handling only a small subset of posible linking scenarios, but adding a few more to be more robust shouldntn be difficult. :D

If this works may use it instead of scripting such as lua for the bullet patterns. Instead just write an api and then make patterns into C (or even c++). Just need to resolve symbols for a handful of math and other operations so like you can call rand() or COS tables and might be able to have dynamically loaded C. Very cool.. ^___^

Also noticed Meraman has just completed his NDS_MIDDRV_DEV which provides playing of midi background music for homebrew games and a very useful midi/mml player application with tone editing facilities that runs on the ds itself. Great work!


Friend ask me about some bullet aiming and homing functions so i pasted some here. Prolly could use some improvement, but it works. ^^

Still in cali staying w/frenz, looking for work, slowly developing 3D sprite and effects lib. Also improving some of the thds libraries. since they are being used more often by other devs and i am thus receiving more feature requests and bug reports. >_< This will ofc improve thds aswell. Anyways, hopefully I will get own place soon and have more free time. u_u

2009.05.13 ~ 3D sprites

3D dual screen Sprites

Quick screenshot of 3D sprite experiements. Here the 3D engine is connected to the capture unit, which captures 3D output to VRAM_B asyncronously. VRAM_B is then copied using 'dmaCopyWordsAsynch' on the next frame to the appropriate BMP background image for each screen alternating between screens every other frame. Text for the appropriate screen is then rendered as needed.

This system uses less than 8% of the CPU even when rendering several hundred bullets. :DD Sorry, did some testing with no$gba emulator and realized it uses more like 50% CPU @ ~ 900 sprites... still this is pretty good for 900 moving sprites and rendering game text. ^^ About 30% of the cpu is going towards the opengl calls directly. Feel this may be able to be improved however possibly using quad strips, or writing to the 3D registers without using opengl.

There are other schemes, some involve swaping LCDs each vblank, which then capture directly from the screen output making certain effects possible. I will probably experiment with these as well..

Also made some progress with custom malloc implementation. It works well and its much easier to diagnose heap related issues by creating custom malloc debug output. Need to work on it more, but it already seems faster and more consistent than the default malloc. :p

Am still out of town and staying with friends so work on personal projects is slow. Considering moving here, at any given time are several dozen low level embedded programming jobs and the people seems friendly here mostly. ^^/

2009.05.06 ~ lalala

A friend i am staying with suggested a way to find some bugs I've been having recently relating to malloc failures. Simply create my own malloc implementation. Thats actually a great way to go as I'd be able to trace most any malloc related problems. There may be something related to fragmentation.

Also have created a 3D dual screen sprite engine. :DD Very experimental and am having problems with scaling, making 64x64 textures actually show up as 64x64 pixel quads. >_<

Very busy atm, staying with friends in cali, and do not have much free time. Still making some progress...

2009.04.19 ~ Musics

Hello, have created a version of the Eternal Shrine Maiden and places it on the Musics page. ^_^ There are two versions one is GM on the SK88Pro another is mostly PSG using the NDS_BGMDRV. Feel i can do better ._. hopefully with practice will improve. Like the PSG versions slightly more than the midis.

Lots of things happening now, I'll write more here in a bit. :D

2009.04.07 ~ More Distractions

Worked on the Caramell Dansen Instant Movie Create for the past few days. Its nice to have full background mode support now.. :D There is one more thing feel compelled to look into before resume work on thds. Wish to attempt a dual screen 3D sprite engine and see what the danmakus looks like at 30fps. There are numerous problems with the current spritelib, nothing really too annoying but its limited in certain ways the 3D engine would not be. Am considering releasing the game in its current 2D sprite state, apprehensive because it has a few issues and not sure it would make a good impression. u_u We'll see tho... hehe

2009.04.01 ~ Temporary fun distractions

CaramellDansen Player.. testing the font renderer from here...
Distracted from THDS but not completely, developed a replay system, and added replay options to the menu. Now at the end of each level you have the option to replay, save, or go back to the main menu.

Also have been experimenting with various video players, and the BMP backgrounds, aka MODE_5. Have nearly completed Thbg library, really only thing left to do is complete the documentation. The background system works wonderfully in tile, and bmp modes, and provides several facilities for loading or displaying backgrounds, managing vram, rotation and effects, etc. Really the only additional thing I'd like to add is allowing an Advanced thBgInit() function for specifying the VRAM sizes, so that in BMP mode both backgrounds 2 and 3 can be used if desired. Experimenting with a font renderer, and some png, blit, clip functions as well... More on this later... Working now on the my last video player, for CaramellDansen this time. Me and friend are fans ^^

Last for today, *sighs*... saw this game for the nds and well was amazed! Makes my touhou look rather dated ;; It is now very tempting to attempt a better spritelib based on the 3D engine. ;;;;;

2009.03.29 ~ A thought & Bugs..

Since having the issues with arm7 being unable to hold both mp3 and mml players, have thought up something.. had considered putting arm7 code in mainram, but really didnt consider just moving the bulk of NDS_BGMDRV's synth code to the arm9 and creating, an IPC struct for the rapidly changing audio registers such as volume, frequency, and then create some fifo calls to indicate when its time to change sample start, loop, and len registers. In that way the arm9 would hafta handle the work but it seems like an insignificant CPU load... more on this later.

Have two annoying bugs that have been noticing for a few months. 'Annoying' because they do not predictably reoccur so are difficult to isolate. They are:

  • Sprites getting stuck on, sprites disappearing at random.
    • Very infrequent but occasionally happens. Sometimes play for hour or so without anything, then will get few in a row.. @_@
  • Opening of file fails after the 3rd of 4th game during restart.
    • Can be any file just suddenly wont open...
    • As far as i know have been no complaints like this for NitroFS, i am letting my nyanroll program thats pretty i/o intensive and uses multiple simultanious files run overnight with some debugging code in case of failure.
    • Occurs sometimes during menu display operations as well

Will use this section of blog for various notes on these bugs.

2009.03.28 ~ Defeated ;; (Temporary??)

Okai, to resolve my heap issues tried moving the mallocs to arm9.. but the decoding went significantly slower!! Like to the point that it could not keep up with the decoding even at 32000 sample rates... Why was this?? Why did WinterMute claim the arm9 could only ever have 96K for code,heap and stack?? Well this little burb on shared fast ram is a clue. This seems to also be known as IWRAM or WRAM, and this is where the arm7 code is placed by default because it is a seperate bank from RAM and therefore does not encounter waits from being shared with anything else (such as the arm9). I really desire to playback MML as an alternative to mp3 soundtracks.. however this is looking less and less possible (,._.,)

For reference, the size of NDS_BGMDRV:

arm-eabi-size arm7/build/bgmdrv7.o
text	   data	    bss	    dec	    hex	filename
6672	      0	      0	   6672	   1a10	arm7/build/bgmdrv7.o

Some things i may try is to allocate the ram used less frequently for helix on the arm9 side, or alternatively place the BGMDRV code in main ram.. I'll figure something out this weekend... *sighs*

Went over the code for NDS_BGMDRV and Helix mp3... It may be possible to reduce the code size slightly, mebbe move some tables off to Main Ram... this would be slightly time consuming, so have decided to just.. for now.. render my MML soundtrack to mp3 instead of rendering directly on the NDS in real time. I need to get this game working, and feel it best to do this compromise, for now, and come back to it later. u_u,,,,,,,,,,,

2009.03.28 ~ ARM7 heap of mess

Okai! For sure have identified the problems with mp3Init() failing. Looking into the helix decoder, buffers.c has several malloc calls using the sizeof() various structs. To determine the size of these structs I did the following:

extern unsigned char teststruct[];
unsigned char teststruct[sizeof(MP3DecInfo)

The various sizeof()s are same as what is malloc()'d by the AllocateBuffers() function in helix's buffers.c. Now using the following shell command i get:

arm-eabi-objdump -t arm7/thds01new.arm7.elf | grep teststruct
03809040 g     O .bss	00005d08 teststruct

indicating that helix mp3 decoder requires 0x5d08 or 23816 bytes of arm7 ram to be free!

Another way to view this is using the arm-eabi-size command which, with the above global array teststruct representing the space required by helix, returns:

arm-eabi-size arm7/thds01new.arm7.elf 
text	   data	    bss	    dec	    hex	filename
63600	   2216	  28288	  94104	  16f98	arm7/thds01new.arm7.elf

This is dangerously close to the 96K default limit of ARM7's RAM. ;;; By the time you add in some space for the stack, and whatever else is required can see that most likely the mallocs are failing simply due to a lack of space as i suspected from the beginning. Went through these exercises because was wanting to see exactly how much ram is required, and have the proceedures documented in case this comes up again.

Now, do i modify the linker scripts to give the ARM7 a larger slice of RAM?? (wintermute claims this impossible, but again i don't believe in impossible!) or do I allocate the ram on the ARM9 and pass pointer over to helix?? The advantages of that would be that others wishing to use thMp3 and some other ARM7 code wouldn't need a special linker script just for it to work, and would free up lots more ram for other things on the arm7 such as Power Control Driver. I need to do some other things for few hours and will ponder both options in the mean time.


Took some time away from thds, instead worked on improving my background library (still needs a bit of improvement, but works gr8 in bitmap mode now) and created nyanroll.nds as a happy means to test it. Okais getting back to the thds issues...

As i mentioned before problem is during Helix's use of malloc() to allocate a few relatively small structures durint mp3Init(). Talked with wintermute, who said "you only have 96K in that RAM" which contains the all text, data, heap and stack space for the ARM7. He also said that it was not possible to increase the ARM7's size > 96K... I really don't believe anything is impossible! :P But jaja... lets see how much space I'm using currently..

arm-eabi-size -x arm7/thds01new.arm7.elf 
text	   data	    bss	    dec	    hex	filename
0xf8c4	  0x8a4	 0x1178	  70368	  112e0	arm7/thds01new.arm7.elf

Total used space of all 3 segments is: 112e0 or 70368 in decimal. This seems to indicate that there is 27936 bytes remaining.. Which seems as if it should be plenty.. for stack and heap. I am assume that the stack space grows downward while the heap grows upwards. This is really odd, it should work... @_@

Time for dinner, will look more into this later..


Trying to add NDS_BGM and encountered a really evil unrelated bug. For some reason mp3Init was failing, some trouble shooting determined the arm7 is failing to malloc(). @___@?!?! The mp3Init happens immediately after thFifoInit which itself does not use any malloc calls. The thmp3 demo code compiles and runs fine... a version of thds that was compiled last week without either Lua or the NDS_BGM code which worked fine on the emulator I found out does not work on actual hardware. It is very confusing indeed...

~sighs~ Been working on this for past 4 hours and really is most frustrating thing I've yet encountered. >_< Partly is why i am writing here, getting no where is very annoying and felt needed break...

I am very unfamiliar with how the libnds/devkitpro's malloc scheme work. Guess the next step is to look at libc, the malloc code, and the linker scripts. I should get to it...


Working today on the Lua implementation, and making some notes on what the stage scripts can currently do. Each stage 'step' has a wait time, each step can be one of the following commands:

mp3PlaylistPlay(steps->index);	//play song
mp3FadeOut(steps->duration);    //fadeout and stop 
bulletCreate(&stagebul, 35, 226, -570, 0, &badv, 0, -10); //a graphic on screen
thTextWriteXY(steps->x,steps->y,steps->name); //write text onto the screen
//STAGE_CHRLOAD (if this is first character loaded it is assumed to be player and immeditaly summoned)
thStageLoadCastChr(steps->name, steps->index);
thEntitySummon(steps->index, &cast[0],,,0,defhealth); //summon a character
thEntitySummon(steps->entity, &cast[steps->index], steps->x, steps->y, steps->flags,defhealth);
thEntityBanish(steps->index); //remove a character
tocast=spellFindByName(steps->name, entities[steps->entity].achr->chr->grimoire);
thSpellCast(steps->entity, tocast);
thEntityMove(steps->index, steps->x, steps->y, steps->duration);
thEntitySetInc(steps->index, 0, 0);
	defhealth=steps->index;	//set default health
	thEntitySetHealth(steps->entity, steps->index);	//set health for specific entity

Trying to figure out exactly what i want to accomplish with the Lua. To be honest seems I could implement most all of the game's higher functions, such as menus, character definitions, stage definitions, dialogs, and even some of the spell functionality.

Currently the bullet engine is sort of like a particle engine on steroids hehe. Have seen other bullet schemes that use either basic functions such as x, y incremental values where each frame a value is added to x or y coordinates which then moves the bullet, or another popular scheme where each bullet has a function assigned to it that is called each frame which then changes the bullet's position. (horrible descriptions, sry u_u)

//example of simplified bullet particle style engine
void bulletUpdate(void) {
 int bulletcnt=0;
 do {
 } while(++bulletcnt<bulletmax);
//example of function style bullet system
void bulletUpdate(void) {
 int bulletcnt=0;
 do {
   ((bulletfunctype)bullet[bulletcnt].func)(bullet[bulletcnt].data); //function is called
 } while(++bulletcnt<bulletmax);

The thds bullet system is more like a synthesizer, think of x and y as two waveform generators with the option to attach a function to each bullet if desired for more complex or interactive movements. In this way complex patterns can be generated by simply setting a few values for each bullet during creation and then forgetting about it... or this may be used in conjunction with a function assigned to the bullet and this is used for things such as homing or in the case of entities (players and enemies) the function is used for the character's logic (characters are essentially bullets). This scheme is very cpu and memory efficient using a maximum of 30% CPU during even the most complex pattern combinations.

What all that means is that minimal action by any potential Lua script is required for bullet pattern generation even if Lua is used for pattern definition directly. Very nice... :D

Started on it ealier, have so far been calling only simple Lua scripts during each stage while still relying on the old stage system for evaluation. Must sleep now... very tire z_zZzZZZ


Have not made much progress on the game itself these past few days. Have completed my arrange of Lotus Land Story, it sound lovely when played on the NDS. \(^_^)/ Now I am going to soon attempt to make a MML version using meraman's new NDS_SMF2MML utility. Would like to use mml for alternate bgm in thds. Much in the same way ZUN offers midi versions in addition to the .wav soundtack. And so this brings me to why I am posting today...

These things I need to do in the immediate future:

  • Convert stage scripts to use Lua. This will make for more robust control over game flow. Would also like to make character scripts utilize Lua, but mebbe in thds02
  • Add replay code
  • Add the before mentioned NDS_BGMDRV
  • Simple settings menu

Things to do eventually:

  • fix bugs
  • create more levels

Earlier today attempted to create a short demo video with my crappy digicam, however it can only record for 37 seconds which is hardly enough to demonstrate the game's features. May upload the video anyway it is sort of interesting. okai, uploaded it here. >_>

Found this other touhou for ds the other day. They seem to be using weeaboo's engine. The page is in Japanese, and it was my first encounter with .jp captcha.. @__@;;

Oh, almost forgot. I am trying to raise money for this server, do not like just asking for donations so I am considering selling shell accounts and/or virtual servers. More information. Thanks :D


Been working lots on thds past few days. This night spent some time fixing bugs in various places, while spend most of the day evaluating and experimenting with a128's Lua port for nds. Lua seems a wonderful fast small scripting language, and will most definitely be using it for the level scripts and possibly for characters and spells too. Previously had created a very simple parser for level creation, which works well and is quite fast and small however it lacks conditional statements and the ability to loop. To create 10 nameless fairies in a row i actually need 10 individual code blocks with each summoning, moving, and casting spells. The stage scripting engine is quite simple at the moment and should not take much more than an hour or so, however since i'm new to lua will take longer ~_~ hehe

Been working more on the Lotus Land Story arrange, its one of my favorite Touhou songs, so really trying to do my best. Always room for improvement. u_u Would like to do a MML arrange soon.

The animated sprites look very pleasing. ^_^ Graphics are improving, however slowly.

Need to create a bug and todo list page.

Today Touhou 12 Unidentified Fantastic Object Demo was released! Unfortunately it does not function with wine ._.,, ZUN plz use opengl instead of dx from now on okai?? :P May play with it some more later, till then nico and utube videos will hafta do.

Finally got around to testing thds on actual hardware, it is looking and sounding alot better since last post. XD


Had some server issues, but have them sorted for now. Been working on game lots, always finding one more thing to do. Noticing more bugs as i play it, mostly in regards to the graphics. The graphics could really use some work too, I am no good at all with creating gfx, tho feel do good at backgrounds.. but my characters and bullets are very flat and ugly. ;;;;

Added homing to certain bonus boxes and have been experimenting with various scoring schemes. Also having some fun with the player's power level. ^^ Really need to add spell bombs and replays then think all of the game systems will be in place and can begin debugging. XD


Recently made a transcription and did arrange of the Lotus Land Story opening track. Trying to work on an mml arrange for NDS_BGM but having problems with MIDI in wine and 3ML. Pretty sure it is actually timidity thats messing up, so perhaps trying it on laptop will work better. ^^ Found another MIDI to MML conversion program called Sakura, it seems really nice however it also is not working properly within wine. >_<

Also been working on the game itself, both coding and developing a level using the new system. Said about 6 months ago i wanted to provide some type of demo for testing the various systems on different cards. Very close to this objective now, and am mostly holding off while i improve the graphics just a bit. The characters and bullets are quit large for the small screen.

Server has been having issues and has been down quite often. I am sorry. First there were PSU issues, then the motherboard died. The following week the system locked up and most recently it pinged out. Am unsure the reasons but grrrrr.


Herro! Survived the worst ice storm this region has seen in a while. Was without power for several days, more on that (including pics!) here.

Worked on thds a bit, but mostly have been working on LIBTHDS which i guess is sort of related. Improved the documentation a bit and added some things to improve compatibility with newer, but not the newest, libnds and devkitARM. Having issues with LIBPNG, where it does not want to load large images giving the error "libpng error: Invalid window size". This will need to be fixed, but so far its not interfering with development on Touhou so its a secondary concern.

Need to find more work, have completely ran out of money... ~_~ Should have small payment from last job coming in two weeks, hope i can hold out until then. Do not know where to find work, it usually finds me by word of mouth. Need to write up a resume and work history, things I am not good at...

quick note, to get .sym file:

$DEVKITPRO/devkitARM/bin/arm-eabi-objdump arm9/thds01new.arm9.elf -t | \
 grep -G "\.text\|\.data\|\.bss|\.rodata" | \
 awk '{if($6!="") {print $1" " $6;} else {print $1" "$5;}}' > thds01new.sym



As of today have power ups and bonuses working, along with associated graphics and effects.. :D There is still an annoying ginormous memory hole being created someplace, can only play twice before it runs out of ram. Need to do some calculations, but for now do not think I'm using that much memory, so perhaps there is a invalid pointer being free()'d someplace? I'll fix soon.. >_>

Would like to add a few menus now for settings, character selection, and spell practice would be nice to evaluate new patterns. Moving along ... ^_^


Past few days, and especially the past 24 hours (with 2 hour of sleep) accomplished lots. ^^^^ Fixed some problems, animooted the nameless fairies, ported the familiar spells and gfx from my original game to this one, investigated and fixed a few bugs, added a health bar for opponents, etc etc.. :D Did some more but cannot remember as brain is shutting down, need sleep u_u... Was in middle of adding power-ups and bonuses and realized just staring at screen blankly...

Also the geekier type among you may want to lookie @ my other project the 3DCube. It is a system for measuring objects visually. Have, as usual, improved it much since posting that page. Figured out a better way for isolating the points of interest in the image allowing for much greater accuracy by using the median and subtract filters. :DD

okais gnights zz//

2009.01.14 bit better gfx...

Getting better...

Been working lots. Improved the player firing's system so that power level determines which spell is used for firing. In this way the first 8 spells of any player character represent firing routines for up to 4 spells in either focused or unfocused mode among other things. 8=4*2 :D

Still not great gfx but things are improving. The backgrounds look gr8. I should prolly stop spoiling with screenshots, but the page was starting to look a little fugly so, jaja... :P

Sorta wishing i had made the characters 32x32 pixels instead of 64x64, afraid am going to run out of VRAM soon—changing to 16 color sprites may help dramatically... Have only one animated character at present, a kaguya, and if i load 4 characters at once + animooted kaguya start having some issues, however my calculations and even VRAM Malloc both say i'm not out of ram, so why it refuse to load?? @_@ Have a small but growing list of bugs that need attention, but will prolly wait until most of the systems are in place before troubleshooting.

Some things needing attention still:

  • character dialog screens. if i dont get more sprite ram this will be very difficult. a128 send me a nice thds lib compatible PNG texture loader. One nice thing about it is that he loads first to RAM before binding to a texture. Thinking it may be best to add this intermediate step so that sprite graphics may be loaded into ram at start of each level and then loaded into VRAM as needed. In this way bullets, familiars and other unnecessary sprites can be unloaded during the player dialogs. ^^
  • player character selection menu (you may change characters easily just need a menu)
  • scoring systems
  • configuration menu
  • replays!

Also, need some Youmu music... u_u

2009.01.07 gfx... ;;;;

Kaguya vs. Marisa x Kaguya?!

Happy New Ear! Been working on game's code recently. Mostly implementing a few last details that have been bugging me. For instance tile, rotational, and bitmap backgrounds are supported. May post the bg management code soon, supports dynamic vram allocations, load(screen,bg,"filename",opts) style loading of tiles, maps, palettes, and lots of supporting macros for scrolling, rotation, and such.

Created a better system for managing character's graphics too. The image on right shows quick test where Kaguya was loaded instead of Marisa causing all the graphics to change, even the animations data. :D Character gfx can now be changed easily, which is a good thing because the color scheme in the screenshot makes me wanna puke. >_<

Need to spend more time on graphics, game engine is nearly done, music is coming along, but the graphics have been forgotten about for months now. :/ The character's themselves could use some work, and worse, the bullets are at the moment little more than various colored dots with the exception of marisa's stars. Otherwise things are going great. :P

2008.12.25 ~ even moar music

Merry Xmas!!!! <3 <3 <3 Heres another song, parts of it make me laugh, specially the guitar solos as they sound soooo serious! As if someone looking like this when they play it: \m/( >_<) hehe... Getting more used to the sk-88, did this in only 2 days, still moar work to be done but before getting this far would have taken week at least when had to edit instruments manually. Does not really sound Touhouish :/ but hopefully someone like anyways, Pyongyang Solstice :D

2008.12.11 ~ moar music

Big gap between now and last post eh? >_> been doing lots!!! Much busy. :D Have not worked much on the game's code because spending so much time coding for work is draining brain juice. u_u; Received some recent encouragement however and hope to resume shortly. In a few weeks will mark the one year anniversary of starting this project. hehe Really did not notice the time going by so fast. But the game is improving, instead of coding these past weeks have been reverse engineering some Touhou tracks and working on more game musics.

SK-88 Pro!!! ~\\(^_^)//~

Firstly, gots a Roland SK-88pro last month, have not had much time to play with it, only now figuring out how to use the GS Advanced Editor which lets you modify the sounds from PC and save your configurations. Like the small size, but sometimes rly wish there was just one more octave.. ;; Otherwise its gr8!! Likes the effects and especially the distortions and guitar amp simulation. Here is a very unfinished song created with it, Incomplete Happiness. Heard about this SC-88pro from here, fanx!! XD

The wuvry hough transform. Finding lines in the Brooklyn Bridge. :D

Here also is the Maple Dream done as mml on nds. Used mostly PSG except for the drums. First recorded a version into Reason, then exported to midi, which imported into 3ml, which then was transcribed into mml for NDS_BGM. Kinda round about way, but sort of like the result. Also here are the MML text and .bdt file which can be played on NDS_BGMFILER. Really like this video of Maple Dream on nicovideo, even though it is not much like the original song. :D

Lastly gonna ramble about what i've been doing with work for a few lines. Been doing computer vision programming, part of it involved creating an implementation of the Hough Transform. The linked to wiki page does an amazingly good job of explaining, but basically its an algo to find lines in binary images in a very neat, reliable way. What we are finding lines in, and why is secret. >_> <_< hehe

2008.10.19 ~ MML rant

Akyu's Untouched Score Vol. 1, mml along the left side.

Since pc went unstable and have some paid work to do been very busy. u_u Always been curious about MML since i got Akyu's Untouched Score Vol. 1 CD and finding buncha really cryptic code looking text on the back cover and realized had seen the same sort of thing described on a page concerning a background music player library for the NDS which used MML. Also MML seems to be what used for bgm on the PC98 Touhou games (my favorites music!).

Zun's MML on the cover of the varies a bit from this version used by the NDS_BGM. Get the feeling each mml player has its own variations of the language, especially in how instruments are defined since this depends on what the player's hardware and tone generators are able to do. One thing weird seems to be Zun's use of ) and (.

Excerpt of mml from back of Akyu's Vol. 1, no idea what song this is:

DG   a2b=2 >c4.)>cd gcfc edcc<<(
EH   edc <gg>cde fd<b=>ffd<b=>f e4.)g>c e<g>d<g>c<bgg
The 3ML editor

Finally got around to playing with it a little bit. ^^ Could write lots (prolly going to anyway <_<) about what all have found but since this is blog will just describe the process used to make a simple song and give a quick overview of MML.

Needed some type of editor, looking around the only one i could find (mebbe cause i was searching in english?) that wasn't utterly horrible was 3ML. It seems to work. Only real complaints is that it's midi to mml converter quality is poor and it does not seem to compress the data as the site linked to claims. Might be something Im not doing properly however. It'd be nice to have a soundfont that is more like what the DS is capible of but instead used a general midi one.

Since just starting made simple arpeggio bass and drum parts in Reason 3.0, exported it as midi and imported it into 3ML. Some worked okai but other parts were kinda whacked. ~_~ Manually corrected the errors as best as i could, assigned instruments close as general midi would allow then wow mml! :D Saved the work in 3ML and opened the .mml file with a text editor, copied out each track individually, and finally copied out the instrument definitions from one of the Super Mario World examples that came with the NDS_BGM driver files.

Afterwards each individual track looked something like this:

(t12)	//arpeggio1
	T136 @S3 S127,4,96,32 K0 L4 V3 Q8
	@v44 P32
        etc.. etc... blah.. blah..

Quick explanation of some of the symbols.. "(txx)" = track number (0-15 on nds), "Txxx" = tempo, "@Sx" = square wave duty cycle and also seems to tell the BGM to use the built in PSG oscilator instead of an audio sample, "Sxxx,xxx,xxx,xxx" = Envelope Attack, Decay, Sustain, Release respectively, "Kx" == keyboard? honestly, im still not quite sure @_@, "Lx" = default note length, "Vx" = volume (0-15), "Qx" = note duration (8 = full, 4 = half, etc), "@v44" is another way of setting the track's volume using a scale of 0-127 instead, "Pxx" is the amount of pan for the channel (0-127, 64 = center), "ox" = octave, ">" go up one octave, "<" go down one octave, "//" starts a comment, and "abcdefgh" (a thru g) represent the notes. If a number follows a note it indicates the notes duration such as "a4a4a2" being two 1/4 notes followed by a half note, additionally "^" = tie, "." "r" is a rest, "-" is flat, and "+" makes the preceeding note sharp.

Problem with this is its very repetitive however if you notice each line is the same for several measures. For this mml supplies { } for making macros and [] for repeating. Consider following examples:

   [4 abcd] 
{i   efga}

will playback as:

   abcd abcd abcd abcd
   efga efga efga efga efga efga efga efga 

Where [4 abcd] indicates to repeat abcd 4 times, and {i efga} defines a macro labeled "i" and is told to repeat it 8 times on the next line with [8i]. Simple eh?? Guess this is where the 'Macro' part comes in in the name. hehe

Using this technique was able to squeeze the length of the .mml down quite a bit. For instance track 12 quoted above was compressed down to:

(t12)	//arpeggio1
	T136 @S3 S127,4,96,32 K0 L4 V3 Q8 @v44 P32
{i	aded<a>def}
	[2 l16o5 [32i] l1[16r]]

representing 32 measures of music. ^^

Next needed to use the BGMMMLconverter supplied on the NDS_BGM page to convert the file to .bdt format but there was small problem of using linux and the program was compiled for windows. No big deal after a few mods to the Makefile it compiled without incident. :DD Moved the the .mml file into NDS_BGM's source directory, modified it's Makefile to use myfirst.mml instead of one of the original songs, compiled, loaded into NO$GBA, and cautiously pressed play... again WOW MML!!!!! \^_^/

The driver rendered the song exactly as it had played in 3ML except much more ossum sounding! (I'm quite fond of square waves :P) There was small problem of not hearing the drums which was because had not defined any sample sources for them and even after adding the drums they were very low level compared to the highly energetic square waves from the PSG, so tweaked some of the notes, the levels and envelopes and after a while had audible drum track. Also added some PSG noise effects for fun! ^^

Might wanna note that 3ML will happily output very long strings of notes, and bgmmml seems to have a character limit per line. If some notes are cut off might check this. Also non macro lines containing mml should begin with whitespace to be recognized.

Was a small problem here in that the drums were not staying in time. no matter what they would swing out of time and back. Since doing everything i mentioned above had taken nearly 2 days, decided to ask Meraman (author the BGM driver) to see if was doing something wrong and sleep for a bit. Next day kindly responded and explained that it was because im trying to use triplet and quintuplet notes, the output of bgmmml.exe, and made the suggestions that follow... Output of bgmmml:

--> Track[01]   12288 count
--> Track[04]   12290 count
--> Track[05]   12290 count
--> Track[08]   12288 count
--> Track[09]   12288 count
--> Track[11]   12288 count
--> Track[12]   12288 count
--> Track[14]   12480 count

The 'count' indicates the length of that track and tracks 04 and 05 which are the bass and snare were a little big. Track 14 was a little large as well but it is supposed to for the ending effect. The note length specified as L4ABCD or as A4B4C4D4 where 4 = a quarter note, 1 would be whole note, 2 half note, etc etc. And the values I had used originally:

{i      crcr c r5 c9 r13 c16c16r8c8 cr c5 c20 r8c8}

The "r5 c9 r13" and "c5 c20" parts both contain aliquant numbers of a measure.

Suggested mml:

{i      crcr c r*38 c*20 r*14 c16c16r8c8 cr c*39 c*9 r8c8}

Notice the corrections, the * operator indicates the length is specified in clock ticks instead of fractions of a measure (such as 1/4th 1/8th 1/16th notes). There seem to be 48 clock ticks per quarter note or 192 clock ticks per measure. By using this method seem able to get a finer grained duration adjustment and can assure the notes will always line up properly.

Applied these corrections to myfirst.mml, Added not very good (>_>) melody to the end to break the repetitiveness, edited a few more notes, tweaked sounds a bit more and here is mp3 of result recorded off the DS itself, and Myfirst.mml.tar.gz contains the .wav .mml source files as well as a .bdt file which seems to be some intermediate format. Neat that such a short piece bit of code can result in nearly 2 mins of music. ^^ Song is short and just a quickly conceived experiment in mml, but i do like the arpeggio parts and will probably use them somehow in the game's soundtrack. :p

Unsure if will use this player in the game, even though it is sooo~ perfect and true to the style. Arranging all the music i have already into MML would take up great deal of time and game is already taking forever. Maybe use it for an alternate soundtrack to the mp3 verision?? Wish i had tried it out earlier. u_u Most likely any following games will use it somehow. :DD Composing in Reason (or some other midi editor) and arranging into mml seems to be a good way to get very well formed background music that renders without a great deal of memory or cpu bandwidth. Additionally have seen lots of Touhou music already in mml format, such as this. Just need to adjust the instruments to NDS_BGM's expectations.

Really talked quite a bit in this post. *^_^* But hope may encourage others to try MML.

2008.10.07 ~ hdd woes

Failing hdd is failing. Thankfully, keep multiple backups :D

My new less than week old HDD is flaking out. Right after installed noticed it make grindy noise ... occasionally... but seemed to work. Yesterday i heard what sounded like a bzzzzzzzzzzzzzzzt noise for only a second or so, and then thought oh i better tar up the touhou dir (woulda svn'd it but wasnt sure if the data was corrupted already) can see what happened by the pic.. :\

Stupid seagate brand drives have never done good for me. Anyways after a total failure, it took forever to reboot but it did and now working fine, all the diag programs (SeaTools for instance) say its all good. >_> Got a video from one of the times it was being noisy and not at all all good. Hoping they will RMA without it being 100% bad. ;;

Anyways more unwelcome delays. u_u Was working on an improved scheme for associating bullet patterns (which are in C but take parameters from the character scripts) with the character definition scripts themselves when drive went nuts. Managed to get the files backed up after a reboot. ^^

Hopefully I'll have some actual touhou progress to report on soon, and not just blabbing about my PC issues. ~_~


Been a while since writing here, been taking care of a few other things. Got a new lappy, a tablet pc with wacom pressure sensitive screen even :D Hope to use it among other things for help improve the graphics. Old laptop was junk that crashed all the time under high cpu loads. Also have gotten a new HDD for desktop PC where most of coding is done. The 40gb drive in it currently is insanely cramped and makes grinding noises when first starting.. ~_~ However nothing is without problems it seems and trying to install Ubuntu on it has been a pain. Past three days have had one problem after another with CDs, drives, settings, etc but just now finally got it booting off the new drive so tomorrow seems promising. *cross finger* Installed fine onto the IDE drive i've got now but SATA seems to be acting up, windows wouldn't install properly either, nor would FreeBSD so @_@?!?

Been working on new song for game, and editing the graphics a bit. Also made some decisions and implemented the player's firing and spellbomb scheme. Yes players can shoot back now. :D Decided to make the player and boss character scripts separate from each other. Originally intended for them to be the same but this way is easier code wise and more flexible. Edited wiki a bit too because the content list had become too dominating of the page's header.

Sorta late from when i first intended however still intend to put out some sort of demo soon to test the game systems in teh wild. Tried it recently on another flash card friend had with a 128mb microsd and noticed some loading delays, music still plays and graphics look fine however this is mostly why feel it needs testing on other cards. Want to be sure its compatible as possible. ^_^

Been playing PCB a bit the past week, never have beat it :/ Very much out of practice now will hopefully improve though >_>

Will get back to game full time shortly, breaks from routine are good for your sanity. :p

Older Blog Entries

Older blog entries may be found in the archive here.

( ^◡^)ノ

Personal tools
irssi scripts
eggdrop scripts