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

TalosMistake

  • Master of Aura and Shade
  • I'm Talos, not Talo~~
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #30 on: February 18, 2016, 09:13:28 AM »
What are the easiest Touhou bosses to replicate, or base on, in Danmakufu?

Cirno.
Just follow Helepolis tutorial. Very easy xD

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #31 on: February 18, 2016, 01:20:21 PM »
Depends on what you mean by 'base on' or 'replicate', as well as the general availability of graphical assets. This question is extremely broad, but characters with simpler danmaku (Stage 1-2 bosses) without custom graphics (IE not Nazrin) tend to be less of a logistical hassle. It is for this reason that Rumia used to be one of the most commonly used bosses in early scripts.

Hmm... Rumia seems to be a good option. I'll try to replicate her boss battle, maybe add some new spells.

Cirno.
Just follow Helepolis tutorial. Very easy xD

Well, she DOES use pretty simple patterns, and to top it all off, there is indeed the Helepolis tutorial...
...At this rate, I'm going to recreate the entire EoSD...
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #32 on: February 18, 2016, 06:34:49 PM »
I'm sure you'll have trouble replicating Patchouli I guess :V

And then there's also Meiling's 1st spell which is probably the most confusing to replicate...

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #33 on: February 18, 2016, 07:41:44 PM »
...At this rate, I'm going to recreate the entire EoSD...
If you're aiming to practice making patterns, EoSD is honestly a good game to replicate patterns from. The majority of bullet patterns in EoSD are relatively basic, probably due to ZUN's relative inexperience in pattern making. The only big part that really comes to mind as difficult to replicate would be Sakuya's spellcards, as those rely on a mechanic that's by default absent from Danmakufu Ph3: the time stop. A few other hard ones like Kagome Kagome, Laevateinn, and maybe Royal Flare come to mind, but they aren't very numerous and limited mostly to the extra stage.

Edit: That said, many older PC-98 patterns might be even more simple so that's not a bad option either.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #34 on: February 18, 2016, 09:48:25 PM »
But can't you simulate time stop by stopping the pellets / knives and using SetPlayerSpeed(0, 0);, and if possible get the player speed before "stopping time"?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #35 on: February 18, 2016, 10:15:55 PM »
But can't you simulate time stop by stopping the pellets / knives and using SetPlayerSpeed(0, 0);, and if possible get the player speed before "stopping time"?

Yes you can. But manually 'stopping time' is a major hassle that involves communicating between different scripts and large-scale array accesses. Additionally, like with Python's Artifact 3, it's a royal pain to debug because everything must be restored if the boss attack is cleared during timestop (which caused his player speed and forbid shot/spell to be disabled for the rest of the game until he fixed it).

There are ways to do it but there is no one *good* way.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #36 on: February 19, 2016, 12:13:08 AM »
And that's why you don't hand your stopwatch to a fox.

Oh...

Also, would it be bad if you defined the player speed on @Initialize of the first script knowing that your script lets you choose any player you have?

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #37 on: February 19, 2016, 12:49:13 AM »
Hello there folks,

I'm stuck with the attempt to make a 3D render of the red circle that spins around the boss:
http://pastebin.com/M12w2ZuA

I went with creating a 3D-sprite of the graphic first and applying its properties, including positioning it right at the boss' coordinates.
However, the graphic is rendered at a completely different place than the boss sprite, although still moving at exactly the same speed and in the same direction as the boss does.
I've already tried a number of things with the destination rectangle and the x,y-coordinates, but the circle doesn't position itself right at the boss.

That all worked just fine for the 2D-sprite version of it.

Anyone's got an idea?
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #38 on: February 19, 2016, 08:00:38 AM »
Well, you're both pointing out the problem and the answer slightly yourself :V 

You're using a regular render function to mutate a 3D sprite object. The coordinates of a 3D sprite are based on the XYZ of the danmakufu 3D space and the 2D sprites are based on the game field, except when you set the Layer 80+ (or 0.8 if you're using the regular one), which then the entire window of the program become the coordinates. To clarify:

Let us say your game field is X: 200 and Y: 400. You decide to centre your boss using your own GetCenterX / GetCenterY code (Which is field / 2). The boss X,Y position is 100,200. Imagine we try to draw a texture/sprite on Layer 80 using the same functions. We have to keep in mind that our Danmakufu window is by default 640x480. Drawing our texture and giving the GetCenterX/Y will put it at 320,240. Because after all, that is the centre of the whole window. Obviously this won't align with the boss, as they are calculating their coordinates differently. But what if we put our texture on Layer 30? Suddenly, it will align proper, as both are calculating the centre based on the play field.

The same story goes for 3D, except more complicated when you're involving the camera. First of all, 3D coordinates of danmakufu are fixed. If you put something at 0,0,0 in 3D space and you put your camera -256 on the X-axis, your sprite will be off-centre for you, but in terms of code it is still located 0,0,0.

TL DR: You don't want to mix 2D ad 3D to align things because generally it will be a hassle regardless.

Is it an aesthetic thing you wish to put your magic circle in 3D? The 2D sprite allows X Y Z angling as well. Or you think that looks a bit too "thin paper"?

Alternative solution I can offer you is a Mesh object. Because it takes the function: ObjMesh_SetCoordinate2D(obj,boolean);  http://dmf.shrinemaiden.org/wiki/Mesh_Object_Functions#ObjMesh_SetCoordinate2D which then allows you to use 2D coordinates. Had similar issue with my Tewi Mochi hammer in my game. So what you need to do is:
- Make a flat mesh object in a 3D modelling program.
- Texture it with the magic circle
- Summon it in your script using the mesh functons
- Set the ObjMesh_SetCoordinate2D to true.
- Continue further using regular ObjRender functions.

Either use 2D sprite and angle it X Y Z giving it that "3D-ish" feeling. Or use the Mesh trick.

Edit note: explaining more added to original post.
« Last Edit: February 19, 2016, 10:42:30 AM by Helepolis »

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #39 on: February 19, 2016, 11:14:17 AM »
Well, you're both pointing out the problem and the answer slightly yourself :V 

You're using a regular render function to mutate a 3D sprite object. The coordinates of a 3D sprite are based on the XYZ of the danmakufu 3D space and the 2D sprites are based on the game field, except when you set the Layer 80+ (or 0.8 if you're using the regular one), which then the entire window of the program become the coordinates. To clarify:

Let us say your game field is X: 200 and Y: 400. You decide to centre your boss using your own GetCenterX / GetCenterY code (Which is field / 2). The boss X,Y position is 100,200. Imagine we try to draw a texture/sprite on Layer 80 using the same functions. We have to keep in mind that our Danmakufu window is by default 640x480. Drawing our texture and giving the GetCenterX/Y will put it at 320,240. Because after all, that is the centre of the whole window. Obviously this won't align with the boss, as they are calculating their coordinates differently. But what if we put our texture on Layer 30? Suddenly, it will align proper, as both are calculating the centre based on the play field.

The same story goes for 3D, except more complicated when you're involving the camera. First of all, 3D coordinates of danmakufu are fixed. If you put something at 0,0,0 in 3D space and you put your camera -256 on the X-axis, your sprite will be off-centre for you, but in terms of code it is still located 0,0,0.

TL DR: You don't want to mix 2D ad 3D to align things because generally it will be a hassle regardless.

Is it an aesthetic thing you wish to put your magic circle in 3D? The 2D sprite allows X Y Z angling as well. Or you think that looks a bit too "thin paper"?

Edit note: explaining more added to original post.

Whoops, totally forgot that the 3D objects are affected by the camera angles and position  :V
Considering that, I adjusted the camera settings and it works well by now. Currently fiddling around with the background graphics, but that's ok.

Yep, it's just an aesthetic thing, I guess I like the 'real' 3D rendition a bit too much (damn I'm way too picky with stuff).

Thanks!  :D
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #40 on: February 19, 2016, 01:59:20 PM »
3D Sprite objects are essentially made for background use (as should be obvious now). There shouldn't really be any difference between rotating a 2D Sprite object and a 3D one as far as I'm aware; is there a reason you switched when you could spin around the previous one just the same? As it is you might also get background interference/clipping.

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

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #41 on: February 19, 2016, 04:59:45 PM »
3D Sprite objects are essentially made for background use (as should be obvious now). There shouldn't really be any difference between rotating a 2D Sprite object and a 3D one as far as I'm aware; is there a reason you switched when you could spin around the previous one just the same? As it is you might also get background interference/clipping.

I'm aware of that. Rotating does work identically on both 2D and 3D, it's the position of the graphic that initially confused me when I switched. As its movement is tied to that of the boss, I have adjusted the camera's position to project it right behind the boss sprite, which didn't actually essentially affect the background in my case, aside from the change of perspective.

I switched to 3D because of aesthetic reasons, and wanted to try out something new  :3
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #42 on: February 19, 2016, 06:33:21 PM »
How do you put quotation marks inside strings?
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #43 on: February 19, 2016, 07:44:07 PM »
How do you put quotation marks inside strings?

You put a \ before the quotation marks that should be part of the string, like this:
Code: [Select]
let name = "Something Sign \"Something Something\"";
Is it possible to put square brackets inside a string without the spaces between the brackets being removed?
« Last Edit: February 19, 2016, 07:48:01 PM by Badz »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #44 on: February 19, 2016, 07:44:41 PM »
How do you put quotation marks inside strings?

\" or "

The former uses the escape character, while the latter uses the ISO SGML standard (the HTML and the like)

More info: http://sparen.github.io/ph3tutorials/ph3u1l4.html#sub8
Documentation: http://www.geocities.co.jp/SiliconValley-Oakland/9951/pre/th_dnh_help_v3.html
« Last Edit: February 19, 2016, 07:46:23 PM by Sparen »

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #45 on: February 20, 2016, 01:36:19 AM »
How do you put quotation marks inside strings?
Simply typing this inside a string also works:

Code: [Select]
"
EDIT: Could have sworn Sparen's post didn't mention that, oops.
« Last Edit: February 20, 2016, 04:29:06 AM by ExPorygon »

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #46 on: February 20, 2016, 09:08:07 AM »
How much damage should a player do? I mean for the most used shot types.
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #47 on: February 20, 2016, 12:29:03 PM »
It depend of how life the scripters give to their bosses. Personnally I give arround 1500~2000 for the nonspells and 2000~3000 for the spells. And I use players with ~200-300 dps.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #48 on: February 20, 2016, 12:39:21 PM »
I personally give 3500 HP for spells and nonspells for my bosses. The only exception is when I decide to make a spell with more patterns, that kind of spell usually falls on 6000 HP.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #49 on: February 20, 2016, 03:52:20 PM »
How much damage should a player do? I mean for the most used shot types.

As has been said above, it depends on the life and Damage Rate of your bosses and stage enemies.

There is, however, a standard DPS range that should be obeyed if you want your players to be usable in other people's scripts. The Random Player Generator, Mr. Blue's Reimu, and a large number of other players fall in this range - as Lefkada said, it's typically the 200-300 DPS range.

My Artifact 2 Marisa uses the following:
Unfocused Shot:
-Damage: ~300 DPS
Focused Shot:
-Damage: ~282 DPS

There are a number of Player DPS testing scripts.

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #50 on: February 20, 2016, 04:15:41 PM »
Ok, thanks.
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #51 on: February 24, 2016, 05:43:14 PM »
How do you spawn a 2D sprite and keep updating its position and/or angle every frame without creating a new one every time (For example, a magic circle on a boss object)?
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #52 on: February 24, 2016, 06:24:32 PM »
I'm confused. How are you even putting the sprite somewhere without using the functions that you'd use to update its position? Are you actually using SetDestRect to draw the sprite at some position?

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #53 on: February 24, 2016, 07:02:13 PM »
I guess I should've been more clear...
I'm trying to create a magic circle, that would spin and follow the boss. The problem is, it never actually spins, or follows the boss at all.
To clear some things out, I put the function in @Initialize, but the function itself is placed in a different file than the main script, along with many other functions. spin++ is in the main file, in @MainLoop though. X and Y are boss' coordinates.

This is my code (It's a bit messy):

Code: [Select]
function MagicCircle(x, y){
let eff = CSD ~ "// Image Folder.";
let spin = 0;

let obj = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(obj, eff);
ObjSprite2D_SetSourceRect(obj, 0,255,255,292);
ObjSprite2D_SetDestRect(obj, 0,0,256,45);
Obj_SetRenderPriorityI(obj, 21);
ObjRender_SetX(obj, x);
ObjRender_SetY(obj, y);
ObjRender_SetScaleXYZ(obj, 1, 1, 0);
ObjRender_SetAngleXYZ(obj, 0, 0, spin);
}
« Last Edit: February 24, 2016, 07:04:26 PM by iVAwalys »
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #54 on: February 24, 2016, 07:51:24 PM »
Putting spin++ in another script (or even outside of your MagicCircle function) won't affect the spin variable inside of the function.

Are you aware of how tasks work? That's how you would get this done, and more generally how you do any kind of "update" loop. Besides this, you'll want to grab the boss' object ID so that you can keep getting its current position.

Code: [Select]
task MagicCircle(){ // note `task` and no params needed
let eff = CSD ~ "// Image Folder.";
let spin = 0;

let objEnemy = GetEnemyBossObjectID()[0]; // if you've defined the boss' object ID globally already you don't need this
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
// the other setup

while(!Obj_IsDeleted(objEnemy)){ // update loop runs until enemy object is deleted
ObjRender_SetPosition(obj, ObjMove_GetX(objEnemy), ObjMove_GetY(objEnemy), 0);
ObjRender_SetAngleXYZ(obj, 0, 0, spin);
spin++;
yield; // stops this task from running until next frame
}
}

(Note that constructing the magic circle this way might have some unwanted effects, but if this works for you then good enough.)

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #55 on: February 24, 2016, 08:24:55 PM »
Argh, I knew it had something to do with while(!Obj_IsDeleted), but I forgot about yield;  :V
...Anyway, thank you very much!
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #56 on: February 25, 2016, 08:38:43 AM »
Adding the following as information for beginners (or people who didn't know):

As a general design rule, you can be for sure that any update-per-frame or behaviour-per-frame for an object involves a while(<statement>) { } loop. The Obj_IsDeleted(obj); is a function which returns a boolean value whether the object is alive or not. Don't confuse it with Obj_Delete(obj); (notice how there is no 'is') which actually deletes the object. The Obj_IsDeleted asks Danmakufu: "Is my object deleted?". And Danmakufu will return you a true/false.

The exclamation mark '!' in front of the function reverses the result of the statement. This is important because if you don't, the while loop statement results in a 'false' and will exit immediately. Remember, the statement needs to result in 'true' to keep it looping. If the object is alive and you ask Danmakufu with the function, it tells you: "Nope, it is not deleted yo."

This is how it would 'translate' if you didn't or did use the exclamation mark:
Code: [Select]
while(Obj_IsDeleted(obj)) -> results in: while(false)  -> Conclusion: Immediate exit loop.

while(!Obj_IsDeleted(obj)) -> results in: while(!false) -> Because of exclamation mark, the result is reversed -> becomes: while(true) -> Conclusion: keep looping.

Thus your while loop stays alive and you can do anything per-frame (update position, change size, morph the colour, etc). Don't forget to yield; your loop once, otherwise your game will freeze.

Beginners might be often using this too:
Code: [Select]
while(Obj_IsDeleted(obj) == false) -> results in: while(false == false) which is 'true' -> while(true) -> Conclusion: Continue looping. It is perfectly legal, but people don't use it for tons of reasons. Not going to go into a debate of 'How To Write Clean Code'.
« Last Edit: February 25, 2016, 09:42:46 AM by Helepolis »

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #57 on: February 25, 2016, 04:14:56 PM »
Im trying to #include some stuff :

Code: [Select]
#include "script/"scriptname"/commonLoad.txt"
But the script that I want to include this library is inside a different folder:

Code: [Select]
"script/"scriptname"/data/boss/N1"

I usually fix it using an absolute path, but now I want to change the script name folder. Can someone help me?
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #58 on: February 25, 2016, 04:39:39 PM »
Im trying to #include some stuff :

Code: [Select]
#include "script/"scriptname"/commonLoad.txt"
But the script that I want to include this library is inside a different folder:

Code: [Select]
"script/"scriptname"/data/boss/N1"
I usually fix it using an absolute path, but now I want to change the script name folder. Can someone help me?

You can use relative paths (./../ for the previous folder, for example) to move around the directories. For more information, please use Helepolis's Paths and Directories Guide

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #59 on: February 25, 2016, 05:04:55 PM »
Ok it works now. Thanks.
Also, how often do you carry out (perform, do, make... ) the RaNGE contest?
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.