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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #180 on: November 23, 2014, 07:16:05 PM »
The error message exactly reports what seems wrong. Before I'm going to spoil you the solution, I'm going to ask you to read and check very very carefully up to line #10.

You'll probably face palm when you see it.  :V

Edit: I can understand your confusion for this error message but I'll explain that once you detected your mistake.
« Last Edit: November 23, 2014, 07:18:44 PM by Helepolis »

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #181 on: November 24, 2014, 12:56:16 PM »
You'll probably face palm when you see it.  :V

Facepalm indeed :V

It's all about precision, that error was actually quite, if not too obvious.
Now the script runs perfectly. With the sound effects.
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: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #182 on: November 24, 2014, 06:13:56 PM »
Glad you discovered it.  ;)

You see, I am not sure if you have the latest ph3 version, but it reports English Error message as well.

Code: [Select]
Unable to be interpreted (Don't forget ";"s).
(解釈できないものがあります(「;」を忘れていませんか))
F:/Touhou project/th_dcs_ph3/script/thdcs/test.txt
test.txt line(行)=15

The only confusion here might be the line nummer. Basically the script runs up to that line and crashes. Thus you have to backtrack a little. Not often seen because usually the error msg line # points at correct lines. Lucky for you, your script was small so easier to find.

Always look out for syntax errors (forgetting or misplaced () [] {} ; etc etc.)


Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #183 on: November 24, 2014, 07:50:58 PM »
Yeah, overseeing tiny but important errors is quite a hardship for me as a novice in programming, but I'm confident that I'll get used to it and find out typing/syntax errors more easily. :)
By the way, I would like to ask how to implement objects into the script other than the boss and the bullets, for example the red spell circle, and make them rotate. I already took several attempts with using various Object-functions which don't seem to work, as Danmakufu either freezes or spawns an(other) syntax or (abc)-is-not-defined error.  :fail:

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: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #184 on: December 03, 2014, 08:52:06 PM »
Hi!

Is someone know what is the "check" at the stg intertion_count line in the LogWindow?


I have some heavy frame drop even doing nothing and it's the only value that increase constantly. If I kill enemies or if I move the player this value decrease or return to zero.
And there is no lag when it's at zero.
It's seems there is not problem with this when I comment the ObjEnemy_SetIntersectionCircleToPlayer.

I really don't know how it is and how it work  ???

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #185 on: December 03, 2014, 09:53:52 PM »
It's seems there is not problem with this when I comment the ObjEnemy_SetIntersectionCircleToPlayer.

Then there's the issue. How many times do you call ObjEnemy_SetIntersectionCircleToPlayer per frame? How many hitboxes are there?

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #186 on: December 03, 2014, 10:10:52 PM »
One ObjEnemy_SetIntersectionCircleToPlayer per enemy with 36 enemy.
I kown that's the source of the lag but... why? and why it's drop to zero even if I don't kill all the enemies? And if it's called 36 time per frame why it cause lag after a while and not at the start?

It's not really the issue that I don't understand but how this thing works.

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #187 on: December 03, 2014, 10:56:26 PM »
The check count is just the number of new collision checks being performed. These don't have to be collision to player either (although in this case the player collisions are the problematic ones).

The problem is that your enemies are doing something that starts the collision checks and they aren't being stopped/removed. Just pastebin your script; you should be doing that from the start.
« Last Edit: December 03, 2014, 11:00:38 PM by Drake »

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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #188 on: December 04, 2014, 08:28:43 AM »
Unrelated to the user's problem: That new check is going to help me fix a few performance for my scripts. I should update my dnh version asap.


Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #189 on: December 04, 2014, 10:42:47 PM »
The enemy task included and called in the stage script :
http://pastebin.com/raw.php?i=ihiQd8gj

And the stage function (called in the stage script):
http://pastebin.com/raw.php?i=wmZHph9v

And the task for spawning shot:
http://pastebin.com/raw.php?i=zMaLC7Jv

For some reason I separate all this things and play with include so I can't past the entire script (or I will past many little part of scripts).
If that can help, I explain:
In the same script I make several sub-stages with a task and a specific pattern (with it's own task) for each stage. So I separate sub-stage task, pattern task and enemy spawning function. I don't think it's come from this separation...


Now I've got the same problem with the enemy shots. A simple circle of 20 bullets make the frame drop ? 15 fps...
Is there a collision between enemy and enemy shot? And I have this problem with shots even if I comment the ObjEnemy_SetIntersectionCircleToShot and the
ObjEnemy_SetIntersectionCircleToPlayer line.
It's seem collisions are not deleted but... why?

edit: okay. It come form the player and not form the enemy/stage/otherrandomscript.
I try to see it by myself and... I come again if I don't find  :(
edit2: I found it. Player's hitbox was created every frame like enemy hitbox. I don't know haw I could make a such thing but I found it.
Thanks for the help. And Thank you Drake. Your explanation help me a lot.
« Last Edit: December 04, 2014, 11:17:40 PM by Lefkada »

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #190 on: December 04, 2014, 11:33:58 PM »
Cool. Just to mention, ObjEnemy_SetIntersectionCircleToShot(tile,x,y,0) doesn't remove the hitbox; the hitbox size will just be a single pixel. The SetIntersection functions are actually only valid for one frame, hence why you have to call it every frame in order to keep a hitbox. So really if you don't want a hitbox, don't call anything. Meanwhile, the ObjPlayer_AddIntersection functions only need to be called once and then are constantly active, which is why you had this problem.

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 #191 on: December 04, 2014, 11:56:19 PM »
Thanks.
Indeed, the ADDIntersection is clear. But I remember why I do this. I move the hitbox graphic by a few pixel when the player move left or right and I want to let the hitbox centered on the hitbox graphic.But I forget that player hitbox are called one time and not every frame...
Also thanks for the advice about ObjEnemy_SetIntersectionCircleToShot (even if it seem it work with the 1 pixel hitbox but is better without).

Oh and not related but it's possible to don't turn enemy shot into star-item when it cleared by a player shot or bomb? (obviously it possible but how? A miracle function?).

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #192 on: December 05, 2014, 12:45:41 AM »
ObjShot_SetItemChange(obj, false);

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


Justin

  • Grand High Poobah
  • what is life
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #194 on: December 17, 2014, 02:52:35 AM »
I'm back again.
So, I'm attempting to create my own dialogue script ( http://pastebin.com/8WTfSqJ6 )
The interests are lines 57 and 64. I want text to appear akin to IN, with the little transparent box and text appearing above it. However, the text always appears to be below the box, and I've tried two cases
 (one where box z = 99 and text z = 1, and vice versa) An example of what's going on:



as opposed to the one without the box:

 Any help would be appreciated.
Current Goals (BC I guess this is a thing):
1CC all 2hu on normal: All clear!
1CC all 2hu on hard: LLS, EoSD, PCB, IN, MoF
Clear all extras: EoSD, PCB, IN, MoF, SA
SA Hard Mode is kicking my butt ;-;

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #195 on: December 17, 2014, 03:14:00 AM »
So, I'm attempting to create my own dialogue script ( http://pastebin.com/8WTfSqJ6 )
Use render priorities. http://dmf.shrinemaiden.org/wiki/Object_Functions#Obj_SetRenderPriority

Changing Z changes the position of the object, not on which layer it is rendered.

EDIT: Also, I suggest using a border for that text or making the colors brighter - it's not particularly easy to read the bluer part on the blue background.

Justin

  • Grand High Poobah
  • what is life
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #196 on: December 17, 2014, 03:44:40 AM »
Use render priorities. http://dmf.shrinemaiden.org/wiki/Object_Functions#Obj_SetRenderPriority

Changing Z changes the position of the object, not on which layer it is rendered.

EDIT: Also, I suggest using a border for that text or making the colors brighter - it's not particularly easy to read the bluer part on the blue background.
Is there a function for the border for text, or is that a custom font thing?
Current Goals (BC I guess this is a thing):
1CC all 2hu on normal: All clear!
1CC all 2hu on hard: LLS, EoSD, PCB, IN, MoF
Clear all extras: EoSD, PCB, IN, MoF, SA
SA Hard Mode is kicking my butt ;-;

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #197 on: December 17, 2014, 04:31:21 AM »
Have a look at the text functions on the wiki., there are several border functions.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #198 on: December 17, 2014, 10:00:47 AM »
Did anybody ever encountered textures/sprites being loaded but not properly visible in game? See below.

[attach=1]

This often happens when you simply boot the stage script for the first time (Note: this is not a package script, just plain stage for now). If I reload it with backspace then everything is fine. Sometimes the lanterns (red cubicles) won't proper show and sometimes the entire stage (as seen here). I want to avoid people playing this the ugly way when they "boot" my game.

The loading of textures is handled first when the stage is run (for now, later on when the full game is completed they will be pre-loaded).

Code: [Select]
// initialize stuff
@Initialize {
loadGraphics;
renderStage;
renderCamera;
}

// Function for loading all graphics into separate thread.
function loadGraphics {
// Stage 1
LoadTextureInLoadThread(balbg);
LoadTextureInLoadThread(balvloer);
LoadTextureInLoadThread(balmuur);
LoadTextureInLoadThread(balmat);
LoadTextureInLoadThread(balplafon);
LoadTextureInLoadThread(balplafon2);
LoadTextureInLoadThread(balslinger);
LoadTextureInLoadThread(balvspot);
LoadTextureInLoadThread(ballampion);
}
task renderStage {
Reset2DCamera; // Reset any possible 2D camera settings.
scrollStage; // Grand stage scrolling handler.

// Enable fog for the game. Fog minimum, maximum and colours are handled in threads.
SetFogEnable(true);

//------------------------------------------------------------------------------------------------------------------------------------------
// Stage 1 render
SetCameraPerspectiveClip(10,4096);
etc.................

renderStage defines fog, camera and contains stageenemy patterns etc. renderCamera is a listener thread for camera mutations and stuff.

Edit:

[12:50:21] <Drake> Helepolis: it's probably because you're loading resources in separate threads, so the rest of the script keeps running even though they aren't yet loaded
[12:50:53] <Drake> switch all the LoadTextureInLoadThread to just LoadTexture and see what that does
[12:52:00] <Drake> i expect it might pause a bit if it's loading lots of stuff, but then draw everything fine the first time
[12:53:42] <Drake> or maybe just yield for a second to let them load before you do start anything
[12:59:42] <Helepolis> Drake it happens on first load though. I'll try the loadtex and yield method now
[13:01:26] <Helepolis> delaying for 1 frame or 120 doesn't change result. Gonna try the load tex now
[13:02:38] <Helepolis> loadtex succeeds any time
[13:02:47] <Helepolis> so it is indeed an issue with loadinthread and loadtex standard

Now that made me curious, what is the exact technical reason for this?


Edit2:
[13:09:39] <Helepolis> in initialize i added wait(120)  after loadGraphics
[13:09:44] <Helepolis> so the stage isnt even booted before textures are loaded
[13:10:07] <Helepolis> loadgraphics is just a function, has no dependancy
[13:10:08] <Drake> ok so that wouldn't work, @init doesn't start @mainloop so no yielding is being done
[13:10:16] <Drake> you just didn't wait properly
[13:10:35] <Helepolis> then i'll move loadgraphics to first line in renderstage
[13:10:38] <Helepolis> and then put a yield there
[13:11:11] <Drake> just putting the wait()s at the beginning of the two tasks should be fine i think
[13:11:40] <Helepolis> ye that seems to have solved the problem
[13:11:48] <Helepolis> you're then right about the loading time.
[13:12:11] <Helepolis> though how come Loadtexture is faster than loadtextureinthread? Is it because loadtexture takes priority while loadinthread is spawned as a side thread?
[13:12:21] <Helepolis> so technically my stage is loaded before the textures are in memory ?
[13:12:37] <Drake> there's probably some overhead in making the other threads or something
[13:12:43] <Drake> i dunno
[13:12:54] <Drake> I imagine it's worth it if you have tons of resources
« Last Edit: December 17, 2014, 12:13:25 PM by Helepolis »

Justin

  • Grand High Poobah
  • what is life
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #199 on: December 17, 2014, 09:37:06 PM »
Have a look at the text functions on the wiki., there are several border functions.
Aaaand I'm an idiot who can't find anything. Thank you so much!
Current Goals (BC I guess this is a thing):
1CC all 2hu on normal: All clear!
1CC all 2hu on hard: LLS, EoSD, PCB, IN, MoF
Clear all extras: EoSD, PCB, IN, MoF, SA
SA Hard Mode is kicking my butt ;-;

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #200 on: December 18, 2014, 04:14:46 AM »
Did anybody ever encountered textures/sprites being loaded but not properly visible in game? See below.

[attach=1]

This often happens when you simply boot the stage script for the first time (Note: this is not a package script, just plain stage for now). If I reload it with backspace then everything is fine. Sometimes the lanterns (red cubicles) won't proper show and sometimes the entire stage (as seen here). I want to avoid people playing this the ugly way when they "boot" my game.

I remember reading in the documentation that using LoadTextureInLoadThread can cause half/incomplete loaded textures though mkm specifically states that to only be the case for using that function in@Loading{}. @Loading should be where you're loading stuff anyway. It is called before Initialize and MainLoop, and you should only use LoadTexture(), LoadSound, and LoadScriptInLoadThread(I'm not too sure if the same applies to scripts that LoadScript is preferred).
« Last Edit: December 18, 2014, 04:16:18 AM by Infinite Ultima Wave »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #201 on: December 18, 2014, 09:06:02 AM »
Aye, that is indeed what Drake also told me.

What technically went wrong was that LoadTextureInLoadThread is just like tasks a separate thread. Cannot confirm it but what I noticed is that LoadTexture takes supreme priority in Danmakufu. Notice my code that my @Initialize kicks off with three tasks which are parallel. renderStage spawns the entire 3D stage drawing and if there is no texture loaded in Danmakufu or partially, it will just draw a 'blanc' sprite in the respective colour of the sprite or nothing. (The lantern suppose to be suspended by fancy banners).

When you hit backspace it seems Dnh just reboots the script and doesn't clear the memory of loaded sprites/tex so that explains also why it looks fine because it takes aprox 60 frames to load my textures (Did some few delaying tests).

As soon as I put regular LoadTexture, my stage would always proper show, while I never changed the @Initialize or delayed the renderStage. I can only conclude that that LoadTexture is taking priority regardless of code running.

Basically it was a logic error I made with the order of handling but that was unintended as eventually everything will be moved to @Loading thread once the game is finished.

I wonder though what the advantages could be of LoadInThread, allow textures to be loaded simultaneously while loading sounds? For example @Loading thread taking the textures + sounds but don't need to be sequentially performed. Or perhaps flexible loading without pre-loading everything without interrupted/lagging your script. (Like before stages end, during the boss fight you could unload/garbage collect while preload next stage. I guess depends on how you manage your resources.
« Last Edit: December 18, 2014, 09:47:06 AM by Helepolis »

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #202 on: December 19, 2014, 02:07:48 AM »
I think the InLoadThread functions act as a personal @Loading{} on the spot and doesn't hold up the engine until the texture is completely loaded as you said. I don't use it for textures though. I use it to preload boss battles and scripts mainly. But to comment on the simultaneous loading of texture and sounds, @Loading will preform that already. For example, in MMS, I ascent through every texture in the game using LoadTexture while having an if statement to do the same for sound effects and music if possible(before the array ends).

I'm not 100% sure on the advantages for textures though. ido seemed to have skipped using @Loading + LoadTexture in RSS, and just jam everything into a function that calls LoadTextureInLoadThread a bunch of times from @Initialize. This could possibly explain the questionable loading times and occasional crashing when loading up the game.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #203 on: January 01, 2015, 03:48:25 PM »
Have a  problem with player image.
The img is displayed incorect (more left from origin).



let objPlayer = GetPlayerObjectID();
let current = GetCurrentScriptDirectory();

task TImage{
let path = GetCurrentScriptDirectory() ~ "51905.png";
ObjPrim_SetTexture(objPlayer, path);
Obj_SetRenderPriority(objPlayer, 0.95);
loop{
ObjSprite2D_SetSourceRect(objPlayer, 284, 117, 307, 157);
ObjSprite2D_SetDestCenter(objPlayer);
yield;}
}

"SourceRect" is correct.

Sorry for my ENG, and thx for help  :)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #204 on: January 01, 2015, 09:16:23 PM »
Hmmm that is odd. You did use ObjSprite2D_SetDestCenter proper.

Have you set ObjRender_SetPosition anywhere? Because that will draw the sprite in the correct location.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #205 on: January 01, 2015, 09:53:26 PM »
If your render priority is less than 20 or greater than 80, it will render above the STG Frame with the origin located at the top left corner of the window rather than the playing field.

Change this:

Code: [Select]
Obj_SetRenderPriority(objPlayer, 0.95);
to something between 0.20 and 0.80. I suggest 0.45.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #206 on: January 01, 2015, 10:56:42 PM »
That is indeed good mention. Also could be because no SetPlayerClip; has been used or modified to decide boundaries how far the player can move. Then again, the hitbox should be outside the field too then no? Hmmm.

Vampi, please post entire code in pastebin.com if you're unable to solve it.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #207 on: January 02, 2015, 05:26:06 AM »
Stil cant resolve.

Player script (Sorry for tons of "comment" - i'm repasting original rumia)
http://pastebin.com/SnYrG54e

boss script (if needed)
http://pastebin.com/dzakCbNv
« Last Edit: January 02, 2015, 05:27:45 AM by Vampi »

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #208 on: January 02, 2015, 10:43:20 AM »
You still have the line Obj_SetRenderPriorityI(GetPlayerObjectID,99) inside the enemy script.

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 #209 on: January 02, 2015, 11:32:59 AM »
Oh  :ohdear:
Thx all for helping and usefull information )