Author Topic: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry  (Read 268563 times)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #390 on: February 25, 2015, 08:25:02 PM »
I guess I will have to try that out before I adapt to movement functions.

-- --

A different question regarding Enemies. I've studied the Wiki if there were any specific functions to grant the enemy a specific parameter. Like mark the enemy as a familiar / slave so certain homing functions don't home in on the EnemyID. I was initially thinking of creating my own array with EnemyIDs from those who are familiars. But if there is a parameter to be given to the enemy, it would be better. Bit like in 0.12m where you could specify GetArgument.

Shadow

  • Forever waiting for tomorrow
  • ...
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #391 on: February 26, 2015, 01:04:30 AM »
Unless I'm misinterpreting your question, I believe Obj_SetValue and Obj_GetValue would be what you're looking for.

Aka Kyuketsuki

  • Team αlternative Σnding
  • Making it rain
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #392 on: February 26, 2015, 02:00:42 PM »
Hi ! I wanted to ask :
Is there a way to make each bullets (ObjShot) which have spawned at different frames change their speed at the same frame ? And how please ?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #393 on: February 26, 2015, 03:31:10 PM »
Hi ! I wanted to ask :
Is there a way to make each bullets (ObjShot) which have spawned at different frames change their speed at the same frame ? And how please ?

Dump them into an array and then when you want them to change their speed, iterate through the array and use Obj_SetSpeed

Alternatively, count how many frames are passing between their spawn times and use ObjMove_AddPattern with a speed shift, but set the frame parameter in such a way that they all change at the same time.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #394 on: February 26, 2015, 05:08:30 PM »
Unless I'm misinterpreting your question, I believe Obj_SetValue and Obj_GetValue would be what you're looking for.
. . . . .  :derp: :derp: :derp: :derp:

Right, I totally forgot about this function while I've spotted it few weeks ago. Though how the hell did I miss it on Wiki  :o

Thanks!

Aka Kyuketsuki

  • Team αlternative Σnding
  • Making it rain
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #395 on: February 26, 2015, 06:41:50 PM »
Quote
Dump them into an array and then when you want them to change their speed, iterate through the array and use Obj_SetSpeed

Alternatively, count how many frames are passing between their spawn times and use ObjMove_AddPattern with a speed shift, but set the frame parameter in such a way that they all change at the same time.

Since I'm not very good with arrays, the second method seems to work best for me, thank you !  :3

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #396 on: February 26, 2015, 09:31:58 PM »
Since I'm not very good with arrays, the second method seems to work best for me, thank you !  :3

You're welcome.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #397 on: February 26, 2015, 09:32:06 PM »
Hi! I have some questions about the item functions.
I want to create some power item. So i use CreateItemA2 (there are created at the player's death) with something like that:
Code: [Select]
CreateItemA2(ITEM_POWER, GetPlayerX, GetPlayerY, GetPlayerX+90*cos(adest), GetPlayerY-ydest+24*sin(adest), 100);(adest & ydest are variable used to set the final item position).

I get some beautiful power item but without any effect on the Player poser value. Same thing with 1UP items (and BOMBS item I guess...).
How this thing works? What I doing wrong/notdoing?

I see I can use user defined item or item script but I dont even know hom I'm supposed to use this.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #398 on: February 26, 2015, 09:48:48 PM »
Hi! I have some questions about the item functions.
I want to create some power item. So i use CreateItemA2 (there are created at the player's death) with something like that:
Code: [Select]
CreateItemA2(ITEM_POWER, GetPlayerX, GetPlayerY, GetPlayerX+90*cos(adest), GetPlayerY-ydest+24*sin(adest), 100);(adest & ydest are variable used to set the final item position).

I get some beautiful power item but without any effect on the Player poser value. Same thing with 1UP items (and BOMBS item I guess...).
How this thing works? What I doing wrong/notdoing?

I see I can use user defined item or item script but I dont even know hom I'm supposed to use this.

You have to manually set the power yourself. In your item script, have power items increase power when they are collected by the player.

In EV_GET_ITEM if the @Event of your item script, GetEventArgument(0) is the Item ID. You can use this in an if statement to set power/lives/bombs.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #399 on: February 26, 2015, 10:25:07 PM »
I see. It works now . Thank you :)

And always about item, I see in many scripts bullets turned into custom item and not in default star-item (without changing the default star-item sprite). I search a bit but I don't understand how to do this.

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #400 on: February 27, 2015, 12:45:51 AM »
First of all, you can use the function SetDefaultBonusItemEnable(false) in your item script's @Initialize to disable the star items.

To throw in your own behaviour, there's the event EV_DELETE_SHOT_TO_ITEM that triggers when bullets are itemized. GetEventArgument(0) will give you the shot object's ID, and GetEventArgument(1) will give you the position it's at. So you can just spawn a new item at that position.

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


Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #402 on: February 28, 2015, 05:21:27 PM »
Sorry for double post but I have a strange issue with CreateStraightLaserA1.

This warning laser is always glitched and sometime juste dont spawn (but the laser spawn well and surpise-kill the player).
Code: [Select]
if(frame == 7) {
SE(laser02_path);
CreateStraightLaserA1(ex, ey, A+1, 800, 20, 80, C_LASER_RED, 60);
A += alt*360/(64);
}
if(frame == 8) {
SE(shot01_path);
CreateStraightLaserA1(ex, ey, A+1, 800, 20, 80, C_LASER_RED, 60);
Laser01(ex, ey, 4, A+5, 180, 24, LIGHTNING_RED, 30);
frame = 6;
A += alt*360/(56);
if((|A|) >= 360) {
alt = -1*alt;
A = 0;
frame = -360+20*step;
step++;
if(step > 6) {step = 6;}
ObjMove_SetDestAtSpeed(objBoss, rand(60,260), rand(60,130), 1.5);
}
}
This is the laser's part of the script. It's the same laser as the others but it is the only one that does not work properly. Why?

(my english is very bad today... I hope I'm at least understandable...)

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #403 on: February 28, 2015, 07:03:36 PM »
If you are talking about the fact that the delay laser does not render the way you want it to, that's not a bug - that's just a rendering issue with Danmakufu and all you can do is have more delay lasers or increase the width of the laser

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #404 on: February 28, 2015, 09:43:17 PM »
So it just another danmakufu joke ok. Thank you  :)

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #405 on: February 28, 2015, 10:29:43 PM »
So it just another danmakufu joke ok. Thank you  :)

If you're talking about the upper right hand corner, with no lasers, that's your code, on the other hand.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #406 on: March 01, 2015, 10:52:06 AM »
If you're talking about the upper right hand corner, with no lasers, that's your code, on the other hand.
Nope. I just take the screenshot before the upper right hand corner's laser spawn ;).

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #407 on: March 06, 2015, 12:33:36 AM »
How are numbers stored in Danmakufu? It seems to store them as doubles, but surprisingly (0.1 + 0.2 - 0.3) * 10^16 returns zero.
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #408 on: March 06, 2015, 11:05:07 AM »
How are numbers stored in Danmakufu? It seems to store them as doubles, but surprisingly (0.1 + 0.2 - 0.3) * 10^16 returns zero.

Shouldn't it? 0.1 + 0.2 - 0.3 is equal to zero, so your equation is basically multiplying 0 with 10 quadrillion.

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #409 on: March 06, 2015, 02:09:55 PM »
JmLyan:
http://en.wikipedia.org/wiki/Floating_point
http://stackoverflow.com/questions/588004/is-floating-point-math-broken


Anyways, they're definitely doubles, but the intriguing bit is how it gets from numbers in the script to the actual representation. 0.3 is actually not represented by the closest approximation, but rather it's that 0.3 = 0.30000000000000004 (0x3FD3333333333334). Meanwhile if you try to explicitly store 0.30000000000000004 you get 0.30000000000000010 (0x3FD3333333333335). If you play around with the LSBs you'll notice that it rounds (I call it "shoving" since it forces rounding even when the value written in script has an existing binary rep) towards ?∞, which by coincidence overcomes that popular example (since it's an issue of rounding to nearest). This itself isn't anything to be concerned about.

For a different example,  -0.3+0.1 != -0.2. When you take into account the shoving it makes it a bit clearer:
-0.3 -> -0.30000000000000004 (shoves to -∞)
0.1 -> 0.10000000000000001 (shoves to +∞)
-0.3+0.1 -> -0.20000000000000004
Which is correct calculation since -0.3 -> -0.30000000000000004. Now since -0.2 == -0.20000000000000001 (not ~04), they won't be equal.

Strange things happen because of the shoving now, like 0.1 != 0.10000000000000001 because 0.10000000000000001 written in script is shoved to 0.10000000000000002.
This then leads to -0.3+0.10000000000000001 == -0.2 (despite -0.3+0.1 != -0.2), since when shoving all these you get
-0.30000000000000004 + 0.10000000000000002 == -0.20000000000000001, which is true.

Its internally consistent, since once the values are in memory it works like it should. You shouldn't be relying on testing non-integer values for precise equality anyways (integers work perfectly fine, though), so really this whole thing should never be an issue anywhere to begin with.
« Last Edit: March 06, 2015, 02:24:17 PM by Drake »

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #410 on: March 06, 2015, 05:30:42 PM »
Hi!
I have some serious FPS drop in my current script  (and in all my script -_-) but I don't really know why except that I'm not a good scripter.
So, what can be the possible main sources of heavy FPS drop and what are things to do or not do to avoid this kind of issues? Most scripteur here do awesome things whitout lag so I have to do something wrong :/
I'm a bit desperate...

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #411 on: March 06, 2015, 06:59:04 PM »
Hi!
I have some serious FPS drop in my current script  (and in all my script -_-) but I don't really know why except that I'm not a good scripter.
So, what can be the possible main sources of heavy FPS drop and what are things to do or not do to avoid this kind of issues? Most scripteur here do awesome things whitout lag so I have to do something wrong :/
I'm a bit desperate...

You'll need someone with experience to fully optimize your code...

Anyways... check loops. How often are you doing math? How much ADD/SUBTRACT/MULTIPLY/SHADOW/INVERT_DESTRGB are you using?

Open the log window. Are you deleting all of your floating background objects once they leave the screen? Are you properly removing all of your unneeded resources? How many instances of a certain graphic are there?

If it's across your entire script, then you may have to do some serious fixing.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #412 on: March 06, 2015, 09:46:04 PM »
Hi!
I have some serious FPS drop in my current script  (and in all my script -_-) but I don't really know why except that I'm not a good scripter.
So, what can be the possible main sources of heavy FPS drop and what are things to do or not do to avoid this kind of issues? Most scripteur here do awesome things whitout lag so I have to do something wrong :/
I'm a bit desperate...
To expand and explain Sparen's post:
- First, open your LogWindow (if you don't have it, activate it from the config.exe)
- Breakdown your script into parts. What do we first want? Movement ? Bullets ?
- If you did the task-based approach you'll have your life easier, otherwise good luck...
- Comment out everything first.

Begin iteration:
1 - Launch the game and check how many objects/script tasks are running.
2 - Uncomment bits of parts > Test > monitor the FPS and log window. How many objects are made? What is the script task count etc etc
3 - Hold the ALT key to fast forward the game bit then monitor again.
4a - If your script is stable and no FPS drop happens > uncomment the next bit again.
OR
4b - If your script lags, you know where it happens. Start checking the code

Your comments and uncomments should be suspected things like: Effects, bullet patterns, Object based things.

Once you found which part lags, you can easier trace down what is happening.

Good luck.

Edit: The same applies to included scripts and such. What ever you're running you need to start from 0 then slowly uncomment things and test with each time. Don't uncomment huge blocks of code or you'll get lost.

Edit 2: I think I've seen you before using the @MainLoop based method for scripting. Yea, that is going to be trickier to comment/uncomment in general.
« Last Edit: March 06, 2015, 09:48:47 PM by Helepolis »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #413 on: March 07, 2015, 11:18:20 AM »
Thank you. I start to do what you say Helepolis and I notice some things that bring me two new questions:

- I use a general task to load all the textures and sound at the beginning of my stage script but... it load the texture for all the scripts that will be called later (like boss scripts, item scripts, system script, etc) or it load the texture for this script only? I use the Texture part of the log windows and I see texture that appear several times. But I'm not sure if there are loaded texture of used texture...
However if textures are preloaded only in one script it can be one of the main fps drop source.

- It seem that sound object add fpsdrop in some case. I use a task like that to do sound effect but I'm not sure it's the best thing to do:
Code: [Select]
task SE(path) {
      let obj = ObjSound_Create;
ObjSound_SetSoundDivision(obj,SOUND_SE);
      ObjSound_Load(obj,path);
      ObjSound_Play(obj);
      ObjSound_SetVolumeRate(obj,100);
    loop(400) {yield;}
Obj_Delete(obj);
}

Quote from: sparen
If it's across your entire script, then you may have to do some serious fixing.
On my computer it run at 60 fps all the time exept in some case like when I use a bomb or when a spellcard is declared. But on other's computer it seem to run at ~50 fps all the time (like on your's if I trust your RaNGE video of my entry). It's a bit hard to know if it really fixed or not :/


Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #414 on: March 07, 2015, 03:57:58 PM »
- It seem that sound object add fpsdrop in some case. I use a task like that to do sound effect but I'm not sure it's the best thing to do:
Code: [Select]
task SE(path) {
      let obj = ObjSound_Create;
ObjSound_SetSoundDivision(obj,SOUND_SE);
      ObjSound_Load(obj,path);
      ObjSound_Play(obj);
      ObjSound_SetVolumeRate(obj,100);
    loop(400) {yield;}
Obj_Delete(obj);
}

What is the loop(400){yield;} for? Use something closer to the following:

Code: [Select]
function SE(path) {
      let obj = ObjSound_Create;
ObjSound_SetSoundDivision(obj,SOUND_SE);
      ObjSound_Load(obj,path);
      ObjSound_Play(obj);
      ObjSound_SetVolumeRate(obj,100);
        return obj;
}

Run this once per sound effect, and then use ObjSound_Play(returned value);

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #415 on: March 07, 2015, 04:40:54 PM »
To be clear, Sparen means to create and load a Sound object only once, and then use that object every time you want to play that sound. You only need one object, and then you can play it as many times as you want. The flow might look something like this:


Code: [Select]
let SE_SHOT;
let SE_CHARGE;

function LoadSE(path) {  // Returns a Sound object that plays the given file
let obj = ObjSound_Create();
ObjSound_SetSoundDivision(obj, SOUND_SE);
ObjSound_Load(obj, path);
ObjSound_SetVolumeRate(obj, 100);
return obj;
}

@Initialize{
SE_SHOT = LoadSE(dir ~ "shot.wav");
SE_CHARGE = LoadSE(dir ~ "charge.wav");
}

task TPattern(){
loop{
ObjSound_Play(SE_CHARGE);
loop(60){yield;}
loop(60){
ShootBullets();
ObjSound_Play(SE_SHOT);
yield;
}
loop(240){yield;}
}
}


The only thing is that using one sound object means playing a sound when it's already playing will restart it, so if for whatever reason you want the sound to overlap itself you'll need one or two more sound objects.


- I use a general task to load all the textures and sound at the beginning of my stage script but... it load the texture for all the scripts that will be called later (like boss scripts, item scripts, system script, etc) or it load the texture for this script only? I use the Texture part of the log windows and I see texture that appear several times. But I'm not sure if there are loaded texture of used texture...
If you're seeing textures with the same (full) name but at different addresses, something isn't right. The number of different places that the texture is being used is under the Ref column, so that's what should be increasing.
« Last Edit: March 07, 2015, 04:58:53 PM by Drake »

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #416 on: March 09, 2015, 10:08:23 PM »
I don't know I can do that with Sound Object. It's cool and it orevent so many Object creation. Thank you both.

Quote
If you're seeing textures with the same (full) name but at different addresses, something isn't right. The number of different places that the texture is being used is under the Ref column, so that's what should be increasing.
Thanks, thanks and thanks again. I found my main problem whit that. I fail my texture/sound load and it load I don't know what at the beginning and load the use thing when it is used... everytime).
You save me.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #417 on: March 10, 2015, 07:37:28 PM »
Is in ph3 some "event_script{} " like in 0.12m.
I want to make dialogue?or schould I do all this stuff with Prim-objects or graphic?  :V

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #418 on: March 10, 2015, 08:14:57 PM »
Is in ph3 some "event_script{} " like in 0.12m.
I want to make dialogue?or schould I do all this stuff with Prim-objects or graphic?  :V

You can use text objects.
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #419 on: March 10, 2015, 08:18:50 PM »
Is in ph3 some "event_script{} " like in 0.12m.
I want to make dialogue?or schould I do all this stuff with Prim-objects or graphic?  :V

You can use text objects.

If you decide not to make your own, some people have released their own libraries for this. DO NOTE, HOWEVER: not everyone will let you use their libraries, because we have spent many hours making and testing, and seeing someone use a library this complex without permission is going to make some of us angry

If you decide to make your own, take into account using your own font as well as using virtual key functions to see if the player has pressed the Z button. Also aim for good readability.