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

0 Members and 1 Guest are viewing this topic.

Montrek

  • Neophyte
  • Nickname: Necromancer036
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1710 on: February 28, 2019, 06:02:56 am »
I sincerely thank you for all the help :)

Also I noticed some of you make your own music, if so would you mind giving me the name of the app or program you use?  ;)

It would be of great help, since many people like original music! :D
« Last Edit: February 28, 2019, 08:49:09 am by Montrek »

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1711 on: March 06, 2019, 12:40:18 am »
Sup

So I'm playing around with GFW's ice mechanic and a little stuck on how to calculate ice area. I know how to find the combined area of two intersecting circles, but I'm unsure how to generalize that to an arbitrary number of possibly-intersecting circles in a way that will be fast enough to be viable. Any ideas?
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1712 on: March 06, 2019, 09:00:28 am »
The first easy approach that comes to mind is to Monte Carlo it. The ice area doesn't need to be exact, and you can balance efficiency versus accuracy. Find the bounding box of the circles, throw a bunch of random points out and check against each circle. The ratio of the points hitting a circle to the total points multiplied by the area of the bounding box is approximately the covered area.

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

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1713 on: March 07, 2019, 03:37:22 am »
The first easy approach that comes to mind is to Monte Carlo it. The ice area doesn't need to be exact, and you can balance efficiency versus accuracy. Find the bounding box of the circles, throw a bunch of random points out and check against each circle. The ratio of the points hitting a circle to the total points multiplied by the area of the bounding box is approximately the covered area.
I suppose that works well enough. After fiddling around a bit I found that trying max(100, min(1000, 1000 / (length(circles)/10)^0.5 ) ) points across the whole screen (too lazy to find a bounding box) seems to give a decent balance of efficiency and accuracy.
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1714 on: March 07, 2019, 05:01:26 am »
Another idea I had to speed things up a bit would be to make a grid of the screen and do spatial hashing with cell size R (ice circle radius), where first you go through every circle, check the cell the center is in, then mark the 9 grid cells around it with the circle to make a list of "circles touching this cell". Then instead of checking a point against every circle you'd look up where it is in the grid then only check any circles that were listed for that cell. (i.e. basically just broad-phase collision detection)

that is until i remembered danmakufu can't modify multidimensional arrays any deeper than one level
you can emulate multidim indexing but as if i'm gonna bother with that
« Last Edit: March 10, 2019, 01:59:23 am by Drake »

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

Twizzy

  • Nickname: Twizzler
  • Gender: Kermit
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1715 on: March 09, 2019, 02:40:41 am »
Back again with that Stage 5/6 SA Background waves. I'm still trying to figure out how to replicate the waves from stage 5/6 SA background.

It seems to be a basic wave distortion using sine and cosine but I have no idea how to write shaders in HLSL much less how to implement it. Does anyone have any similar examples or an idea how to actually write a shader to replicate the waves? I was looking at the HLSL samples (mainly the SamplePS03) but I didn't get far with that.

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1716 on: March 09, 2019, 06:10:47 pm »
Is this thread still current with regards to Bulletforge registration? I know registration is still disabled, but I'm mainly wondering if new accounts can still be manually created / if anyone will respond if I request one in there. It's been almost 3 years since anyone posted in that thread so hesitant to just poke my head in there.
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
  • Staff
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1717 on: March 09, 2019, 07:30:44 pm »
Blargel doesn't seem to be roaming IRC or forums any more. His last activity was February 2018. That is a year ago. I am afraid you won't be able to get something registered on bulletforge  :ohdear:

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1718 on: March 09, 2019, 10:05:44 pm »
Blargel doesn't seem to be roaming IRC or forums any more. His last activity was February 2018. That is a year ago. I am afraid you won't be able to get something registered on bulletforge  :ohdear:
Bluh

So now I'm playing with StB/DS-esque camera mechanics. I've got the shot-clearing aspect taken care of, but not sure how to approach rendering the captured area to a photo. I know it's probably going to involve RenderToTextureA1 and/or SaveSnapShotA2, but I'm not sure how to then get the correct region for the rotated rectangle of the target area. I have a vague inkling that I might need to rotate the screen before capturing the image?

E: Also, does anyone have the "camera ready" sound effect or a recreation thereof? That's the only one I haven't been able to find.
« Last Edit: March 10, 2019, 12:56:01 am by Andi »
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1719 on: March 10, 2019, 02:12:06 am »
You could use RenderToTexture over the STG frame then using that texture draw a primitive rectangle using the picture corner coordinates as UV vertices (instead of making a sprite like you're probably thinking).

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

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1720 on: March 10, 2019, 03:10:56 am »
You could use RenderToTexture over the STG frame then using that texture draw a primitive rectangle using the picture corner coordinates as UV vertices (instead of making a sprite like you're probably thinking).
Hmm, I'll look into that. For now I got it working using the 2D camera settings and SaveSnapShotA2 - it's not rendering everything perfectly (some stuff in the background has too much alpha, see screenshot) but it seems good enough for now.
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1721 on: March 10, 2019, 05:48:45 am »
here's my rough

Code: [Select]
function take_pic(at_x, at_y, to_x, to_y, scale){
let x = at_x+GetStgFrameLeft();
let y = at_y+GetStgFrameTop();
let a = -20;
let w = 200;
let h = w/4*3;
let cam = [
// camera center + corner offsets + rotation
[x + (-w/2*cos(a) - h/2*sin(a)), y + (-w/2*sin(a) + h/2*cos(a))],
[x + ( w/2*cos(a) - h/2*sin(a)), y + ( w/2*sin(a) + h/2*cos(a))],
[x + (-w/2*cos(a) + h/2*sin(a)), y + (-w/2*sin(a) - h/2*cos(a))],
[x + ( w/2*cos(a) + h/2*sin(a)), y + ( w/2*sin(a) - h/2*cos(a))]
];

let pic_id = GetCommonData("CAMERA_PIC_COUNT", 0);
SetCommonData("CAMERA_PIC_COUNT", pic_id + 1);

let tex = "CAMERA_PIC_" ~ rtos("000", pic_id);
CreateRenderTarget(tex);
RenderToTextureA1(tex, 20, 60, true);
let p = ObjPrim_Create(OBJ_PRIMITIVE_2D);
ObjPrim_SetPrimitiveType(p, PRIMITIVE_TRIANGLESTRIP);
ObjPrim_SetVertexCount(p, 4);
ObjPrim_SetTexture(p, tex);
ascent(i in 0..4){
ObjPrim_SetVertexUVT(p, i, cam[i][0], cam[i][1]);
ObjPrim_SetVertexPosition(p, i, cam[i][0]-x, cam[i][1]-y, 0);
}
ObjRender_SetPosition(p, to_x, to_y, 0);
ObjRender_SetScaleXYZ(p, scale, scale, 1);
Obj_SetRenderPriorityI(p, 90);
}

« Last Edit: March 10, 2019, 06:16:26 am by Drake »

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

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1722 on: March 12, 2019, 02:27:34 pm »
So I've got one of those impossible-to-track-down issues that don't make sense. Danmakufu is now force closing upon loading scripts, and I can't figure out what I might have changed that could be causing this. Just prior to this, it was force closing upon closing scripts, but only certain ones and only under certain conditions; I spent several hours commenting things out trying to pin down what was causing it and concluded that there was no cause and any illusion of cause was completely fake because I literally removed the entire system related to what appeared to be the cause and it still happened, and I couldn't get it to happen at all in scripts that weren't affected, even by rewriting the same exact code as the problematic script. Finally, every script started force closing before they even started, for no discernible reason.

I searched for non-ASCII characters and found none other than the usual leftover Japanese comments. That was my only real hypothesis for something that could cause this. Any ideas?

I would post my code but I have absolutely no idea where the problem is.
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1723 on: March 17, 2019, 08:32:04 pm »
Okay, I have no idea why but the inexplicable force quit on trying to load any script has stopped, allowing me to go back to tracking down the other bug.
I've determined that it's force closing when it tries to load a common data area. It's used in multiple places so it could already exist or not - I'm in the process of tracking down the exact conditions, but here's the code it's crashing on:
Code: [Select]
if(!IsCommonDataAreaExists("cutin_History")){CreateCommonDataArea("cutin_History");}
LoadCommonDataAreaA1("cutin_History"); // <-- force quits here
I've commented out one of the two places I found this but it still happens; possibly a third place?

(Edit: I checked with find in files and those were the only two places. It still happens if I change the name entirely in one place and remove the others, and still happens with only the second line. It seems like any use of LoadCommonDataAreaA1 is causing it??? Which is weird because while I only recently added that snippet to a second place, it's been hanging out in the cutin function for ages without issue.)

Elsewhere I have this, which has caused no problems, but I'm pretty sure this is the only place I try to load that one:
Code: [Select]
let isconfig = LoadCommonDataAreaA2("CONFIG",dirdat~"config.dat");
if(!isconfig){
CreateCommonDataArea("CONFIG");
SetAreaCommonData("CONFIG","Difficulty",NORMAL);
SetAreaCommonData("CONFIG","MainEquip",EQ_CAMERA);
SaveCommonDataAreaA2("CONFIG",dirdat~"config.dat");
}

I don't really understand under which conditions creating or loading common data areas causes issues; if someone could explain that to me I could probably figure it out from there.

Edit: the following also crashes:
Code: [Select]
let path = dirdat~GetScriptInfoA1(GetMainStgScriptPath, INFO_SCRIPT_ID)~"_common_cutin_History.dat";
LoadCommonDataAreaA2("cutin_History",path);
but THIS doesn't:
Code: [Select]
let path = dirdat~GetScriptInfoA1(GetMainStgScriptPath, INFO_SCRIPT_ID)~"_common_cutin_History_asdf.dat";
LoadCommonDataAreaA2("cutin_History",path);
I don't get it

Edit: I changed the path to use for it everywhere, which made it work once. The second time, after it had already saved the info there, it crashed as usual.
« Last Edit: March 17, 2019, 11:39:07 pm by Andi »
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1724 on: March 18, 2019, 03:48:33 am »
What are the contents of the data? Does it still crash if it's empty or has just one value stored? What's the minimal replicating conditions you can find?

I can create, save, and load areas just fine in pretty much whatever order, load multiple times, use create before/after loading, etc. Don't think there's a problem with the basic functionality.

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

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1725 on: March 18, 2019, 12:51:19 pm »
What are the contents of the data? Does it still crash if it's empty or has just one value stored? What's the minimal replicating conditions you can find?
Here's the code where the contents are set (not mine):
Code: [Select]
//These are long-looking common data group names
let SpellDataAttempt = SpellName~"|"~CutinDifficulty~"|"~GetPlayerID~"|"~"Attempt";
let SpellDataGet     = SpellName~"|"~CutinDifficulty~"|"~GetPlayerID~"|"~"Get";
//This is actually the common data retrieval
let SpellValueAttempt = GetAreaCommonData("cutin_History", SpellDataAttempt, 0);
let SpellValueGet     = GetAreaCommonData("cutin_History", SpellDataGet,     0);

if(!IsReplay){
SpellValueAttempt++;
SetAreaCommonData("cutin_History", SpellDataAttempt, SpellValueAttempt);
SaveCommonDataAreaA1("cutin_History");
}

And here's what I was trying to add when this whole thing started:
Code: [Select]
if(!IsCommonDataAreaExists("cutin_History")){CreateCommonDataArea("cutin_History");}
LoadCommonDataAreaA1("cutin_History");

let group = CurrentSC~"|"~GetCommonData("Difficulty","Normal")~"|"~GetPlayerID()~"|";
let hiscore = GetAreaCommonData("cutin_History", group~"DecisiveBestShot|Score", 10000);
if(photoScore > hiscore){
SetAreaCommonData("cutin_History",group~"DecisiveBestShot|Score", photoScore);
SetAreaCommonData("cutin_History",group~"DecisiveBestShot|Angle", origAngle);
SetAreaCommonData("cutin_History",group~"DecisiveBestShot|Boni", Obj_GetValueD(photo,"Boni",[])); // <----- wait... is it this?!?!?!

let _CurrentSC = JoinString(SplitString(CurrentSC,"\"/*|<>:? _"),""); //remove characters that can't be in filename
let fname = dirdat~"DecisiveBestShot_"~_CurrentSC~"_"~GetCommonData("Difficulty","Normal")~"_"~GetPlayerID~".png";

LoadTexture(texture); //this is ridiculous but I couldn't find a better way that was actually working
let obj = CreateSprite(0,0,texture,[0,0,GetTextureWidth(texture),GetTextureHeight(texture)], 99);
ObjSprite2D_SetDestRect(obj,0,0,GetTextureWidth(texture),GetTextureHeight(texture));
SaveSnapShotA2( fname, 0,0,GetTextureWidth(texture),GetTextureHeight(texture));
Obj_Delete(obj);
}
let photosTaken = GetAreaCommonData("cutin_History", group~"PhotosTaken", 0);
SetAreaCommonData("cutin_History",group~"PhotosTaken", photosTaken + GetCommonData("PhotosTaken",1));
SaveCommonDataAreaA1("cutin_History");

I just tried deleting the history and trying without saving the array of boni, and it doesn't appear to be happening like that? So... I guess it can't handle loading common data areas with arrays stored in them???
Or... Ah! The boni are actually a 2D array, [["Bonus name", "value"],["Self Shot","x1.2"]], but here I'm defaulting to just []. If I default to [[]] instead...
Oh my god. That was it. Now I understand why this bug seemed so random and nonsensical. I hate how much sense it makes now.

Edit: Wait, fuck, it just happened again
Edit2: Fuck arrays, I'm just storing it as one big string
« Last Edit: March 18, 2019, 01:13:06 pm by Andi »
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1726 on: March 18, 2019, 05:32:34 pm »
Okay, separate question: How would you recommend implementing a LoLK-style checkpoint system? Or something like Spell Practice where you restart the card when you get hit?

The latter could technically be done by just reloading the script but that would obviously be extremely slow, plus it would restart the music.
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
  • LOOK AT ME
  • Nickname: Mewkyuu
  • Gender: Indeterminate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1727 on: March 19, 2019, 03:24:13 am »
How would you recommend implementing a LoLK-style checkpoint system?

Oh, boy... Before I do answer this question, let me warn you, it is a huuuuge pain in the butt to do.
I do happen to have a half-finished implementation of it in Shrines;Gate. It has most of the stuff listed below, but because I've been lazy with saving and reloading so many things, I decided to skimp out on a few parts, so it's not 100% accurate. That stuff's for the truly determined, which I'm not.
Anyway:

It's nothing really more than Common Data spamming.
  • Unfortunately, as you had guessed, and as I had done for my own pointdevice mode, you'd just go back in time by well... using the end scene and restarting the script!
    I'm not sure if you can figure out a better way to do it, but it is definitely the most intuitive way of restarting the script.
    So how do you save the game state? You'd need to...
  • Handle any and all graphical effects (background, particles, animations etc.) as a timer-controlled thing.
    You'd want to save the position, time elapsed since the effect was spawned, and any other information that you might need like velocity, angular velocity...
    This applies to literally anything else you might think you would need to preserve as well, such as the positions of the player's options, number of score points/bombs/graze/special gauge, etc.
    These will be gotten via common data as they are initialized. The default values will be whatever you would set them as normally if you weren't handling pointdevice.
    This should handle most of everything. However....
  • You'll also want to save one value of common data for the phase (via CD of course).
    This lets you code the stage with phases in mind. Say if you moved onto the 2nd wave, you'd have an if statement bar DNH from spawning anything from the 1st wave, and so on.
    Without this, Danmakufu doesn't know how far back you want to go in time.
    You'll make a call to increment this as well as set the common data for anything as mentioned before, at the very end of a phase.
  • I don't know whether there's a better way to handle it, but for my own system, I completely recoded the boss scene system using regular enemies.
    See also my explanation for using CD for the current phase (you can, for example treat each attack is one phase, or one lifebar as one phase, or whatever).
    This might be optional if you can figure out phases with the default boss scene system, but that's really up to you to figure out.
  • (You might need to handle a package script as well? I'm not too sure if common data is reset when restarting a stage. If it isn't, you wouldn't need to necessarily handle a package, I believe. Please confirm this by yourself. I could be wrong on this one.)

    As for things I haven't done in S;G but you probably could do so for yourself:
  • You wouldn't be able to save functional replays unless you rewrite the replay system and create a new way of saving inputs and seeds and whatnot. Good luck on this one.
  • You can't restart music from a specific point in time unless you add the functionality for it to Danmakufu itself. The best you could do is just have it resume the music. (I assume you don't want to start over from the beginning every time you play a song?)

Well, good luck. i only gave a rather barebones outline of what you need to do, so don't be afraid to ask for clarification.

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1728 on: March 20, 2019, 12:26:13 am »
Oh, boy... Before I do answer this question, let me warn you, it is a huuuuge pain in the butt to do.

Oof, so I see.
Honestly I'm mostly trying to do StB/DS-type stuff where the spell restarts if you take a hit. So I'm more than willing to abandon saving the whole state and just clear everything out and go back to the beginning.

For now, I added something to my wait function so I can use common data to make it break out of whatever it's doing and essentially fall through to the bottom of the main task, then clear shots, move everything back to its original position, and start over.
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
  • LOOK AT ME
  • Nickname: Mewkyuu
  • Gender: Indeterminate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1729 on: March 21, 2019, 04:55:01 am »
Oof, so I see.
Honestly I'm mostly trying to do StB/DS-type stuff where the spell restarts if you take a hit. So I'm more than willing to abandon saving the whole state and just clear everything out and go back to the beginning.
Ah, uh, if you're making a Spell Card Collection-style or StB/DS-style thing where there's just one attack per scene, then you don't really need anything Pointdevice-like...? Merely restarting everything without regard for what happened at any previous point in time would be totally fine I believe.

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1730 on: March 24, 2019, 01:45:31 pm »
Ah, uh, if you're making a Spell Card Collection-style or StB/DS-style thing where there's just one attack per scene, then you don't really need anything Pointdevice-like...? Merely restarting everything without regard for what happened at any previous point in time would be totally fine I believe.
Well, yes. But cleaning everything up and restarting without actually reloading the script isn't trivial, either. When I tried to just have my main task return and call it again I was getting a bunch of weird lag. The way I have it now is essentially skipping to the bottom of the main task, spamming DeleteShotAll for a few frames, and resetting the score and graze, along with the boss' life/photos taken.

In any case, I'm not necessarily limiting it to just SCC-style stuff, but... well, it's more like several scenes like that chained together, so it's basically similar but with a little more information saved. I'm experimenting with extending photography-based gameplay beyond singles, basically.
« Last Edit: March 24, 2019, 01:47:44 pm by Andi »
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1731 on: March 24, 2019, 06:01:27 pm »
So I wound up reworking how I'm taking photos to use a primitive like what Drake posted, but I'm having a hard time getting clean edges when taking pics that overlap the edge of the stage frame. It's wrapping around and capturing stuff from the other side of the screen. My current workaround is drawing a sprite that covers up everything but the capture region, so any wraparound should in theory just be white, but it's having rather inconsistent results. Sometimes it works fine, other times it just doesn't block it at all, other times it blocks part of it but other parts get through. The parts getting through are always triangular, though may be cut off. (See attached screenshot for an example.)

Any suggestions for how to prevent this, or insight into how it might be happening?

I am rotating the primitive to capture a snapshot of it still, if that might have something to do with it.

E: This is pretty weird, actually. It's not just wrapping around to the other side of the stage frame like I thought - it's wrapping back around to somewhere nearby, from some oddball place and angle I don't understand the relation of. In the second attached screenshot you can see it captured the corner of another photo I had taken a moment before, and still see the previous photo in question in the process of fading out.
E2: At this point I've got it masking everything but the region I want to capture, but it sometimes wraps back around and captures part of the same region in that area that should be offscreen. (see third pic, in which Aya herself is visible in two different places in the photo.)
(Also, is there a way to put these pics in a collapsible or something to avoid cluttering up the thread too much?)
« Last Edit: March 25, 2019, 12:35:38 am by Andi »
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1732 on: March 25, 2019, 12:59:56 am »
Shouldn't this be entirely solved by drawing only the relevant layers onto the texture? The rest of the resulting texture should be transparent. I used 20 to 60 in my example but you would use whatever layers encompass the stuff in the play area you want to capture.

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

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
  • LOOK AT ME
  • Nickname: Mewkyuu
  • Gender: Indeterminate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1733 on: March 25, 2019, 03:42:12 am »
So I wound up reworking how I'm taking photos to use a primitive like what Drake posted, but I'm having a hard time getting clean edges when taking pics that overlap the edge of the stage frame. It's wrapping around and capturing stuff from the other side of the screen. My current workaround is drawing a sprite that covers up everything but the capture region, so any wraparound should in theory just be white, but it's having rather inconsistent results. Sometimes it works fine, other times it just doesn't block it at all, other times it blocks part of it but other parts get through. The parts getting through are always triangular, though may be cut off. (See attached screenshot for an example.)

Any suggestions for how to prevent this, or insight into how it might be happening?

I actually have like... 20? render targets, 10 for the regular images, another 10 for alpha masks. So nothing's rendered to an actual file in my own case. (Feel free to save files for your own system, maybe?)
So the idea is to keep a list of centers of your images and of the angles at which your viewfinder was tilted when the photo was taken.
So rendering that to an image, and then a white border on top of that, you'd have exactly what you'd see in the first image attached below.
I'd rather not render the entire image, so I use a primitive object with vertices placed where the corners of the viewfinder were located.
It seems you have something of a similar idea? I personally wouldn't rotate the image just to rotate it back again, though I might be totally derping out with my reading - if it turns out you didn't actually do so, then please ignore me lol.

As for what I did to make my photos fade to transparency -
I have a border covering the sidebar so that everything outside of the playing field is black, everything inside is white, and there's a sort of gradient in between just on the inside of the edge. I throw that into an alpha mask shader that interprets value/brightness as transparency. That way none of what's outside the playing screen is visible. See second image for an example.

Pictures of what I had, as mentioned before.
https://imgur.com/a/CdA3zsD

I'm not really as detailed in my explanation as I'd like to be, but honestly speaking it's been a while and looking at my own code now, well... It'd be a miracle to decipher it, even for myself...

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1734 on: March 25, 2019, 07:24:51 pm »
I personally wouldn't rotate the image just to rotate it back again, though I might be totally derping out with my reading - if it turns out you didn't actually do so, then please ignore me lol.
No no, that's exactly what I'm doing. It's because I want to save the decisive best shot for each scene but can only save a non-rotated rectangle.

So the idea is to keep a list of centers of your images and of the angles at which your viewfinder was tilted when the photo was taken.
So rendering that to an image, and then a white border on top of that, you'd have exactly what you'd see in the first image attached below.
I'd rather not render the entire image, so I use a primitive object with vertices placed where the corners of the viewfinder were located.
It seems you have something of a similar idea?
That is pretty much what I'm doing now, yes. Thing is, it's wrapping around weirdly and I don't know why.

As for what I did to make my photos fade to transparency -
I have a border covering the sidebar so that everything outside of the playing field is black, everything inside is white, and there's a sort of gradient in between just on the inside of the edge. I throw that into an alpha mask shader that interprets value/brightness as transparency. That way none of what's outside the playing screen is visible. See second image for an example.
That's pretty cool, I won't lie. I don't think it would solve my issue, though, since I'm only capturing layers that are inside the stage frame anyway.
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Aka Kyuketsuki

  • Team αlternative Σnding
  • Making it rain
  • Nickname: Akakyu
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1735 on: March 25, 2019, 07:57:48 pm »
I think it should work though. Applying a filter to a small image or a large image will do the same thing so don't worry about that. Save the one as a separate file or render target and apply it over your photo.

For reference, here's an image Chronojet used for applying to the STG frame as a transparency filter.

Andi

  • World's Gayest Danmaku
  • PlaySE("./se/Nyaa.wav");
  • LOOK AT ME
  • Nickname: AndiBanandi
  • Gender: Trans Girl Seeks Headpats
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1736 on: March 26, 2019, 11:34:06 pm »
I think it should work though. Applying a filter to a small image or a large image will do the same thing so don't worry about that. Save the one as a separate file or render target and apply it over your photo.

For reference, here's an image Chronojet used for applying to the STG frame as a transparency filter.
Ah... Now I see what you're suggesting. I suppose I could try that. Though, for the moment I'm more likely to just throw a white primitive on top of the part of the photo I want to blank out.

E: Ah, I found the problem. Turns out I'm just an idiot and wasn't covering up the stuff below the primitive other than the frame before saving the picture.
« Last Edit: March 27, 2019, 12:12:38 am by Andi »
Literally everything in this script will crash and burn.
1CC tracker
  • 2hu blog

Kinedyme

  • Dream Magic - Duplex Spark!
  • Nickname: Kine
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1737 on: April 03, 2019, 11:28:39 am »
Hi,
What does the ##ReplayName["string"] header in the player scripts do?
Thanks in advance

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1738 on: April 03, 2019, 09:22:01 pm »


The "NazrinA" here. It just serves as a player identifier for replays.

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

Kinghidrorah

  • Nickname: Guirauftuexalivhu
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1739 on: April 05, 2019, 07:15:27 am »
Hello everyone,

So I have been programming in danmakufu for a little while now and for my next script I would like to include my own type of shots. Unfortunately I am having a great deal of trouble doing this, for reasons that I cannot understand. So for example I would like to use the image attached as a bullet type (I haven't yet made the background transparent but I know how to do that so that's fine). I therefore created a shotsheet with

#UserShotData

shot = "./integ2.png"
delay_rect = (0,0,26,100)

ShotData{id = 450 rect=(0,0,26, 100) render=ALPHA angular_velocity = 0 delay_color= (255,255,255)}

(I understand that doing this would cause the bullet to have the same graphic during the delay period, but I thought danamakufu would dislike it if I didn't include the delay_rect line).

Then I created the shot constant sheet

local {
   let CSD = GetCurrentScriptDirectory;
   let path = CSD ~ "shotInteg.txt";
   LoadEnemyShotData(path);
}

let INT      = 450;

and when I try to make that bullet appear, nothing happens. There isn't even an object there since nothing kills me when I go to where it's supposed to spawn. WHat is the problem here?

PS: Sorry if this seems obvious to some of you, and maybe the solution is already somewhere in this forum. If so, could someone point me to it? Thanks in advance!
IF YOU DON'T ASK, YOU WILL NEVER GET.
 

SMF 2.0.15 | SMF © 2017, Simple Machines
Theme based on ModernDark64 design by BlocWeb
Page created in 0.061 seconds with 42 queries.