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

0 Members and 3 Guests 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 ウサホリ -

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 ウサホリ -

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:
  • Helepolis' Siege Workshop

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 ウサホリ -

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 ウサホリ -

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 ウサホリ -

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: Today at 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.

 

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