Author Topic: ※ Danmakufu Q&A/Problem thread 3 ※  (Read 468962 times)

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #360 on: October 23, 2016, 12:34:05 PM »
Just to clarify, the only reason they store the radius values for all vertices is because when you capture a spell the circle squashes into you like a star, and they chose to keep track of all the vertex radii in an array instead of using a formula to determine what radius each vertex should have at any point in time.
« Last Edit: October 23, 2016, 12:35:52 PM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #361 on: October 24, 2016, 01:40:03 AM »
If my code doesn't work drag-and-drop, and your main problem is that the laser renders (which is a Sprite) but not collides (which is a Laser object), my intuition says that either your shotsheet is incorrect or not loaded, and nothing is actually being fired. This would cause both your original problem and the problem you're finding with my code. Please make sure you can at least fire your ID 1 shot as a bullet.

EDIT: On inspection, you had originally given your laser the shot ID=1, but in your current code you use the texture variable which will absolutely not work. ObjShot_SetGraphic requires a shot ID. The above still applies though, make sure it actually fires something at all.
Also for the log task, you haven't called it wait no you did, just in the wrong place. Note that in my blurb I define the task and then immediately call it; that's what you want. If you put it in your while loop it will keep launching new tasks every frame that each try to log on every frame, and log a billion times.

Sorry about the slightly late reply, but I have got it working now. You pointed me in the right direction, it was an issue with my shot sheet. I can't pinpoint what exactly I changed that fixed it, but I did tinker with the shoot sheet and whatnot, and eventually got it working. Again, I didn't use your code because I understood my code a bit better. I've cleaned up my code slightly, getting rid of unnecessary things. http://pastebin.com/hSBb9Vna
An interesting observation, it seems like the ObjStLaser_SetAngle is off by 90 degrees from the usual angle, so I had to throw in a -90 degree modifier to my task's angle variable for that, that may have been part of why I didn't get any collision.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #362 on: October 25, 2016, 01:36:54 AM »
Code: [Select]
           let Player = GetPlayerObjectID;
   let AngleToPlayer = GetAngleToPlayer(Player);
   CreateStraightLaserA1(60,110,AngleToPlayer,500,25,5,25,30);

So I tried making a laser on my own. It works almost well, but the aiming is totally off. It looks like it's firing at random directions (for example behind the boss).
What did I do wrong ?

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #363 on: October 25, 2016, 03:27:22 AM »
Well, you are asking what angle the player is to the player. (After testing, still not sure why it ends up pretty random when moving diagonally, but yeah.)
« Last Edit: October 25, 2016, 03:29:59 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #364 on: October 25, 2016, 12:04:14 PM »
I thought it would just aim at the player...
How do i do it then ?

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #365 on: October 25, 2016, 01:04:11 PM »
The argument should be the object from which to get the angle to the player. It already knows about the player, it doesn't know about the other point. So GetAngleToPlayer(objEnemy) or whatever else you're trying to aim from.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #366 on: October 26, 2016, 08:45:31 AM »
Hi everyone.
I was experimenting with the default effect shown in DMF(ph3)'s SamplePS03.txt.
I'd like to apply it behind the boss (and magic circle) but before the background (i.e. background is distorted)

My background has 3 layers:
top layer:
Code: [Select]
Obj_SetRenderPriorityI(obj,21);
ObjPrim_SetTexture(obj,sbg1);
ObjRender_SetBlendType(obj,BLEND_SUBTRACT);
middle&bottom layer:
Code: [Select]
Obj_SetRenderPriorityI(obj,20);
ObjPrim_SetTexture(obj,sbg2);
ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);

TWaveCircle()
Code: [Select]
task TWaveCircle(){
let renderTexture = GetReservedRenderTargetName(0);

let frame = 0;
let baseEffectRadius = 128;
let outerFluct = 16;
let effectRadius = 0;
let cirspd = 5;


let priEffectMin = 20;
let priEffectMax = 20;

SetInvalidRenderPriorityA1(priEffectMin, priEffectMax);

let frameWidth = GetStgFrameWidth();
let frameHeight = GetStgFrameHeight();
let frameLeft = GetStgFrameLeft();
let frameRight = frameLeft + frameWidth;
let frameTop = GetStgFrameTop();
let frameBottom = frameTop + frameHeight;

let objWave = ObjPrim_Create(OBJ_SPRITE_2D);
Obj_SetRenderPriorityI(objWave, 23);
ObjPrim_SetTexture(objWave, renderTexture);
ObjSprite2D_SetSourceRect(objWave, frameLeft, frameTop, frameRight, frameBottom);
ObjSprite2D_SetDestRect(objWave, 0, 0, frameWidth, frameHeight);
Obj_SetRenderPriorityI(objWave, priEffectMax + 1);
let pathShader = GetCurrentScriptDirectory ~ "SamplePS03_HLSL.txt";
ObjShader_SetShaderF(objWave, pathShader);
ObjShader_SetTechnique(objWave, "TecWave");

let objEnemy = GetEnemyBossObjectID[0];
while(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0){
effectRadius = baseEffectRadius + outerFluct * sin(frame*cirspd);

let enemyX = ObjMove_GetX(objEnemy);
let enemyY = ObjMove_GetY(objEnemy);

RenderToTextureA1(renderTexture, priEffectMin, priEffectMax, true);

ObjShader_SetFloat(objWave, "frame_", frame);
ObjShader_SetFloat(objWave, "enemyX_", enemyX + frameLeft);
ObjShader_SetFloat(objWave, "enemyY_", enemyY + frameTop);
ObjShader_SetFloat(objWave, "waveRadius_", effectRadius);

frame++;
yield;
}
Obj_Delete(objWave);
ClearInvalidRenderPriority();
}

With this the effect can affect the bottom 2 layers only (because priEffectMax is 20 I guess). screenshot1,2
However when I change RenderPriorityI of top layer to 20, the whole background turns black. screenshot3
Yet when the Render Mode of top layer is changed to BLEND_ALPHA or BLEND_ADD_ARGB, the background works again. screenshot4,5

Images (changed to links for better safety at work):
sbg1
sbg2
Screenshot1
ScreenShot 2
ScreenShot 3
ScreenShot 4
ScreenShot 5

My question is: I wonder if there's any method to use the TWave effect while using subtraction rendering?
« Last Edit: October 27, 2016, 03:29:02 AM by Gengetsu »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #367 on: October 26, 2016, 04:27:57 PM »
Becareful with the Twave effect. I'm not sure if I don't use it badly or not but it can cause heavy FPS drops.

Anyway, i see that your circle have a nive rotation effect like in Touhou. How did you do this? I know I should use X, Y and Z angle but I can't find the exact formula to do this without having something awful.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #368 on: October 27, 2016, 03:24:29 AM »
Becareful with the Twave effect. I'm not sure if I don't use it badly or not but it can cause heavy FPS drops.

Anyway, i see that your circle have a nive rotation effect like in Touhou. How did you do this? I know I should use X, Y and Z angle but I can't find the exact formula to do this without having something awful.

While it's possible (difficulty: post-phantasm  :D) to derive from sin & cos, I just adopted other's function (credits to TalosMistake):

Code: [Select]
task magiccircle(boss,type){ // draw magic circle
let obj=ObjPrim_Create(OBJ_SPRITE_2D);
let img=GetCurrentScriptDirectory()~"./MG.png";
let spin = GetCommonData("CircleSpin",0);
let s = 0;
let size = 0;
let GetBossX;
let GetBossY;
LoadTexture(img);
ObjPrim_SetTexture(obj,img);
ObjSprite2D_SetSourceRect(obj,0,0,256,256);
ObjSprite2D_SetDestCenter(obj);
ObjRender_SetScaleXYZ(obj,size,size,size);
ObjRender_SetAlpha(obj,192);
ObjRender_SetBlendType(obj,BLEND_ALPHA);
Obj_SetRenderPriorityI(obj,24);
while(!Obj_IsDeleted(boss) && !Obj_IsDeleted(obj)){
spin += 1/3;
size = GetCommonData("CircleSize",1);
ObjRender_SetAngleXYZ(obj,30*sin(spin*1.5)*type,25*cos(spin*1.5-30*sin(spin*3))*type,spin*3*type);
ObjRender_SetPosition(obj, ObjMove_GetX(boss), ObjMove_GetY(boss), 0);
ObjRender_SetScaleXYZ(obj, size, size, 0);
yield;
}
SetCommonData("CircleSpin", spin);
Obj_Delete(obj);
}

Example: magiccircle(objBoss,-1);
« Last Edit: October 27, 2016, 03:56:05 AM by Gengetsu »

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #369 on: October 27, 2016, 08:35:18 AM »
Congratulations Gengetsu, you seem to have found a bug.

It doesn't have to do strictly with the shader technique at all. Rather it looks to be a problem with the render target being used to draw onto before the shader is applied. After some testing, it seems like when blend types interact while being drawn onto a render target, their alpha values are erroneously affected somehow. If you subtract a white texture from another image, the result is transparent, but as you'll see below even subtracting the black parts gives transparent results, presumably because the alpha values are also being subtracted. Multiply-blend and invert-blend are also affected; if you invert with a 50% transparent white texture, the image is somewhat inverted but also somewhat transparent, while if it's the full white texture the image is fully transparent. Curiously, if you save the rendered textures to file, they look fine.

Subtract-blend render texture saved to file:


Subtract-blend results
Subtract-blend results, 50% alpha texture
Multiply-blend results
Invert-blend results, 50% alpha texture
« Last Edit: October 27, 2016, 08:57:49 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #370 on: October 27, 2016, 09:13:04 AM »
Now, despite this, you can circumvent this for the most part, although it's a really shitty workaround that I hate myself for having to do. Because the actual problem is the render targets, if you need to use a fancy blend type for some texture, you can apply the shader directly to that object individually, rather than rendering your whole background to one texture and using the shader on that (which is what you should be doing). This ignores the whole purpose of using the render targets, since you never really want to apply the shader multiple times because that's stupid, but it works.

So for objects with problematic blend types you can use this to apply it per-object, but if at all possible you should be doing the usual way of rendering to a render target and using that instead.

Code: [Select]
task ObjShader_TWaveCircle(obj){
let frame = 0;
let baseEffectRadius = 128;
let outerFluct = 16;
let effectRadius = 0;
let frameLeft = GetStgFrameLeft();
let frameTop = GetStgFrameTop();

ObjShader_SetShaderF(obj, GetCurrentScriptDirectory() ~ "SamplePS03_HLSL.txt");
ObjShader_SetTechnique(obj, "TecWave");

let objEnemy = GetEnemyBossObjectID[0];
while(!Obj_IsDeleted(objEnemy)){
effectRadius = baseEffectRadius + outerFluct * sin(frame*4);

ObjShader_SetFloat(obj, "frame_", frame);
ObjShader_SetFloat(obj, "enemyX_", ObjMove_GetX(objEnemy) + frameLeft);
ObjShader_SetFloat(obj, "enemyY_", ObjMove_GetY(objEnemy) + frameTop);
ObjShader_SetFloat(obj, "waveRadius_", effectRadius);

frame++;
yield;
}
}

Result: http://i.imgur.com/SuUqAx5.png
« Last Edit: October 27, 2016, 09:18:35 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #371 on: October 29, 2016, 04:51:41 AM »
My question is: I wonder if there's any method to use the TWave effect while using subtraction rendering?

As far as my knowledge on hlsl with danmakufu goes, my way of making it work is:
1. Go into the _HLSL file.
2. Find this line:
Code: [Select]
        Out.color = color;

return Out;
3. Add "color.a = 1;" just before "Out.color = color;"
4. Done
So far, everything renders the same as when the shader is not present, but maybe I haven't found another bug yet.
Sagume's spell background is also BLEND_SUBTRACT and so far, everything looks fine.
http://imgur.com/a/pj6NU
Without the shader:
http://imgur.com/a/3pLFn
« Last Edit: October 29, 2016, 05:05:18 AM by Whatever »

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #372 on: October 29, 2016, 06:16:37 AM »
Neat. I hadn't considered using the shader itself to circumvent the problem with the render target. I'm not too sure why that fixes it either, since the texture should already be flattened before the shader step, but it doesn't really matter. I think there's some very slight difference in brightness (likely due to the opacities) with what I was doing but this is clearly better in all ways.
« Last Edit: October 29, 2016, 06:18:37 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #373 on: October 29, 2016, 07:59:32 AM »
And, is there a way in which I can put custom icons to th_dnh.exe?
(Like BoSM, FFF, PoIB)

Edit: I got it to work using some third-party software.
« Last Edit: October 29, 2016, 09:16:10 AM by Whatever »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #374 on: November 01, 2016, 07:37:27 PM »
Hi. It's me again. I wondered, what kind of scripting mistake can lead to a broken replay? I know some mistakes on ComonData can do it but is there other things? Accelerating Danmakufu with Ctrl during replay can do it too or absolutly not? I try to chase the reason of all my replays issues but I'm a bit lost now...

Gengetsu> Thanks for that.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #375 on: November 01, 2016, 07:46:44 PM »
Hi. It's me again. I wondered, what kind of scripting mistake can lead to a broken replay? I know some mistakes on ComonData can do it but is there other things? Accelerating Danmakufu with Ctrl during replay can do it too or absolutly not? I try to chase the reason of all my replays issues but I'm a bit lost now..

There are a number of things that can desync replay. Sometimes a new version of DNH will break old replays, for example.

The biggest reply breakers are the following:
-Virtual Keys
-Common Data & Replay Comments

Virtual Keys
If at any time during the game your player touches a key and the game registers an action because of it (e.g. press I for invincibility, etc), an effect will occur in-game. However, replays only save the state of Virtual Keys, so those superficial changes will not be saved in the replay unless the keys in question (e.g. I) are mapped to Virtual Keys.

CommonData and Replay Comments
CommonData is the more common and more aggravating issue. Oftentimes, you will set CommonData that sets things during gameplay. For example, graphics settings, difficulty, etc. It is of the utmost importance that these settings persist as part of the replay and as such, you must use replay comments to save the CommonData involved. Note that only CommonData that result in different calls to the RNG have major impacts on the replay - things such as CommonData for music sound volume and the like do not matter in this case.

Upon loading the replay, you must parse the replay comment and set the CommonData appropriately. If you use config settings for graphics, you may also have to ensure that the user's preferred settings are restored after playing the replay.

There are other issues that can result in a desynced replay as well, but I can't name any specific ones off of the top of my head.

I hope this helps.

NOTE: Using CTRL to fast forward has absolutely no impact on the replay.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #376 on: November 01, 2016, 08:41:07 PM »
In fact, at the begining of the script I clear all the common data to avoid any remaning common data. I think i should be enough and the script must create all common data as he should during the replay. The only common data that are saved and not cleared are the common data area where I store all the data like max score, spellcard history, ect per player and per difficulty. But these data must be updated even during the replay.
I'm not sure what kind of common data can desync the replay. I see for things like difficulty or player but how I'm supposed to do with common data that are alwas updated like spellcard score value, items value or position of a random moving boss?

I also don't know why the replay desync randomly, sometimes very quicklyand sometimes at a few seconds before the end of the script. If a specific common data is involved, replays should be desync arroud the same moment no?

Anyway, thanks for your answer.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #377 on: November 01, 2016, 09:11:19 PM »
In fact, at the begining of the script I clear all the common data to avoid any remaning common data. I think i should be enough and the script must create all common data as he should during the replay. The only common data that are saved and not cleared are the common data area where I store all the data like max score, spellcard history, ect per player and per difficulty. But these data must be updated even during the replay.
I'm not sure what kind of common data can desync the replay. I see for things like difficulty or player but how I'm supposed to do with common data that are alwas updated like spellcard score value, items value or position of a random moving boss?

If CommonData are only used within the script (i.e. boss positioning), that does NOT need to be saved. Only CommonData that can differ on each run of the script (Difficulty, effect settings) need to be saved to Replay Comments.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #378 on: November 02, 2016, 08:30:44 PM »
I don't use any package scripts on these scripts so all the common data are set directly in the script (even difficulty) and are, I suppose, registered in the replay. I don't see why these common data can alter the replay. Or maybe it's due to some remanings common data that change graphical effects even if there are never set or changed in the script?
I follow my common data in the log window and the only one that change endlessly is the one used to pass the angle of the boss circle from a spell to the other.

I think it's due to some flaws in the code but what ind of flaws if it's not due to CommonData? Any one have also issue with replay on their scripts?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #379 on: November 02, 2016, 09:01:57 PM »
It doesn't have to do with the flaws of the code, but flaws of coding. Aka human error.

InitializeStageScene and FinalizeStageScene are start and end points for a Replay. Thus they are stage functions for stage scripts. Recording from outside the stage is asking for trouble.

Any commondata that is being processed from the very point you called InitializeStageScene should avoid RNG. I have plenty of commondata in my game too, running as background scripts (system) and such. As long as they don't RNG and have tight controll on what values are being set / read, then you're fine. You said you're doing this (like resetting and such) so I doubt there are issues here.

Again, RNG and bad design of commondata breaks/desyncs replays. CommonData can be perfectly updated.


In the end, you're going to do a lot of testing.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #380 on: November 03, 2016, 04:43:38 AM »
Now, despite this, you can circumvent this for the most part, although it's a really shitty workaround that I hate myself for having to do. Because the actual problem is the render targets, if you need to use a fancy blend type for some texture, you can apply the shader directly to that object individually, rather than rendering your whole background to one texture and using the shader on that (which is what you should be doing). This ignores the whole purpose of using the render targets, since you never really want to apply the shader multiple times because that's stupid, but it works.

So for objects with problematic blend types you can use this to apply it per-object, but if at all possible you should be doing the usual way of rendering to a render target and using that instead.

Code: [Select]
task ObjShader_TWaveCircle(obj){
let frame = 0;
let baseEffectRadius = 128;
let outerFluct = 16;
let effectRadius = 0;
let frameLeft = GetStgFrameLeft();
let frameTop = GetStgFrameTop();

ObjShader_SetShaderF(obj, GetCurrentScriptDirectory() ~ "SamplePS03_HLSL.txt");
ObjShader_SetTechnique(obj, "TecWave");

let objEnemy = GetEnemyBossObjectID[0];
while(!Obj_IsDeleted(objEnemy)){
effectRadius = baseEffectRadius + outerFluct * sin(frame*4);

ObjShader_SetFloat(obj, "frame_", frame);
ObjShader_SetFloat(obj, "enemyX_", ObjMove_GetX(objEnemy) + frameLeft);
ObjShader_SetFloat(obj, "enemyY_", ObjMove_GetY(objEnemy) + frameTop);
ObjShader_SetFloat(obj, "waveRadius_", effectRadius);

frame++;
yield;
}
}

Result: http://i.imgur.com/SuUqAx5.png
As far as my knowledge on hlsl with danmakufu goes, my way of making it work is:
1. Go into the _HLSL file.
2. Find this line:
Code: [Select]
        Out.color = color;

return Out;
3. Add "color.a = 1;" just before "Out.color = color;"
4. Done
So far, everything renders the same as when the shader is not present, but maybe I haven't found another bug yet.
Sagume's spell background is also BLEND_SUBTRACT and so far, everything looks fine.
http://imgur.com/a/pj6NU
Without the shader:
http://imgur.com/a/3pLFn
It worked like miracle!
Thank you both!!  :D
(sorry for my late reply lol)

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #381 on: November 07, 2016, 01:31:43 AM »
So I don't have a question or problem about code not working, but the entire Danmakufu engine itself not working. And no, it's not because I'm not using applocale--it RUNS and all that... in fact, it runs very well overall, except for one critical issue: 0.12m constantly hovers at around 58 fps or so, even in the main startup menu. Even odder, it runs at ~500-700 fps when on the pause menu, or where you can select "play" or a replay.

Windows 10, so that's probably a red flag. I have the 'region' setting to Japanese, which is why it lets me play these no problem.  ph3 has zero issues that I know about, and it properly hovers at 60 fps. I haven't seen it struggle at all, no matter what happens on the screen. My computer is very powerful, so that's why I think it's so odd for it to hover specifically at 58 fps. According to the task manager, it's taking up 1% of its processing power, too. I even manually tried to put it under Nvidia's settings, and that had no effect. Am I just stuck with 58 fps if using Windows 10? I know it sounds like a small issue, but when you play with stages that sync up with the music, going a tiny bit slower really messes with the rhythm and fun of it...

tl;dr version: Windows 10, set to Japanese region, runs successfully. ph3 is a solid 60 fps, but 0.12m consistently hovers around 58 in the start menu and during gameplay, and 500-700 when paused. What's up?

EDIT: I figured out what was up with the pause button having massive framerates. Seemed to have something to do with the config option with four bullets, two in Japanese, and one that says 1/2 and one that says 1/3. It was on the rightmost option. I wish I knew Japanese, but by inference, I'd say this is talking about frame skips, since it looked very choppy when I set it to 1/3. Maybe the rightmost was realtime or something? But that aside, all options had no effect on the main problem of hovering at 58 fps.
« Last Edit: November 07, 2016, 02:26:40 AM by namohysip »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #382 on: November 07, 2016, 08:59:59 AM »
The config.exe was translated somewhere on this forum section, if I can find it I will update this post.

Though it is completely true what you're mentioning. And it isn't just Win10. With Win7 I also never had solid 60 fps.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #383 on: November 07, 2016, 09:41:08 AM »
So does that mean I'll never be able to properly play those scripts where the music is in sync with the danmaku...? Aw man...

ZoomyTsugumi

  • zoom zoom
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #384 on: November 07, 2016, 10:19:16 AM »
I had a lot of issues with my 0.12m framerates except I was getting massive frames on the start menu too.

I tried this and it's worked fine for me, maybe it will be of use to you too?

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #385 on: November 07, 2016, 08:47:28 PM »
Hey, been a while since I worked on my script.
So far I've completed a first spell, so i'm starting to think about my plural script.
I know audio goes in there, but can I put graphics such as the boss's spritesheet/animation stuff and backgrounds in there too ?

Also, is there any website or whatever that teaches how to fire basic shapes and explains the code for it ? I know how to fire a spiral and a circle but i don't know about other shapes such as lines. I could find out myself about it but it would take some time so if you guys know any place that might save me time i'll gladly take the link.

(Also, thanks a lot, you're all awesome)

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #386 on: November 07, 2016, 10:33:14 PM »
Also, is there any website or whatever that teaches how to fire basic shapes and explains the code for it ? I know how to fire a spiral and a circle but i don't know about other shapes such as lines. I could find out myself about it but it would take some time so if you guys know any place that might save me time i'll gladly take the link.

Depends what you mean by shapes. If you want to fire a line of bullets from the boss, then just set the angle and fire at a constant rate. If you want to place a line of bullets somewhere on the screen, then use the formula y = mx + b to plot your line with an ascent loop. Alternatively, if you know the starting point and end point, you can ascent evenly from the start to end point, spawning your shots.

As for other shapes, I'm afraid there's no unified way to handle it (some of the other scripters here may be able to provide code samples for specific shapes or general shapes). There are many scripts that use shapes but you'll have to be more specific overall for an example. Things such as whether or not the shape maintains its shape after firing, etc. can add additional complexity to the code.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #387 on: November 08, 2016, 05:49:44 PM »
Well i meant really in general,  but thanks a lot for the formula.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #388 on: November 08, 2016, 10:15:51 PM »
I had a lot of issues with my 0.12m framerates except I was getting massive frames on the start menu too.

I tried this and it's worked fine for me, maybe it will be of use to you too?

That didn't work for me, but I figured out what did! First off, I needed two things:
UPX unpacker tool - I downloaded the wind32 one, since even though I have a 64 bit machine, there doesn't appear to be one, and generally 64 is backwards-compatible with 32... usually. Moving on.
The vpatch zip found on this post. It contains three important files: the vpatch exe, the config file of the same name and different extension, and vpatch_th_dnh.dll.

1. Get the two file sets above, as well as th_dnh.exe (if you renamed it for some reason, name it back to this.)
2. Go into the upx folder; you should see a bunch of files along the lines of "BUGS" "CUPYING" "LICENSE" "upx" as a word document, and "upx" as an exe. Move th_dnh.exe into this folder.
3. create in notepad a new file and name it something.bat
make sure the extension is .bat, and have it in the same place as upx and th_dnh. in this file, write just this line:
upx -d th_dnh.exe
This basically does a command line call to upx to "unpack" danmakufu.
4. Double click on this .bat file. You should see th_dnh change from its original filesize to 1444 KB in size. Not sure if the exact size changes from system to system, but that's what it did for me.
5. Move th_dnh back to its original area, with the 'script' folder and all that.
6. Now go into the vsync patch folder. move three files from there into the same area as th_dnh.exe. Move in vpatch, both the exe and ini files (configuration settings), as well as vpatch_th_dnh.dll.
7. double-click on vpatch.exe. If all goes well, it should launch danmakufu at 60 fps! Now all you need to do is always click vpatch instead of th_dnh itself, and it'll run. I just pinned vpatch to my task bar instead of danmakufu itself, and it's just as convenient.

Now I can play "Touhou music barrage" or whatever those four scripts are called, right in sync! So satisfying.

Oddly enough, Phantasmagoria Trues lagged like crazy after a while of playing. When I restarted the program, it lagged right from the start. As in, 30 fps, but only taking up 3% CPU. But when I restarted my computer, it was just fine, and remained so. So that's... weird... but it works, I guess? I'll edit this post if it happens again and/or I figure out the source or fix to the problem.
« Last Edit: November 08, 2016, 10:17:53 PM by namohysip »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #389 on: November 10, 2016, 11:16:15 PM »
Is there a way to optimize this trail effect, so that it doesn't completely lag the game whenever there's a large amount of bullets on the screen?

Code: [Select]
task EffectTrail1(shot, graphic, frame, blend){
while(!Obj_IsDeleted(shot)){
CreateEffTrail1(shot, graphic, blend);
wait(frame);
}
}

task CreateEffTrail1(shot, graphic, blend){
let rect = GetShotDataInfoA1(graphic, TARGET_ENEMY, INFO_RECT);
let eff = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(eff, "./resource/shot/Shot/ZUNShot.png");
ObjSprite2D_SetSourceRect(eff, rect[0], rect[1], rect[2], rect[3]);
ObjSprite2D_SetDestCenter(eff);
ObjRender_SetPosition(eff, ObjMove_GetX(shot), ObjMove_GetY(shot), 0);
ObjRender_SetAngleZ(eff, ObjMove_GetAngle(shot)+90);
ObjRender_SetBlendType(eff, blend);

let alpha = 100;
while(!Obj_IsDeleted(shot)){
ObjRender_SetAlpha(eff, alpha);
ObjRender_SetAngleZ(eff, ObjMove_GetAngle(shot)+90);
alpha-=5;
if(alpha <= 0){
Obj_Delete(eff);
}
yield;
}
Obj_Delete(eff);
}
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.