Thds

From ProjectWiki
(Difference between revisions)
Jump to: navigation, search
(2008.09.15)
m (Reverted edits by Sendy (Talk); changed back to last version by Flying Miko)
 
(160 intermediate revisions by 19 users not shown)
Line 1: Line 1:
 
<big>'''Touhou Fangame for Nintendo DS'''</big>
 
<big>'''Touhou Fangame for Nintendo DS'''</big>
 
__TOC__
 
__TOC__
''Project Status: Work in progress''
+
''Project Status: On Hold (Temporarily)''
 
==What is this?==
 
==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. ^^
 
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. ^^
Line 15: Line 15:
  
 
==dev blog==
 
==dev blog==
Here i will talk somewhat informally about development progress.. enjoy ^^
+
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 [[Thds/Blogarchive|here]]... enjoy ^^
===2008.09.15===
+
Eventfull day here yesterday, we had remains of Hurricaine Ike blow thru here with winds up to 75Mph. Was without power most of the day :\ Played [http://meraman.dip.jp/index.php?NDS_TGM TGM] on nds and listened to music from psp to pass time made it tolorable :D Also over the weekend picked up some coding work involving processing images from a video camera, only have a few days to complete my portions so will probably be busy mostly with this week.  
+
  
Okais, oh yeah blog is supposed to be about the game, have not done much coding on it, did fix the annoying purple square around my marisa sprites. Both modified my gfx converter to take a bgcolor argument if necessary and also figured out why GIMP was saving the image with a randomized color palette (it had transparency channel on the layer adding an additional color to palette). Either one of these things would have fixed the problem but having both fixed is nice. :D
+
===2010.07.15===
 +
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;
  
Am concerned a bit now about the sprite multiplexing scheme. There are two issues, firstly the bullet updating function sometimes runs in between subscreens meaning you'll get 'broken' sprites where the top and bottom half's dont line up along one of the 4 subscreen boundries within each screen, only for a frame or so, but still its visable and bothers me. Also sometimes the bullet update function takes so long after being started in VBLANK that it updates during line 0 being drawn, this causes corrupted sprites to appear, only for one frame but grrr hisss.... This can be fixed or worked around in a few ways, best way atm seems to use the last subframe write to wake up the arm9 and do bullet updates, or double buffer...
+
Have done some new musics in spare time:
 +
* [http://blea.ch/~eris/litter/idgi3.0.mp3 I Dont Get it.mp3]
 +
* [http://blea.ch/~eris/litter/BlackTheCandle2.mp3 Black Candle.mp3]
 +
* [http://blea.ch/~eris/litter/hmmmz4.4.mp3 hmmm.mp3]
 +
* [http://blea.ch/~eris/litter/nfi4.1.mp3 N.F.I.mp3]
  
Second sprite issue is the arm7 uses alot of memory bandwidth during certain mp3 decoding operations, if these happen to occur during a subscreen update there is possibility of 'flicker' from tops of subscreen boundries, its very intermittent and not very noticable but i can see it and also bothers me. Possible way around this is to occupy the arm7 with operations not involving memory access for duration of vhblank.. Might just put vblank interrupts on the arm7 coinciding with the arm9's updates.. Another maybe even better solution would be to double the number of subframes from 4 to 8, and reduce the number of sprites updated during HBLANK. For smaller sprites that may actually increase the maximum number of sprites possible for dense danmaku clouds, it would also simplify fixed priority sprites a bit.. :D
+
Will probably take a break from it all very soon, i need it. ^__^;;;
  
Both of these solutions are hax hax haxy, and i do not like them, but to make this work best may need to.  
+
===2010.03.19===
 +
[[Image:Mmledittests.png|thumb|260px|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 [http://meraman.dip.jp/index.php?NDS_BGMDRV_ENG 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 [http://qt.nokia.com/ 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. ^^
  
Sorry to rambles do that when tire. Need to nap for a bit and resume work on for hire project.. u_u//
+
===2010.01.10===
 +
Have heard that the NitroFS driver and possibly the [[Thfifo|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. ^^
  
===2008.09.11===
+
===2010.01.09===
[[Image:Stage_one.png|thumb|Screenshot of stage start, just thought it looks sorta purdy ^^]]
+
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
Made a video [http://www.youtube.com/watch?v=8krGT4BSV5I video to show a few friends] ^^ sorry digicam wont record for much longer... ~_~
+
  
It's at a good point to take break for few days, got lots to do (like work to pay for this server, am a bit late >_>) tho mostly exhausted trying to get all the systems working together. :\ Still, <3 touhou and does most everything technically required now. XD
+
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. ^^''
  
Its debugged as far as i know, gots stages, levels, bullets, patterns/spells systems, along with characters, hit detects, animations, made things more scripted instead of coded etc..  
+
===2009.12.17===
 +
Mary XMas! :D Deck the halls with danmaku! ^^
  
Found [http://mana.hacca.jp/ this site], likes the style of art... sorta touhou related hehe
+
===2009.10.26===
 +
[[Image:Bts-Screenshot.png|thumb|left|280px|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 [http://en.touhouwiki.net/wiki/Lotus_Land_Story Lotus Land Story] and the related [http://en.touhouwiki.net/wiki/Akyu%27s_Untouched_Score_vol.1 Akyu's Untouched Score CD]. Really sorry to anyone following blog and waiting patiently.  
  
gots a dentist appointment today and will be gone for a good while, is part of why feel should take break. bbiab i hope :D
+
Normally do not release work in progress materials but since again i been sorta busy and not coding on game or writing to blog <s>here is a [http://blea.ch/~eris/litter/BTS-transcription-nodrums-yet.mp3 WIP version of Break the Sabbath]</s>. 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.
  
===2008.09.08===
+
<s>Will probably add drums later tonight if i'm not too long working @ day job :p </s>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.
[[Image:Almostthar.png|thumb|Few issues to sort obviously...]]
+
Getting there, integrated my old spells system into the newer version of game. After doing so realized why i hated the old spell system so much. :P Just wanted to get it working again to see how much cpu it used, still at only around 12% XDD Can see from the image it has a few issues, for one thing gimp is not saving the palette in proper order on the Marisa image so ya get a purple square around her, thats not such a big deal because have a sprite converter just not using it yet for these tests. Here i am testing spell functionality so just not a concern, yet.
+
  
Spells need to be defined in the character scripts instead of how they are at the moment using const tables. The main thing thats going to change is moving as much as possible into textual scripts to ease changes. and also because stuff like:
+
Note: did i mention its one of my fav++ songs?! ^____^
<source lang="c">
+
//movements
+
spellMoves_t moarstarsmoves[] = {
+
{128,96,26,240,MOVES_ABS},
+
{55,128,20,240,MOVES_ABS},
+
{200,128,20,240,MOVES_ABS},
+
{128,128,90,-1,MOVES_ABS},
+
{0,0,0,0,MOVES_REPEAT} //last one must be zero
+
};
+
  
Spells_t mgrimoire[]= {
+
'''10-29 - update''' plz enjoy the [http://blea.ch/~eris/litter/breakthesabbath-wip.mp3 With Drums Version]!!!! Still very much a wip, but it sounding rly ossum already :D
{"Moar stars", moarstars, 0 ,0 ,moarstarsmoves ,0 ,0},
+
{"Radiant", radiant ,0 ,0 ,radiantmoves ,00 ,0},
+
{"Border of Insanity", radialstars ,0 ,0 ,topuppercenter ,00 ,0}
+
}
+
</source>
+
is insanely cryptic and hard to deal with... <_<
+
  
Still hope to have a working demo soon, am sorry for delays... ^^
+
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 [http://blea.ch/~eris/litter/mrvainvstouhou101.mp3 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
  
===2008.09.06===
+
===2009.09.04===
Regret still do not have a demo. But progress++ :D Have been working so intently lately think my friends seem a bit annoyed at my lack of concern for anything else, sorry2u guys. Srsly doubt they ever read meh wiki but its the thought that counts eh? Right well onto what all I've done...
+
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|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*;;;
  
Last post said, "My objective for the day is to implement a player entity, provided no  other bugs are found." which turned out to be a curse cause gawds did i has bug. Though after a bit found it, and in the process found out quite a bit about how the ds along with libnds works. One of the biggest wtf i had would realizing that ITCM is located by default starting at location 0x0000. Most systems I've worked with (btw, bit of personal infos, have worked as  embedded systems developer on and off since late 90s) leave the first mb or so of ram unused. Among other things this allows you to protect the region and enable an exception handler so that any access to this area can call a debug routine (stack trace for instance). Since a lot of problems come about from NULL pointers being used when they should not this srsly helps with the debug process. But since memory is not configured like this from default on the NDS, errant writes to this region will result in bizzare and confusing behavior. @_@
+
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. ([[Elf_linking|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.
  
In my game there was a loop, here much simplified as:
+
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;;;;
<source lang="c">
+
do {
+
  blah=resultOfSomething();
+
  printf("blah=%d\n",blah);
+
} while(blah);
+
</source>
+
The printf (which was added to help debug this mess) was displaying that blah==0, however the while loop continued! After quite a bit of researching and experimentation realized that the function calling the function containing the loop had a null pointer being referenced as like: NULL->foo->bar which was screwing up the ITCM resulting in the nutty observations.  
+
  
Something else I found out recently while i'm thinking about it, stddef.h contains a useful macro:
+
===2009.08.01===
<source lang="c">
+
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;;;  
//say u gotta structure like:
+
typedef struct _blah {
+
int x;
+
int y;
+
char *cptr;
+
unsigned short mychar;
+
} blah;
+
  
//and want to know how many bytes from the beginning of the
+
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!:<br>
//structure the element 'cptr' is offset you can use:
+
* [http://blea.ch/~eris/litter/thds01.nds thds01.nds]
offsetof(blah.cptr) // :D :D
+
* [http://blea.ch/~eris/litter/thds01.sc.nds th01.sc.nds]
</source>
+
* [http://blea.ch/~eris/litter/thds01.ds.gba thds01.ds.gba]
This is useful if you wish to manipulate structure elements directly. Similar is concept to sizeof(). Was gonna use it for my script parsing scheme where a const table defined variable names within a structure and where to put the results. Decided not to for now but still thought offsetof() was really neat. :D
+
* [http://blea.ch/~eris/litter/thds01-4squid.tar.gz thds01 source code] and perhaps a working .nds.
 +
<br>
 +
* [http://blea.ch/~eris/litter/thds01new.nds thds01new.nds] Demo of current and probably soon to be abandoned newer touhou, seriously a work in progress..
  
OHH,sry am totally off topic really >_> Okais on the game now have both player and scenario script parsing functional, can load and unload character data required for the level as needed, player character responds to user input, other entities (enemys) can be manipulated by the scenario script. For now am just loading various characters and moving them to various places on the screen. Now need to work one reimplementing the spell casting system that will in addition do player firing patterns and bombs, detecting collisions, and then move on to more specific things such as level design. yay!! \\\^_^///
+
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. ._.);
  
Also made a quickie Marisa enemy and Kaguya player sprites. Not animated yet, someone saw my kaguya posted earlier and made lot nicer one hehe, i should post it here, after asking permission. ^^
+
===2009.07.01===
 +
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 ^^
  
Have lot of notes and rough drawings of levels, music, characters, am encouraged getting this close.... will work more in a bit, am still laying in bed on lappy, needs sleep.. u_u
+
Did some experiments with [[Elf_linking| 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
  
===2008.09.04===
+
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.. ^___^
Installed a subversion server today to keep track of changes in my various project's code and as a way to keep backups off-site in case of catastrophe. :D Implemented stage scripts, an example follows:
+
<pre>
+
#firstly start a bg
+
bg: 1
+
wait: 0
+
  
#nextly start some musics
+
Also noticed Meraman has just completed his [http://meraman.dip.jp/index.php?NDS_MIDDRV_DEV 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!
bgm: 3
+
wait: 5
+
  
#display stage title
+
===2009.06.08===
showstage: A tumbly world
+
Friend ask me about some bullet aiming and homing functions so i pasted some [[Thds/Bullet_code_bits|here]]. Prolly could use some improvement, but it works. ^^
text: Wut am i supposed to do here?
+
 
gfxpng: nitro:/stage1gfx.png
+
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
duration: 360
+
 
x: 2
+
===2009.05.13 ~ 3D sprites===
y: 30
+
[[Image:Screenshot3dds2.png|thumb|3D dual screen Sprites]]
wait:80
+
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.
</pre>
+
 
Nothing too fancy, just wanted an easier way to tweak the scenarios without recompiles. Recreating the entity (player/enemy) systems, spell systems will follow. Had all this done before but redoing to take advantage of [[Nitrofs|NitroFS]] usage and to solve a few problems with original code. Lot of decisions to make, which always slow me down as I'm very indecisive. u_u  Getting there tho! My objective for the day is to implement a player entity, provided no  other bugs are found. Created a Kaguya player sprite and Marisa enemy sprite. Neither are animated (yet! :P) but will work for testing.
+
<s>This system uses less than 8% of the CPU even when rendering several hundred bullets. :DD</s> 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|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 [[Caramelldansen|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 ===
 +
[[Image:CaramellDansenTest.png|thumb|left|CaramellDansen Player.. testing the [http://www.geocities.jp/momoonga/ 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 [[Nyanroll|video players]], and the BMP backgrounds, aka MODE_5. Have nearly completed [[Thbg|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 [http://www.neogaf.com/forum/showthread.php?t=346217 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 [http://dev-scene.com/NDS/Tutorials_Day_2#Fast_Shared_Ram 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
  
Oh, intended to mention something i figured out about DS WiFi... Was trying to get a homebrew game to connect to internet, it would not. Same settings had worked before, then tried the offical Opera web browser, it also did not work. After doing a bit of testing with DSOrganize.IRC figured out it was not resolving the
 
  
Lastly, friend asked who this Zun guy is, did google search, found wiki article, and realized from an old interview he owns and seems to like the NDS. ^5 hehe, wonder if he every looks at fan games. *ponder* *ponder*
+
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.. <s>I'll figure something out this weekend... *sighs*</s>
  
===2008.09.02===
+
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,,,,,,,,,,,
Just thought i'd post to indicate progress is being made. Have reimplemented the main menu system which includes Game Start, Music Room, and Options. Also is a "please watch warmly" splash screen while the systems (such as dldi/fat/nitrofs, etc) are being warmed up. At this time Game Start simply takes you to sprite/bgm/background tests. Would post a screen shot but do not with to spoil, just trust me its sooooooooooooooooooo cute!!! :P
+
  
Since there are no more bugs presenting themselves in the bg and sprite portions, am now returning to the Entity, Spells, and Stage Scenario systems. Previous version of THDS used tables to store scenario and spell data like so:
+
===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:
 
<source lang="c">
 
<source lang="c">
struct StageSteps ezStage1[] = {
+
extern unsigned char teststruct[];
// {EVENT TYPE, wait,  index, char, entity, x, y)  
+
unsigned char teststruct[sizeof(MP3DecInfo)
{STAGE_BG, 0, 0, NOCHR,   0, 0, 0}, //background (bg 1 from list)
+
+sizeof(FrameHeader)
{STAGE_BGM, 75, 2, NOCHR, 0, 0, 0}, //stages bgm (song 2 from playlist)
+
+sizeof(SideInfo)
{STAGE_SHOWLVL, 320, 0, NOCHR, 0, 0, 0},
+
+sizeof(ScaleFactorInfo)
{STAGE_SUMMON, 0, 0, &fam1chr, 1, -32, 0}, //create two entities (enemy characters)
+
+sizeof(HuffmanInfo)
{STAGE_SUMMON, 0, 0, &fam1chr, 2, 288, 20},
+
+sizeof(DequantInfo)
{STAGE_SPELLCAST,268, 5, &fam1chr, 1, 0, 0},    //Start noodley looking spells on each
+
+sizeof(IMDCTInfo)
{STAGE_SPELLCAST,280, 6, &fam1chr, 2, 0, 0},
+
+sizeof(SubbandInfo)];
</source>
+
and for spells:
+
<source lang="c">
+
struct Spells fam2grimoire[]= {
+
// {spell name, spell ,health ,dur ,Moves ,delay ,flags
+
{"right atcha 8x8 L", allatcha8x8 ,0 ,0 ,downandtoleft ,0 ,0},
+
{"right atcha 8x8 R", allatcha8x8 ,0 ,0 ,downandtoright ,0 ,0},
+
{"8x8 L2R", allatcha8x8 ,0 ,0 ,left2right ,0 ,0},
+
{"8x8 R2L", allatcha8x8 ,0 ,0 ,right2left ,0 ,0},
+
{(const char*)NULL,(void*)NULL,0,0,noMove,0} //EndOflist
+
};
+
 
</source>
 
</source>
 +
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!
  
Since the creation of these tables have developed the [[Nitrofs|NitroFS]] driver which would easily allow for scripting to simplify some of these tasks. Thinks should be a hybrid of spells coded in C and scripts to control them rather than going for a total scripted solution such as danmaku fu seems to use.  
+
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
  
There is still some unwanted sprite flickering at certain moments caused by interaction of arm7 ram access during critical horizontal blanking periods when the OAM tables are being updated for multiplexing. It actually looks kinda neat but still am occasionally attempting stop it. A few idea's I've tried are having the arm7 go into halt mode during the critical hblanks (every 48 lines), this is so far a failure because it requires halting during interupts which is well just weird. Another idea was to just idle in a loop for the critical period where the arm7 would only need register access to VCOUNT but this for some reason did not have desiered effect.. @_@??? Still working on it off and on...
+
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.
  
Lastly wanted to mention a really neat site I found a while back. [http://meraman.dip.jp/index.php?NDS_TGM http://meraman.dip.jp/index.php?NDS_TGM] This page describes the development of a WIP game called Tetris the Grand Master - Terror Instinct. It is really what encouraged me to start a development blog of my own, and has been an interesting read. Other pages on the site have tutorials for things such as laser effects and also is a insanely nice MML player library for nds called BGM DRIVER. Oh btw, its entirely in japanese, however [http://translate.google.com translate.google.com] or [http://www.excite.co.jp/world/english/ excite.co.jp's translation page] have helped alot. (considering i know only about a dozen words in Japanese and the characters are less comprehensible to me than Egyptian heiroglyphs ;_;;)
+
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 [http://meraman.dip.jp/index.php?NDS_POWER_ENG Power Control Driver]. I need to do some other things for few hours and will ponder both options in the mean time.
  
===2008.08.31===
+
===2009.03.26===
Sorry for delays between posts but when working am not writing. hehe Last night (over the past few days really) made lot of progress with background system, am now able to do thBgLoad(screen,bg0thru4, "fileprefix") and it loads the map, tiles, palette, and a bgtype definition file automagically. Can also load from memory with another function so that the font and startup screens may be loaded before filesystem is initalized (as well as be able to display error messages :)
+
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|nyanroll.nds]] as a happy means to test it. Okais getting back to the thds issues...
  
Also automatic vram allocations finding the smallest 'hole' that the data will fit, similar to what i have done with sprite's vram. Made these macro defines to allow screen (s), and bg (b) parameters.
+
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..
 +
 +
===2009.03.22===
 +
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...
 +
 +
===2009.03.21===
 +
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:
 
<source lang="c">
 
<source lang="c">
//macro to find proper bg control reg
+
//STAGE_BGM
#define BGCR(s,b) (*(vuint16*)(0x04000008+((s)<<12)+((b)<<1)))
+
mp3PlaylistPlay(steps->index); //play song
#define DISPLAYCR(s)      (*(vuint32*)(0x04000000+((s)<<12)))
+
//STAGE_BGMFADE
//scrolling
+
mp3FadeOut(steps->duration);    //fadeout and stop
#define BGX0(s,b) (*(vuint16*)(0x04000010+((s)<<12)+((b)<<2)))
+
//STAGE_BG
#define BGY0(s,b) (*(vuint16*)(0x04000012+((s)<<12)+((b)<<2)))
+
thBgStart(thbg[steps->index]);
//ram
+
//STAGE_SHOWLVL
#define BGBMPRAM(s,b) (((b)<<14) + 0x06000000+((s)<<21))
+
bulletCreate(&stagebul, 35, 226, -570, 0, &badv, 0, -10); //a graphic on screen
#define BGTILERAM(s,b) (((b)<<14) + 0x06000000+((s)<<21))
+
thTextWriteXY(steps->x,steps->y,steps->name); //write text onto the screen
#define BGMAPRAM(s,b)  (((b)<<11) +  0x06000000+((s)<<21))
+
//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], player.sx, player.sy,0,defhealth); //summon a character
 +
//STAGE_CHRUNLOAD
 +
thStageUnloadCastChr(steps->index);
 +
//STAGE_SUMMON
 +
thEntitySummon(steps->entity, &cast[steps->index], steps->x, steps->y, steps->flags,defhealth);
 +
//STAGE_BANISH
 +
thEntityBanish(steps->index); //remove a character
 +
//STAGE_SPELLCAST
 +
tocast=spellFindByName(steps->name, entities[steps->entity].achr->chr->grimoire);
 +
thSpellCast(steps->entity, tocast);
 +
//STAGE_ENTITYMOVE
 +
thEntityMove(steps->index, steps->x, steps->y, steps->duration);
 +
//STAGE_ENTITYSTOP
 +
thEntitySetInc(steps->index, 0, 0);
 +
//STAGE_SETHEALTH
 +
if(steps->entity==0)
 +
defhealth=steps->index; //set default health
 +
else
 +
thEntitySetHealth(steps->entity, steps->index); //set health for specific entity
 
</source>
 
</source>
 +
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)
  
Background loading went from:
 
 
<source lang="c">
 
<source lang="c">
BG1_CR = BG_32x32 | BG_COLOR_256 | BG_MAP_BASE(12) | BG_TILE_BASE(1) | BG_PRIORITY(BG_PRIORITY_1);
+
//example of simplified bullet particle style engine
SUB_BG1_CR = BG_32x32 | BG_COLOR_256 | BG_MAP_BASE(12) | BG_TILE_BASE(1) | BG_PRIORITY(BG_PRIORITY_1);
+
void bulletUpdate(void) {
dmaCopyWords(3,BG1_Map, (u16*)BG_MAP_RAM(12), sizeof(BG1_Map));
+
int bulletcnt=0;
dmaCopyWords(3,BG1_Tiles, (u16*)BG_TILE_RAM(1), sizeof(BG1_Tiles));
+
do {
dmaCopyWords(3,BG1_Map, (u16*)BG_MAP_RAM_SUB(12), sizeof(BG1_Map));
+
  bullet[bulletcnt].x+=bullet[bulletcnt].xinc;
dmaCopyWords(3,BG1_Tiles, (u16*)BG_TILE_RAM_SUB(1), sizeof(BG1_Tiles));
+
  bullet[bulletcnt].y+=bullet[bulletcnt].yinc;
thUpdateBgPalette((u16*)BG1_Pal, 1, sizeof(BG1_Pal));
+
} while(++bulletcnt<bulletmax);
thUpdateBgSubPalette((u16*)BG1_Pal, 1, sizeof(BG1_Pal));
+
}
</source>
+
 
To this:
+
//example of function style bullet system
<source lang="c">
+
void bulletUpdate(void) {
thBgLoad(0, 1, "nitro:/BG1");
+
int bulletcnt=0;
thBgLoad(1, 1, "nitro:/BG1");
+
do {
 +
  ((bulletfunctype)bullet[bulletcnt].func)(bullet[bulletcnt].data); //function is called
 +
} while(++bulletcnt<bulletmax);
 +
}
 
</source>
 
</source>
Much simpler!! \^_^/ Can also load from ram so that font data and startup screens may be loaded before the filesystems are initalized (and ofc display errors)
 
  
So now am working on bringing the menu systems back using the new systems and have ran into a small bug last night, was quite tired so went to sleep. Now im awake, so here we go.. bbiab ^^/
+
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
  
===2008.08.26===
+
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
It has been an eventful few days. Some hackers got onto the server, creating a bit of havoc but politely leaving it otherwise intact. Fixing that required backing up the data, reinstalling, updating everything, fixing the inevitable problems but normalcy is finally being restored. Friend also came to visit from out of town, and have some financial difficulties that are still being sorted. All this delayed work on game much more than i would have liked.. But...
+
  
Last night managed to find a troublesome bug in the sprite code. A sprite system funtion that tries to allocate a hardware sprite on the given screen division (there are 8 divisions, 4 per physical screen because of the multiplexing scheme) and if it fails returns -1 that should never return -1, at least with the limited number of sprites im using so far, (so i wasnt checking the return value >_>) WAS returning -1. Hmmz easier to explain in code:
+
===2009.03.18===
 +
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 [http://meraman.dip.jp/index.php?FrontPage meraman's] new [http://meraman.dip.jp/index.php?NDS_SMF2MML 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...
  
inline int thGetNextSprite(u8 screen); //Return the next available hardware sprite on the given screen (0 thru 7)
+
These things I need to do in the immediate future:
 +
* Convert stage scripts to use [http://a128.blogspot.com/2008/12/lua-514-nintendo-ds2008.html 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 [http://meraman.dip.jp/index.php?NDS_BGMDRV_ENG NDS_BGMDRV]
 +
* Simple settings menu
  
The reason it was failing however was because the screen argument being passed was -1 from this funtion
+
Things to do eventually:
+
* fix bugs
//create a sprite on each screen sprite would be visable.. screen0 = first screen, screen1 = last visable screen
+
* create more levels
inline int thSubCreateSprite(thSprite_t *thsp, int screen0, int screen1);
+
  
Sprites may span up to 4 'screens' (each screen is 48 pixels high, rly better terminology for this would be 'subscreen'). If the sprite is not visible on any screen screen0 argument would == -1. And THIS too wasnt being checked before calling thSubCreateSprite, causing the entire problem.
+
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. <S>May upload the video anyway it is sort of interesting.</S> okai, uploaded it [http://www.youtube.com/watch?v=daXlFKkKpTo&feature=channel_page here]. >_>
  
The bug appeared as an occasional missing bullet, and was occasionally corrupting other parts of ram as well. Originally thought it was in the bullet engine code, where i looked and looked often trying to find it before finally examining a disassembly and noticing the sprite tables were immediately above the bullet tables in memory and wondering if a corrupted array index may be to blame.
+
Found [http://indexof.blog40.fc2.com/blog-entry-117.html 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.. @__@;;
  
Confused? @_@??? Yes, kinda pointless to even try to explain, simple of it is.. ITS FIXED!!!! XDDDDDDDD Hopefully i will keep my schedule of completing a mostly working demo by the end of month tho it may be a few days longer due to the expected delays.
+
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. [[ProjectWiki:Site_support|More information]]. Thanks :D
  
Also considering moving this dev blog to eris's user talk page instead, since it covers more than just THDS, and is getting quite long. Anyways back to work.. ^^
+
===2009.03.11===
 +
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
  
===2008.08.14===
+
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.  
Heyas! Been insanely busy past few days working on the game, well notrly the game but the libraries to support the game. ^^ Now have [[Thsound|soundfx]], and a very nice [[Thfifo|FIFO/IPC system]] among other things.  
+
  
[[Image:kaguya-boss.gif|thumb|right|First animation attempt]]
+
The animated sprites look very pleasing. ^_^ Graphics are improving, however slowly.  
While making the sound lib created a simple synth, which sounds a lot neater that i'd thought it would [http://blea.ch/~eris/crappysynthtst.mp3 Here a very very short mp3] demonstrating it. Had originally wanted to make mp3/midi playback of the soundtrack as Zun does but abandoned the idea early on... For now my objective is still to get a demo out by end of month, but may come back to the synth and midi idea afterward. ^^
+
  
Really need to work on my sprite animation techniques.. am pretty terrible (see pic :p) however this .gif was done quickly just to gimme something for testing the animation code rather than a very serious attempt at animation. Still am concerned a bit. Her skirt needs to flutter and hair needs blowing in breeze, prolly need to find better software than GIMP for the task, any suggestions? @_@
+
Need to create a bug and todo list page.
  
Gotta get back to work, leave with this nice sprite tutorial. [http://www.petesqbsite.com/sections/tutorials/tuts/tsugumo/chapter10.htm a nice tutorial on sprite making]
+
'''2009.03.09'''<br>
 +
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.
  
XD
+
Finally got around to testing thds on actual hardware, it is looking and sounding alot better since last post. XD
  
===2008.08.08===
+
===2009.03.03===
Here we are, happy 08/08/08!! ^^ Found out last night game was mentioned on [http://www.shrinemaiden.org/forum/index.php?topic=1045.0 MotK] along with another thds by anoNL in the works. :D Good we needz moar touhou!!
+
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. ;;;;
  
Just laying here in bed after getting my new audio library working about to nap and thought to write a bit. Am very excited as it is very efficient and feature packed, even includes basic PSG functions mostly because i was wanting to use the noise generators on a level to simulate environmental noises. Still a few little features to add but its working gr8 so far!! :D
+
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
  
Have decided to attempt releasing a demo by the end of the month, probably just a single level but am doing alot of hardware trickery and trying new things, need to test will work with all homebrew cards and such. Will do my best! ^^
+
===2009.02.21===
 +
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 [http://kikitai.teacup.com/kotaeru.php3?q=2196014 Sakura], it seems really nice however it also is not working properly within wine. >_<
  
Otherwise lot has happend personally. My poor kitteh, who is best friend, and familiar died 2 days ago. She never recovered from whatever happened to her when she disappeared. but at least got to say goodbye and be with her to the end, was very difficult time. ;__;
+
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.  
  
===2008.08.03===
+
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.
protip: after hours and hours of wondering why something isn't working, give up and try doing it a different way.  
+
  
Earlier today finally got back to working a bit, ran into some unexpected behaviour on the ds itself that i couldnt replicate on no$gba. after a few frustrating hours going in circles, realized there was an even nicer more simple way to do it and did that instead. Still had the memory sharing problems, this:
+
===2009.02.05===
Shared Work    027FF000h 4KB    -    -    -    R/W
+
Herro! Survived the worst ice storm this region has seen in a while. Was without power for several days, more on that (including pics!) [http://blea.ch/~eris/kareha/kareha.pl/1233242587/ here].
is only explained as:
+
Region 2 and 7 are not understood?
+
sighs, so nor do i still do not fully understand them. but now know, if u want something to be always available at either cpu without caching issues, use this region.. it rly needs a malloc. and a semaphore  mechanism. Along those lines have made some simple 8,16, and 32 bit ring buffer code. ^^
+
  
''a thought: if had flushed the cache after writes on the arm9 side this might not have been a problem :D''
+
Worked on thds a bit, but mostly have been working on [http://blea.ch/wiki/index.php/Category:LIBTHDS 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.
  
otherwise, over the past week or so my kitty dissappeared, she returned 4 days later very worn and weak. Was very very worry. ;;
+
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...
  
Also made new song for start menu.
+
'''2009.02.06'''<br>
 +
quick note, to get .sym file:
 +
<source lang="bash">
 +
$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
 +
</source> 
 +
^_^
  
===2008.07.26===
+
===2009.01.26===
Finally went to dentist last tuesday, was there for 5 hours... not very pleasant, but after a few days of recovery feel much better and have resumed working. \(^_^)/
+
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.. >_>
  
Have a working FIFO library now. days of resting allowed a bit of ponderings, and decided to go extremely simple with the FIFO code channelizing transmissions and providing facilities for locating particular channels on either side. Additionally will create messaging and ring buffer libraries for dealing with higher level tasks. This makes things more flexible and should improve handling speed for some situations.
+
Would like to add a few menus now for settings, character selection, and spell practice would be nice to evaluate new patterns. Moving along ... ^_^
  
Have already a ring buffer library coded for another project. Will attempt to reuse that and save some time.. :D
+
===2009.01.22===
===2008.07.21===
+
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...
[[Image:Firstspritelibdemo.png|thumb|Image from spritelib demo showing]]
+
 
found a bug in the bulletlib, very odd it didnt like that i preset a global to 0. Normally set globals in init functions, and had set this one the same, but for some reason when declaring it had int nextbullet=0; which caused  things to go screwy whenever nextbullet equaled 0... @_@ still confused about that..
+
Also the geekier type among you may want to lookie @ my other project the [[3DCube|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... ===
 +
[[Image:Touhouss9.png|thumb|left|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. [http://a128.blogspot.com 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... ;;;;===
 +
[[Image:Touhouss.png|thumb|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, [http://blea.ch/~eris/litter/Pyongyang%20Solstice.mp3 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.
 +
 
 +
[[Image:Meh_sk88pro.jpg|thumb|left|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, [http://blea.ch/~eris/litter/incomplete%20happiness.0.6.mp3 Incomplete Happiness]. Heard about this SC-88pro from [http://kaorin.pestermom.com/works.html here], fanx!! XD
 +
 
 +
[[Image:Gogohoughtransform.png|thumb|The wuvry hough transform. Finding lines in the Brooklyn Bridge. :D]]
 +
Here also is the [http://blea.ch/~eris/litter/maple%20dream%20ds%20psg.0.3.5.mp3 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 [http://blea.ch/~eris/litter/mapledream.mml.txt MML text] and [http://blea.ch/~eris/litter/mapledream.bdt .bdt file] which can be played on [http://meraman.dip.jp/index.php?NDS_BGMFILER NDS_BGMFILER]. Really like [http://www.nicovideo.jp/watch/sm4439540 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 [http://en.wikipedia.org/wiki/Hough_transform 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===
 +
[[Image:Akyusuntouchedscorevol1.jpg|left|thumb|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 [http://en.wikipedia.org/wiki/Music_Macro_Language MML] since i got [http://en.touhouwiki.net/wiki/Akyu%27s_Untouched_Score_vol.1#Background 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 [http://meraman.dip.jp/index.php?NDS_BGMDRV_ENG 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 (.
 +
<br>
 +
 
 +
Excerpt of mml from back of Akyu's Vol. 1, no idea what song this is:
 +
<pre>
 +
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
 +
</pre>
 +
 
 +
[[Image:3mleditor.png|thumb|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 [http://www.mabiguru.com/forums/orchestra/370-3ml-editor-offline-mabinogi-composer-program.html 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 [http://www.propellerheads.se/products/reason/index.cfm?fuseaction=get_article&article=devices 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:
 +
<pre>
 +
(t12) //arpeggio1
 +
T136 @S3 S127,4,96,32 K0 L4 V3 Q8
 +
@v44 P32
 +
        o4>aded<a>def
 +
        aded<a>def
 +
        aded<a>def
 +
        aded<a>def
 +
        etc.. etc... blah.. blah..
 +
</pre>
 +
 
 +
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:
 +
<pre>
 +
  [4 abcd]
 +
{i  efga}
 +
  [8i]
 +
</pre>
 +
 
 +
will playback as:
 +
<pre>
 +
  abcd abcd abcd abcd
 +
  efga efga efga efga efga efga efga efga
 +
</pre>
 +
 
 +
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:
 +
<pre>
 +
(t12) //arpeggio1
 +
T136 @S3 S127,4,96,32 K0 L4 V3 Q8 @v44 P32
 +
{i aded<a>def}
 +
[2 l16o5 [32i] l1[16r]]
 +
</pre>
 +
representing 32 measures of music. ^^
 +
 
 +
Next needed to use the BGMMMLconverter supplied on the [http://meraman.dip.jp/index.php?NDS_BGMDRV_ENG 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:
 +
<pre>
 +
------------------------------------------------
 +
--> 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
 +
------------------------------------------------
 +
</pre>
 +
 
 +
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:
 +
<pre>
 +
{i      crcr c r5 c9 r13 c16c16r8c8 cr c5 c20 r8c8}
 +
</pre>
 +
The "r5 c9 r13" and "c5 c20" parts both contain aliquant numbers of a measure.
 +
 
 +
Suggested mml:
 +
<pre>
 +
{i      crcr c r*38 c*20 r*14 c16c16r8c8 cr c*39 c*9 r8c8}
 +
</pre>
 +
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.
  
Made a simple stand alone example/demo for [[Thsprite|spritelib]]. Image on the right shows the result. :D
+
Applied these corrections to [http://blea.ch/wiki/images/c/cb/Myfirst.mml.txt 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 [http://blea.ch/~eris/litter/myfirst.mml.mp3 here is mp3] of result recorded off the DS itself, and [http://blea.ch/wiki/images/8/85/Myfirst.mml.tar.gz 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
* animated 64x64 kaguya.thg movable by the touchscreen on the left
+
* grit converted 8x8 white dot on the top
+
* spinning red star on middle left
+
* 16 color 16x16 kaguya on the right
+
* a 8x16 2 frame gfx on two sprites (frame 0 blue+yellow and frame 1 pink+green circles)
+
* and a buncha 16x16 bullets to demonstrate the multiplexing ^^
+
  
Few things remaining to create, need a better sound fx system, and to do that need a decent fifo which would also  improve the mp3 playback *sighs* really want to get back to the fun of pretty pattern making, but need these backend stuffs need doing first.. ~~
+
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 [http://hinakonaproject.blog4.fc2.com/blog-entry-13.html this]. Just need to adjust the instruments to NDS_BGM's expectations.
  
Also finally released a very rough example application for the [[Thmp3|thmp3 lib]]. Added some features so that it may used in a friend's rhythm game.
+
Really talked quite a bit in this post. *^_^* But hope may encourage others to try MML.
  
===2008.07.16===
+
===2008.10.07 ~ hdd woes===
toof again a bit better than before, still worrying me at time. -_- Today and yesterday made good bit of progress on spritelib, cleaned it up, fixed some bugs, only one weird thing remains but it may be in the bullets system instead. Not sure..
+
[[Image:Moardiscbadness.jpg|left|thumb|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.. :\
  
Also since there was some interest in the arm7 mp3 library (using helix ofc), went ahead and broke it off into a seperate project. Moar non-game work, but letting others use the code will help me find and correct bugs faster and result in better code for all. ^^ Over the next few days will most likely be documenting and correcting bugs in the sprite and mp3 libs.
+
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 [http://blea.ch/~eris/crappyhddiscrappy.avi 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. ;;
  
===2008.07.14===
+
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. ^^
Toof getting a bit better, but still an an annoyance. ;;
+
After talking with dovoto who is creating a pretty decent nondanmaku library for newest libnds, decided it was important to support multiple object/tile boundry sizes in thsprite. What that means is your not limited to the 128K vram banks for sprite tile data thsprite allocates by default. You can instead use 32, 64, or even 256K of vram depending on application. Some users may desire to use limited sprites and allocate the rest of vram for 3d textures, or may desire more tile data and use 256K.
+
  
Work is nearly done here, just need to modify the raw gfx loading functions (for loading grit processed sprites) and clean up a bit. Then can again get back to the actual game code. :D
+
Hopefully I'll have some actual touhou progress to report on soon, and not just blabbing about my PC issues. ~_~
  
===2008.07.10===
+
===2008.10.02===
Tooth still hurts... >_<
+
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 [http://ubuntulinux.org 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 @_@?!?
Otherwise some progress in the [[Thsprite|spritelib]]! can now load 16/256 color images instead of just 256 which saves on vram meaning moar animations! Hopefully tonight will start to re-integrate the entities and spells libraries which should give me players, enemys, familiars, and ofc spells again. That would leave only thmenu and thgoodness libs which are the start menu and other game functionality (such as levels, scoring, and other gamey related stuffs).
+
  
===2008.07.04===
+
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.
Tooth hurts really bad, keeping me awake at night. still working on the [[Thsprite|spritelib]] one feature left to add, loading of 16color in addition to 256 color sprites to save memory when possible.
+
  
Made more music, now have 26 minutes 54 seconds total! XDD Definitly not Zun quality, but i am improving. u_u
+
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. ^_^
  
have met recently [[User:SquidMan|SquidMan]] who has started working on a touhou game for wii. ^^ I had a wii but sold it to buy the ds and a flash card instead, had it for almost a year and never played it. :\
+
Been playing [http://en.touhouwiki.net/wiki/Perfect_Cherry_Blossom PCB] a bit the past week, never have beat it :/ Very much out of practice now will hopefully improve though >_>
  
===2008.06.28===
+
Will get back to game full time shortly, breaks from routine are good for your sanity. :p
Have drawn a few characters and created about half dozen musics, but the graphics and audio used in these screenshots are from a version some months back and taken from various internet sources.  
+
  
<table width><tr align=center valign=top><td>
+
===Older Blog Entries===
[[Image:Screenshot1.png|thumb|first half of level (Ignore replay debug infos on top ~_~)]]
+
Older blog entries may be found in the archive [[Thds/Blogarchive|here]].  
<td>
+
[[Image:Thtest7.png|thumb|final spell of level, verily hard]]
+
<td>
+
[[Image:Thtest3.png|thumb|Peak at some of the game code, and Utter Lunacy spell]]
+
</tr></table>
+
  
I'll update more soon, working on [[Thsprite|spritelib]] a bit still, and got distracted making yet moar musics :D
+
( ^◡^)ノ
  
 
[[Category:NDS]]
 
[[Category:NDS]]
 
[[Category:C]]
 
[[Category:C]]

Latest revision as of 14:48, 7 November 2011

Touhou Fangame for Nintendo DS

Contents

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 blea.ch 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 ^^

2010.07.15

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. ^__^;;;

2010.03.19

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. ^^

2010.01.10

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. ^^

2010.01.09

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. ^^

2009.12.17

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

2009.10.26

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

2009.09.04

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;;;;

2009.08.01

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. ._.);

2009.07.01

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!

2009.06.08

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)
 +sizeof(FrameHeader)
 +sizeof(SideInfo)
 +sizeof(ScaleFactorInfo)
 +sizeof(HuffmanInfo)
 +sizeof(DequantInfo)
 +sizeof(IMDCTInfo)
 +sizeof(SubbandInfo)];

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.

2009.03.26

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..

2009.03.22

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...

2009.03.21

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:

//STAGE_BGM
mp3PlaylistPlay(steps->index);	//play song
//STAGE_BGMFADE
mp3FadeOut(steps->duration);    //fadeout and stop 
//STAGE_BG
thBgStart(thbg[steps->index]);
//STAGE_SHOWLVL
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], player.sx, player.sy,0,defhealth); //summon a character
//STAGE_CHRUNLOAD
thStageUnloadCastChr(steps->index);
//STAGE_SUMMON
thEntitySummon(steps->entity, &cast[steps->index], steps->x, steps->y, steps->flags,defhealth);
//STAGE_BANISH
thEntityBanish(steps->index); //remove a character
//STAGE_SPELLCAST
tocast=spellFindByName(steps->name, entities[steps->entity].achr->chr->grimoire);
thSpellCast(steps->entity, tocast);
//STAGE_ENTITYMOVE
thEntityMove(steps->index, steps->x, steps->y, steps->duration);
//STAGE_ENTITYSTOP
thEntitySetInc(steps->index, 0, 0);
//STAGE_SETHEALTH
if(steps->entity==0)
	defhealth=steps->index;	//set default health
else
	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 {
   bullet[bulletcnt].x+=bullet[bulletcnt].xinc;
   bullet[bulletcnt].y+=bullet[bulletcnt].yinc;
 } 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

2009.03.18

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

2009.03.11

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.

2009.03.09
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

2009.03.03

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

2009.02.21

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.

2009.02.05

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...

2009.02.06
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

^_^

2009.01.26

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 ... ^_^

2009.01.22

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
        o4>aded<a>def
        aded<a>def
        aded<a>def
        aded<a>def
        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}
   [8i]

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. ~_~

2008.10.02

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