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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1650 on: January 25, 2019, 01:38:09 PM »
I discovered that adding this code causes danmakufu to not detect a .dnh script in its menu.
Code: [Select]

/***********************


************************/


What causes this behaviour? Is "/***" or "***" or "***/" reserved syntax or something?

If the #TouhouDanmakufu is commented out, then the script will not appear in the Danmakufu menu. I assume this is what you have done (placed #TouhouDanmakufu within the block quotes).

It's a common technique to hide Single scripts you don't want cluttering up the Danmakufu menu + scripts that should not be executed by the player

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1651 on: January 25, 2019, 02:22:04 PM »
If the #TouhouDanmakufu is commented out, then the script will not appear in the Danmakufu menu. I assume this is what you have done (placed #TouhouDanmakufu within the block quotes).

It's a common technique to hide Single scripts you don't want cluttering up the Danmakufu menu + scripts that should not be executed by the player

I understand this, but this is not what happened. The comment block was midway down the script. Specifically, I was rewriting a piece of code that had been simulating a beam using a laser, this instead using a primitive object.

In other words, the comment itself was 'empty'. Above the comment was my new function (half-written at this point), and below the comment was the old function, which was no longer called in @Initialize.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1652 on: January 25, 2019, 03:14:20 PM »
I understand this, but this is not what happened. The comment block was midway down the script. Specifically, I was rewriting a piece of code that had been simulating a beam using a laser, this instead using a primitive object.

In other words, the comment itself was 'empty'. Above the comment was my new function (half-written at this point), and below the comment was the old function, which was no longer called in @Initialize.

Please provide your full code. It may be a different issue altogether (e.g. unrecognized symbol at a weird location, smart quotes, etc)

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1653 on: January 25, 2019, 03:34:03 PM »
Please provide your full code. It may be a different issue altogether (e.g. unrecognized symbol at a weird location, smart quotes, etc)

I can do that, although it's a bit long...
There is a way I'm meant to do this other than sticking the entire file in between [ code ] tags, is that right?

EDIT:
https://pastebin.com/36zG0fXB
Since the script is quite long, I removed a lot of functions that were not relevant to the problem. This script is still representative of what I was doing at the time. I can confirm that this code replicates the problem on my device. Specifically it is the comment at around line 85 that causes the issue, as removing it allows danmakufu to detect the script again.
« Last Edit: January 25, 2019, 04:50:45 PM by Kinedyme »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1654 on: January 25, 2019, 05:17:38 PM »
Weird. I have absolutely no idea why Danmakufu doesn't like /**. Well, we have the source code, I guess.

Relevant code?
Parser for comments: https://github.com/UltimaOmega/TouhouDanmakufuRemastered/blob/master/source/GcLib/gstd/Script.cpp#L395
Danmakufu Header parsing: https://github.com/UltimaOmega/TouhouDanmakufuRemastered/blob/master/source/TouhouDanmakufu/Common/DnhCommon.cpp#L26
« Last Edit: January 25, 2019, 05:25:37 PM by Sparen »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1655 on: January 26, 2019, 03:28:11 PM »
Hey everyone,

I have been working on a spell which has multiple phases, similiarly to Boundary of Life and Death in a way that additional attacks are added as the opponent's life decreases, which I have been able to script in successfully.

However, I also would like to make it so that, again like BoLaD, once the timer hits a certain point, all of the phases instantly activate (not necessarily sped up like the original, though).

I'm using

Code: [Select]
while(ObjEnemy_GetInfo(objBoss,INFO_LIFE) > 5000){yield};
to handle the "wait until life hits a certain threshold" aspect of the phases. Each phase is in a seperate task.

How could I tell Danmakufu to keep waiting until either the boss reaches certain life thresholds (activating each phase sequentially) or as it reaches a certain time (activate all phases at once)?

On another note, I'd like to know...
-For a plural script, how could I end a single (for example, a spell) and move on to the next attack (for example, a nonspell) in a way so the boss starts out where it was on the previous attack (rather than always teleporting into the starting position)?

-Is there a way to keep track of how many spell cards the player has successfully captured so far? (I'd like to implement a last spell that can only be encountered if x spells have been captured throughout the run).

EDIT : Do multiple sounds played via SE_Play overwrite each other? I haven't exactly tested it throughly yet, but at times it seems that way.

Many thanks for the advice in advance!
« Last Edit: January 26, 2019, 03:59:58 PM by Mr.Ownage »
Achieve your mission without regrets.

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1656 on: January 26, 2019, 05:04:02 PM »
Weird. I have absolutely no idea why Danmakufu doesn't like /**. Well, we have the source code, I guess.

Relevant code?
Parser for comments: https://github.com/UltimaOmega/TouhouDanmakufuRemastered/blob/master/source/GcLib/gstd/Script.cpp#L395
Danmakufu Header parsing: https://github.com/UltimaOmega/TouhouDanmakufuRemastered/blob/master/source/TouhouDanmakufu/Common/DnhCommon.cpp#L26

I haven't been through all the header files, but between Script.cpp and DnhCommon.cpp I can't fathom how a /** can even make it past the parser, let alone interfere with the Danmakufu Header interpretation. Would you happen to know which file includes/calls the parsing process? I can only imagine that if the Danmakufu Header is parsed a second time independent of the rest of the script code, maybe there is a bug associated with the /**.

My only other idea at this stage is that the /** somehow causes the try block in ScriptInformation::CreateScriptInformation to throw an exception, which will cause the function to return a NULL pointer. This might be related to the above, where the /** might cause an incorrect generation of tokens regarding the header or the brackets during the lexing process.

All this said, it does seem to me that this behaviour is a bug rather than a feature. I don't think that danmakufu can (or should) incorporate paths with wildcard characters into the #TouhouDanmakufu Header anyway.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1657 on: January 27, 2019, 05:22:30 AM »
How could I tell Danmakufu to keep waiting until either the boss reaches certain life thresholds (activating each phase sequentially) or as it reaches a certain time (activate all phases at once)?

Have all the wait loops also end if time gets below a certain amount.

Code: [Select]
while(ObjEnemy_GetInfo(objBoss,INFO_LIFE) > 5000 || ObjEnemyBossScene_GetInfo(sceneObj,INFO_TIMER) < threshold){yield};

Something like that, where sceneObj is the BossScene Object and threshold is how low you want the timer to go before the boss gets mad.

-For a plural script, how could I end a single (for example, a spell) and move on to the next attack (for example, a nonspell) in a way so the boss starts out where it was on the previous attack (rather than always teleporting into the starting position)?

Is there any particular reason you want to do that? I can't think of anything that would really need it. If you do really want to, then you'd store the boss's coordinates with common data in the single and then have the starting coordinates in their next single be those same coordinates.

-Is there a way to keep track of how many spell cards the player has successfully captured so far? (I'd like to implement a last spell that can only be encountered if x spells have been captured throughout the run).

There's a thing in the system script that runs whenever you capture a spell. Have that increment a common data attribute and check for that attribute when beginning the last spell. Make sure that you're only modifying your script's copy of the system script and not the global danmakufu system script. I'm not sure if there's a pretty way to just not start the spell, but if all else fails you can just end the spell immediately if the attribute isn't where you want it. Requirements like that are pretty annoying though, so I'd suggest making it less stringent or even removing it entirely.


Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1658 on: January 28, 2019, 04:49:14 PM »
Thanks for the reply, Arcvasti! Obviously, regarding the "have the boss start out where it was on the previous attack", I wanted to do that since it looks really wonky to have it teleport back to its original starting position every time an attack is cleared (unless it can be done in a simpler way by not deleting the boss after every attack, of course).
Achieve your mission without regrets.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1659 on: January 28, 2019, 07:27:07 PM »
Thanks for the reply, Arcvasti! Obviously, regarding the "have the boss start out where it was on the previous attack", I wanted to do that since it looks really wonky to have it teleport back to its original starting position every time an attack is cleared (unless it can be done in a simpler way by not deleting the boss after every attack, of course).

By default, as long as you are using a Plural script with the appropriate ObjEnemyBossScene, the boss should remember its location between Singles. Unless you've done something in your code that prevents that, of course.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1660 on: January 28, 2019, 09:13:34 PM »
Thanks for the reply, Sparen! I wasn't in the know that that was actually the case, but after some testing, it indeed is! The issue was that I had included ObjMove_SetPosition (to half the STGFrameX and Y/4) in every Single that was in the Plural, which resulted in the boss being moved to that position every time for the new attack. Removing that piece of code resolved this issue.

Thanks once again!
Achieve your mission without regrets.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1661 on: January 29, 2019, 03:23:15 AM »
Thanks for the reply, Sparen! I wasn't in the know that that was actually the case, but after some testing, it indeed is! The issue was that I had included ObjMove_SetPosition (to half the STGFrameX and Y/4) in every Single that was in the Plural, which resulted in the boss being moved to that position every time for the new attack. Removing that piece of code resolved this issue.

Thanks once again!

No problem. I had a feeling that it was something like that. Many code issues are hard to spot because you pass by them when reading.

One suggestion is to read out loud what each line of code does. Alternatively, explain your code line by line to a mirror or a rubber duck (https://en.wikipedia.org/wiki/Rubber_duck_debugging). Since you will be explaining and reading your code line by line, you'll pick up on problems you didn't even realize existed.

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1662 on: January 29, 2019, 07:44:22 AM »
Thanks for the reply, Sparen! I wasn't in the know that that was actually the case, but after some testing, it indeed is! The issue was that I had included ObjMove_SetPosition (to half the STGFrameX and Y/4) in every Single that was in the Plural, which resulted in the boss being moved to that position every time for the new attack. Removing that piece of code resolved this issue.

Thanks once again!

You could try using ObjMove_SetDestAtFrame() instead to have the boss move smoothly back to the centre from wherever it was over a specified number of frames. That's what I use to 'reset' all the movement the boss made during each attack.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1663 on: January 29, 2019, 07:16:41 PM »
ObjMove_SetDestAtFrame works fine for ensuring the boss is in the right place at the right time, but it can look kind of awkward if it moves from very far or very close to the destination. I personally made a function that moves the boss somewhere and then waits until it arrives before continuing with the script.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1664 on: January 31, 2019, 01:01:08 PM »
The DnhViewer.exe seems to not working in Windows 7 (or at least in my computer in this case, it works without problem in other computers) and I don't really know the problem. Is it like, normal for it to not working on Win7? If not, what the problem might be?  ???
It's just not possible to click on buttons, they don't respond.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1665 on: January 31, 2019, 05:27:03 PM »
Hi everyone. I already asked the question here, but didn't get the answer, so I just forgot about it. Now though, I stumbled upon this problem one again, and really need to fix it. So, I'm trying to create a package but I'm having issues with saving replays. At the end of the process, the error on the immage appears. I tried using both custom replay saving scripts and the default one, but it's always the same. I also tried manually setting the SaveReplay parameters, but that doesn't work eather.  And at that, I'm all out of ideas on how to fix it, so I need help.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1666 on: January 31, 2019, 07:53:17 PM »
Hi everyone. I already asked the question here, but didn't get the answer, so I just forgot about it. Now though, I stumbled upon this problem one again, and really need to fix it. So, I'm trying to create a package but I'm having issues with saving replays. At the end of the process, the error on the immage appears. I tried using both custom replay saving scripts and the default one, but it's always the same. I also tried manually setting the SaveReplay parameters, but that doesn't work eather.  And at that, I'm all out of ideas on how to fix it, so I need help.

Please provide context sufficient enough for us to replicate your issue.

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1667 on: January 31, 2019, 10:07:42 PM »
Can somebody please explain to me how the three angles in ObjRender_SetAngleXYZ(objID, angleX, angleY, angleZ) interact with each other?

In other words, what happens if say, angleY = 45 and angleZ = 90?
What about angleX = 30 and angleY = 180?
What about angleZ = 45 and angleY = 45 and angleZ = 45?
etc...

Alternatively, if this type of manipulation has a name that can yield relevant answers on the Google, that helps too.

Thanks in advance.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1668 on: February 01, 2019, 05:38:10 AM »
With the standard 2D camera, the x-axis goes along horizontally, the y-axis goes along vertically, and the z-axis is going into and out of the screen. So for rotating 2D objects as you would expect (clockwise/counter-clockwise), you rotate on the z-axis since that will spin them around. Because the x-axis is horizontal, rotating along that axis will flip the object top to bottom. The y-axis being vertical means rotating along that will spin the object around side to side.

If angleZ = 90 then the object is rotated a quarter-circle around clockwise, and if angleY = 45 then it's spun around an eighth-turn, which on a 2D sprite will look like it's squished by about 70% horizontally. So combined it'll look like the object's top is on the right and the whole thing is squished a bit.

If angleX = 30 a 2D object will look a bit flattened vertically and if angleY = 180 then it will look completely mirrored left to right.
« Last Edit: February 01, 2019, 05:40:19 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 #1669 on: February 01, 2019, 01:09:40 PM »
Hey, everyone.

With my first script having been done almost completely (which I am really excited about), there's only one problem that remains... a new problem I've run into. Sounds definitely seem to overwrite each other.

I have made a spell which spawns lasers, which leave behind trails of projectiles that begin moving after a short while. It's the same spell I had 0,0 spawning issues with back then, but that was thankfully fixed since.

However, I've run into a new, mainly cosmetic, but still a quite annoying problem. I have made the spell so a laser sound effect is heard whenever the lasers are fired, and a "charge" sound (similiar to the sound heard when the laser cage in Boundary of Humans and Youkai moves around) is heard when the projectiles begin moving.

The problem is... should new lasers be fired at the moment the projectiles move, the lasers' sounds "overwrite" the charge sound, as in, cut it short, which doesn't happen in the original Touhous (think BoHaY again).

Code: [Select]
task lazertime{
let angle = 100;
wait(60); //One time wait so the cutin can disappear by this time, and the boss can move into position
loop{
while(GetShotCount(Zataihou) > 160){yield;} //If there's many souls on screen, stop creating new lasers and trails. Souls are "Yuyuko-type butterflies".
wait(10);
ascent(i in 1..6){
let obj = CreateCurveLaserA1(ObjMove_GetX(Zataihou), ObjMove_GetY(Zataihou), 12, angle+i*12, 30, 20, 1019+i, 10); //Handles the lasers
SE_Play(laser2,70); //laser sound
ObjCrLaser_SetTipDecrement(obj,0); //Makes laser hitbox fair
ObjMove_SetAngularVelocity(obj,-7); //Handles the curving of the lasers
trail(obj); //Task to spawn trails. No issue with this one.
straighten(obj); //Task to have the lasers go straight after a short while (so they leave the screen). No issue here either.
angle+=30; //Increment angle to give different laser angles
}
}}


task fly(souls){
while(GetShotCount(Zataihou) < 150){yield;} //Wait until there's enough souls, then...
ObjMove_AddPatternA2(souls,60,NO_CHANGE,rand(40,150),0.01,0,12); //... let them move around.
SE_Play(charge4,100); //charge sound
}

The SE_Play in the above example is a task that loads, plays, then removes the sound, based on AJS' Praise The Sun (without looking at and analysing his scripts,  I probably wouldn't have been able to start at all, shoutout for his great works!)

Code: [Select]
task SE_Play(let path, let vl){
let seobj = ObjSound_Create;
ObjSound_Load(seobj,path);
ObjSound_Play(seobj);
ObjSound_SetVolumeRate(seobj,vl);
loop(120){yield;}
RemoveSound(path);
}

Could the problem be that both sounds are being handled via SE_Play? What could be possible ways to fix this?
Also, I haven't been able to stop the background music once the script ends (not while paused, I managed to do that). Any ideas about how to do that?
 
Thanks for replies in advance!
« Last Edit: February 01, 2019, 04:33:17 PM by Mr.Ownage »
Achieve your mission without regrets.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1670 on: February 01, 2019, 04:19:16 PM »
Please provide context sufficient enough for us to replicate your issue.
Package part, Continue script and ReplaySave script. The replay script is almost untouched, because i figured it has the main issue. As for replicating the problem, I don't really know how to do it, since I started making the package a while ago, and it has too many scripts connected with it. One thing I noticed tho, is that replayIndex in SaveReplay is somehow incorrect, but I don't know what's wrong with it

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1671 on: February 02, 2019, 09:16:58 AM »
Code: [Select]
task SE_Play(let path, let vl){
let seobj = ObjSound_Create;
ObjSound_Load(seobj,path);
ObjSound_Play(seobj);
ObjSound_SetVolumeRate(seobj,vl);
loop(120){yield;}
RemoveSound(path);
}

Could the problem be that both sounds are being handled via SE_Play? What could be possible ways to fix this?
There are a couple problems with this kind of approach. The main issue you have is because the purpose of RemoveSound is to unload the file from memory. If you play a sound once and then try to play it again but the file is unloaded halfway through it'll just stop. It isn't the laser sound interacting with the charge sound, it's the several tasks calling RemoveSound all the time. The laser sounds are also going to be reset after 12 loops (i.e. 120 frames) but you probably won't notice it.

For that matter, you're calling PlaySE for every laser etc so it's creating a new and different sound object each time, so you're going to end up with a bunch of the same sound that starts playing on the same frame. This probably affects how it sounds in some way but I'm not sure. Also important is that you never delete these objects, so even though you're unloading the sound file the objects are going to stick around forever and potentially cause problems.

Ideally you want a single object per sound that can be played, and when you want that sound to be played somewhere you call ObjSound_Play on the same object. Try the following:

Code: [Select]
function SE_Play(path){
ObjSound_Play(SE_GetSoundObject(path));
}
function SE_GetSoundObject(path){
let se_table = GetCommonData("SE_TABLE", ID_INVALID);
if(se_table == ID_INVALID){
se_table = ObjSound_Create();
SetCommonData("SE_TABLE", se_table);
}

if(!Obj_IsValueExists(se_table, path)){
let obj = ObjSound_Create();
ObjSound_Load(obj, path);
Obj_SetValue(se_table, path, obj);
return obj;
}

return Obj_GetValueD(se_table, path, ID_INVALID);
}

What this does is make a table (a dummy sound object) that maps the sound's file path to one sound object, and when you call SE_Play to play the sound at that path it finds the associated object to use. Because the sound table dummy object ID is put into CommonData you can access the same table through different scripts.

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

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1672 on: February 06, 2019, 03:10:12 PM »
Are you able to vary things like blend types and alpha values between different vertices in a 2D Sprite List?

Assuming the answer is yes, the follow up is; how do these blend/alpha types interact with each other and the environment once you call ObjSpriteList2D_CloseVertex() ?

For example, what would be the final alpha values for Vertex 1 and Vertex 2 after this type of code?

....
ObjRender_SetAlpha(obj, 64);
ObjSpriteList2D_AddVertex(obj); // Vertex 1
?.
ObjRender_SetAlpha(obj, 128);
ObjSpriteList2D_AddVertex(obj); // Vertex 2
ObjSpriteList2D_CloseVertex(obj);
ObjRender_SetAlpha(obj, 255);
....

How do these blend types also interact with each other, especially if different vertices overlap with each other?

Thanks in advance.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1673 on: February 06, 2019, 07:36:55 PM »
While working on my script (which is up here now as "Terror of the Underworld"), I have been thinking of implementing a last spell in the style of Eirin (currently playing BGM stops, then, after some delay, the boss re-appears with a seperate lifebar and the spell proceeds from there, with a new BGM), but I wasn't able to figure out how could this exactly be done.

The current Plural script I use to handle the main fight so far :

Code: [Select]
let obj=ObjEnemyBossScene_Create();
ObjEnemyBossScene_Add(obj,0,CSD~"samplenonspell.txt"); //Naturally, these are not the names of the attacks, I just renamed it to this for the sake of simplicity.
ObjEnemyBossScene_Add(obj,0,CSD~"samplespell.txt");
. //the rest of the attacks here, which I didn't include to avoid a huge wall.
        .
        .
ObjEnemyBossScene_Add(obj,10,CSD~"finalspell.txt");
ObjEnemyBossScene_LoadInThread(obj);
ObjEnemyBossScene_Regist(obj);
while(!Obj_IsDeleted(obj))
{
yield;
}
BGMstop; //task to stop BGM after all attacks are done.
CloseScript(GetOwnScriptID());}

One idea I've been thinking of is using a new variable in the form of obj2 in ObjEnemyBossScene_Create and the rest of the Boss Scene commands to handle the creation of a seperate lifebar, but I'm not sure if wait() would work in this case to handle the delay (I'm thinking the lack of a boss for a short while could cause the fight to prematurely end?).

Another idea I've had and tried is to try delaying the creation of ObjEnemy (the boss) by including its spawning in a different task with wait() rather than in Initialize. Needless to say, it failed, and caused Danmakufu to close without showing an error.

Any ideas on how to approach this? Or it wouldn't be possible with more in-depth (and perhaps Common Data) knowledge?
Thank you all for advice in advance :)
Achieve your mission without regrets.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1674 on: February 06, 2019, 10:43:34 PM »
Are you able to vary things like blend types and alpha values between different vertices in a 2D Sprite List?

Assuming the answer is yes, the follow up is; how do these blend/alpha types interact with each other and the environment once you call ObjSpriteList2D_CloseVertex() ?

For example, what would be the final alpha values for Vertex 1 and Vertex 2 after this type of code?

How do these blend types also interact with each other, especially if different vertices overlap with each other?

Thanks in advance.
This is the second post you've written in a row where you seem to already know what's happening and can clearly test things yourself but still want an explanation. If I don't answer this, how will you be able to figure this out? I honestly think you have the capacity to think about this on your own and I don't quite know why you're even asking. If I were teaching a Danmakufu course and you were a student, I would be asking you how to explain this.


One idea I've been thinking of is using a new variable in the form of obj2 in ObjEnemyBossScene_Create and the rest of the Boss Scene commands to handle the creation of a seperate lifebar, but I'm not sure if wait() would work in this case to handle the delay (I'm thinking the lack of a boss for a short while could cause the fight to prematurely end?).
Try it.
« Last Edit: February 06, 2019, 10:45:21 PM by Drake »

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

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1675 on: February 07, 2019, 12:48:59 PM »
This is the second post you've written in a row where you seem to already know what's happening and can clearly test things yourself but still want an explanation. If I don't answer this, how will you be able to figure this out? I honestly think you have the capacity to think about this on your own and I don't quite know why you're even asking. If I were teaching a Danmakufu course and you were a student, I would be asking you how to explain this.

I'm sorry if it seems that I already know what's going on, (although it also makes me secretly happy if you really think that is the case, o^-^o ) but in reality, I haven't got any idea. I have already tried testing this, but it doesn't make sense to me what's happening with regard to pixel values, which is why I'm here trying to discover what I've missed.
For example, I've tried overlaying two vertices each with alpha values of 128 and blend type BLEND_ALPHA, but the resulting rectangle, which I would expect to be solid, instead seems to have an alpha value of around 190, which I would have thought to be the behaviour if the two layers are BLEND_ADD_ARGB.
Incidentally, if the two layers are given the type BLEND_ADD_ARGB instead, they produce an opaque sprite when overlapping, which is exactly what I was expecting from BLEND_ALPHA (or maybe BLEND_ADD_RGB as well in this case?). So what I wonder is; what is it that I don't understand about alpha compositing that makes this result a surprise for me?

If you didn't answer the question ? ^^; I guess I could try poking around other areas of the internet a bit more, but this is the most logical place to look, and the concept of a '2D Sprite List' doesn't seem to be present in any other language that I know of... If I really needed to, I suppose I could step through the source code looking for where the rendering functions are implemented, but that takes so much time that I was hoping that somebody else might know before I commit myself to that.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1676 on: February 07, 2019, 04:09:36 PM »
It indeed worked just as expected, Drake! I didn't actually expect it to go so easily, so smoothly, but in the end, it did, just as I wanted it to : BGM stopping, some delay, then the boss making a grand re-appearence for its final attack.

Now I have learned that there's no need to be afraid of experimentation. There is nothing to lose and everything to gain, after all.
Thanks for your reply :)
Achieve your mission without regrets.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1677 on: February 07, 2019, 08:59:45 PM »
* snip *
If your goal is to purely analyse, experiment and theorize on the possibilities of Danmakufu functions and its source code then you're pretty much in bad luck. Until now, most of your posts come over as experiments and theory followed by conducting the test. My personal question: For what purpose/goal?

Example your last post question: What would that complex question possibly yield for you or people reading it?

I am getting "science" vibes from your post and we're not exactly science community that conducts research in Danmakufu. At least, not the soul purpose of the Q&A. Most people posting here are seeking a pragmatic way of working and a solution for their problems. Of course we help them also with the artistic part such as music, sounds and effects.


Additionally, you've asked two questions (fog and 3d cameras) which were both covered in two video tutorials. We pour energy and time in those tutorials to make people's life easier. However, from you I am getting the idea of laziness. If I am wrong then my apologies, but I am kind of guessing/basing this on your posting history + no content produced so far over a span of 1 year.

Edit:
My advice would be to stop bothering or breaking your mind too much about these complex things. But if that makes you happy about Danmakufu then that is all fine. But please do keep in mind the purpose of this forum section.

« Last Edit: February 07, 2019, 09:03:59 PM by Helepolis »

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1678 on: February 08, 2019, 12:43:14 AM »
Sprite Lists work by having you set up a single sprite, completely, and then adding it to the list of sprites to finalize it. Once you do that you cannot modify the previous sprite by itself anymore. Calling functions to modify the sprite are modifying the next sprite to be added, and anything you don't change (such as the sprite texture, render priority, etc) will also still apply to the next sprite.

Once the whole sprite list is finished, you can then call ObjSpriteList2D_CloseVertex on the object. This finalizes the sprite list, and any following modifications are applied to the whole object.

You'd be right that "sprite lists" seem to be just a thing with Danmakufu; I'm not really aware of similar things. But essentially sprite lists work as a sort of sprite rendering pipeline. Rather than apply some properties to sprites one at a time you set them up here and make a block of sprites then work with that instead. This is somewhat similar in function to render targets, I guess.

As for the confusion regarding blending modes, consider that if you have two partially transparent things overlapping each other and then something behind those, you will still see some of the thing in the back because that's kind of the point of being partially transparent. Just because there are two things won't make it appear solid.

Mathematically if you have a pixel color value p1 with alpha a1 on top of a pixel color value p2, the result is (p1 * a1 + p2 * a2 * (1 - a1)). The resulting alpha is (a1 + a2 * (1 - a1)) which is just 1 if p2 is opaque. (Also these are normalized to 0~1 instead of 255 so the math looks nice)

So like in your example, with two pixels with 0.5 alpha (or 128) you get a resulting alpha value of 0.5 + 0.5*(1-0.5) = 0.75, or 192 denormalized.

Meanwhile add-blending is literally about adding the pixel values, so add-argb is just (p1 + p2).
« Last Edit: February 08, 2019, 12:58:02 AM by Drake »

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

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1679 on: February 08, 2019, 11:18:21 AM »
Mathematically if you have a pixel color value p1 with alpha a1 on top of a pixel color value p2, the result is (p1 * a1 + p2 * a2 * (1 - a1)). The resulting alpha is (a1 + a2 * (1 - a1)) which is just 1 if p2 is opaque. (Also these are normalized to 0~1 instead of 255 so the math looks nice)

So like in your example, with two pixels with 0.5 alpha (or 128) you get a resulting alpha value of 0.5 + 0.5*(1-0.5) = 0.75, or 192 denormalized.
That you so much! I see where I went wrong now.
I mistakenly misinterpreted the formula from the wiki documentation: (r1, g1, b1) * a1/255 + (r2, g2, b2) * (1 - (a1/255)) : I wasn't taking into account that the first alpha layer was already blended with the background.

My advice would be to stop bothering or breaking your mind too much about these complex things. But if that makes you happy about Danmakufu then that is all fine. But please do keep in mind the purpose of this forum section.

I understand.
I apologise if I've been causing trouble. Thank you for still so patiently hearing me out.
I will try my best not to be a bother in the future.