Author Topic: Danmakufu Q&A/Problem thread number 4  (Read 206540 times)

Zengar Zombolt

  • Space-Time Tuning Circle - Wd/Fr
  • Green-Red Divine Clock
Re: Danmakufu Q&A/Problem thread number 4
« Reply #840 on: February 23, 2011, 04:49:36 AM »
I think someone should update the tutorials saying that Shotsheet scripts are that much better.

Schezo

  • en-counse
Re: Danmakufu Q&A/Problem thread number 4
« Reply #841 on: February 23, 2011, 05:00:11 AM »
Disregard
« Last Edit: February 23, 2011, 05:11:51 AM by Schezo »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #842 on: February 25, 2011, 09:24:09 AM »
People shouldn't be lazy and just include the shotsheet they used a long with the download. Even if it is the CtC or w/e. As if 100kb extra is going to be a problem. But yea, lazy people =[

Re: Danmakufu Q&A/Problem thread number 4
« Reply #843 on: February 25, 2011, 02:58:01 PM »
I has some un-danmakufu related questions  :V

1.) What happen to all the pictures  :wat:



2.) Why Can't I join "You wah Ban" group Anymore  :3
(There's no group to join)
Hey There !

Schezo

  • en-counse
Re: Danmakufu Q&A/Problem thread number 4
« Reply #844 on: February 25, 2011, 03:58:06 PM »
Those aren't really danmakufu questions. :P


The first on is some silliness about having to be registered at imageshack to upload the images or something. They know in CPMC it's a rage issue.

The second one is more of a letters to the editor question. It was answered here.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #845 on: March 01, 2011, 10:18:10 PM »
So I'm making a more efficient, convenient version of my custom frame from my old project, and I'm currently at making the custom numbers, and it works pretty well but I want a way to control when I update the text, so here's what I need to do:

delete a group of effect objects, and immediately replace them, only when the number changes.

So I'd need to get all the number's effect objects, and delete them, so I have two ideas but I don't think it's possible in Danmakufu.

1. Call all effect objects somehow, like a global effect object caller, and if they have a certain variable that shows that each character belongs to the set of numbers (for example the 11 characters that compose "200,000,000"), whether its for Score or Graze, etc.

2. plan ahead and put each object in an array belonging to the represented variable, but I need to make it so I can add to the array as it goes along, like HighScoreChars.push...but I don't think Danmakufu has lists with Push and Exclude and stuff does it?

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #846 on: March 02, 2011, 01:30:13 AM »
If you want to make an array-based stack or something, you can, somewhat.

However, you can compare the array of characters from your current score to an array of characters from a string that keeps your last score string. If a character is different you can update the string and the associated objects, etc.

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #847 on: March 02, 2011, 01:39:33 AM »
If you want to make an array-based stack or something, you can, somewhat.

However, you can compare the array of characters from your current score to an array of characters from a string that keeps your last score string. If a character is different you can update the string and the associated objects, etc.

yeah thats what I want to do ^^ but its just that they way its set up now, once theyre drawn once theres no removing them, I can draw new ones on top just fine but that would be a mess because theyd stack, and eventualy the game would lag from way too many effects, but I think I maybe have an idea, im gonna try it out and see ^^

Re: Danmakufu Q&A/Problem thread number 4
« Reply #848 on: March 02, 2011, 02:09:19 AM »
yeah thats what I want to do ^^ but its just that they way its set up now, once theyre drawn once theres no removing them, I can draw new ones on top just fine but that would be a mess because theyd stack, and eventualy the game would lag from way too many effects, but I think I maybe have an idea, im gonna try it out and see ^^

Okay so all I did was pretty much ruin the script...whoops, I rewrote it so that every letter was stored in an array, so the effect object for the first letter, the one at the very end, is ObjectArray[0], etc. and there didnt seem to be any problems there, but then I try to update the textures of the array of objects much similarly to the first time they were created and given the right number image files, the program crashes, and when I tried the method of deleting them every frame to create new ones, they didnt delete and just piled up constantly droping the framerate instantly, basically its as if they were never put in an array at all, now the whole thing is a mess.

I should probably start a new task for this from scratch after I learn what went wrong...

Re: Danmakufu Q&A/Problem thread number 4
« Reply #849 on: March 02, 2011, 02:12:41 AM »
Okay so all I did was pretty much ruin the script...whoops, I rewrote it so that every letter was stored in an array, so the effect object for the first letter, the one at the very end, is ObjectArray[0], etc. and there didnt seem to be any problems there, but then I try to update the textures of the array of objects much similarly to the first time they were created and given the right number image files, the program crashes, and when I tried the method of deleting them every frame to create new ones, they didnt delete and just piled up constantly droping the framerate instantly, basically its as if they were never put in an array at all, now the whole thing is a mess.

I should probably start a new task for this from scratch after I learn what went wrong...

And I figured I should probably paste what the whole thing looks like but after all the tweaking (and the last part of the DrawNumber command is unfinished, and most variables dont do anything anymore, it really is incomprehensible, but im just trying to show what I was trying to accomplish with it:

EDIT:  Super sorry about the huge block of code, I didn't even know about Pastebin until just recently, I'd upload a Pastebin'd version but the code is kinda outdated since a lot was rewritten. ^^
« Last Edit: March 03, 2011, 07:47:49 AM by WriggleNightbug »

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #850 on: March 02, 2011, 06:48:11 AM »
pastebin go go go

Re: Danmakufu Q&A/Problem thread number 4
« Reply #851 on: March 02, 2011, 03:35:44 PM »
Okay so I restarted and this time I got something a little more promising, although now its suffering from extreme slowdown, like at first it's fine and it runs perfectly, but after awhile it gradually slows down more and more to the point where it takes about a whole minute for it to retry the level, and I don't see why, It usually lags when the number exceeds the 3rd digit, but all 11 characters of the score are displayed all the time anyways, cuz the rest of the numbers after the variable are shown as 0's.

Basically I create new effects every frame, and the effects are made to delete themselves after one frame...but if theyre deleted they shouldnt build up right? I'm guessing the gradual increasing lag is caused by a build up somewhere

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #852 on: March 02, 2011, 04:03:41 PM »
Well obviously something isn't being deleted. Pastebin please.

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

Re: Danmakufu Q&A/Problem thread number 4
« Reply #853 on: March 02, 2011, 04:11:03 PM »
Well obviously something isn't being deleted. Pastebin please.
 

Oh okay now I know what pastebin is XD
Like this?
http://pastebin.com/qt31uELC

Re: Danmakufu Q&A/Problem thread number 4
« Reply #854 on: March 02, 2011, 05:16:29 PM »
Alright, well the build up became obvious once I discovered you're double creating objects (first creating empty objects in your array, then seeing that you're also creating them in StaticFrameSetup 7 times as it runs in @DrawLoop every frame), which don't get deleted. Going by your current code, I can't see any easy way to fix this. Instead I'll show you how I would've approached it, from a conceptual standpoint anyway.

Instead of creating an array filled with empty objects, just create and empty array (God bless dynamic array sizes) and fill it with objects as you create them. So everytime you call a function that creates a digit in your number, you can say

sub CreateDigit{
   let obj = Obj_Create(OBJ_EFFECT);
   objArray = objArray ~ [obj];
   //... etc
}

//then after you've drawn all the letters, you can delete them with

loop(length(objArray)){
   objArray = erase(objArray, 0);
}

//though I'd try to find a way to just change their graphic as opposed to deleting and recreating them every frame, something like

sub RunEveryFrame{
   score = GetScore; //whatever
   //insert code to delete decimals from numbers here
   if(length(ToString(score))>length(objArray)){
      //if there are more digits in score than there are objects, create another object and add it to the array
      loop(length(ToString(score))-length(objArray)){
         CreateDigit;
      }
   }else if(length(ToString(score))<length(objArray)){
      //similarly, delete objects if there are too many
      loop(length(objArray)-length(ToString(score))){
         let spot = length(objArray)-1;
         Obj_Delete(objArray[spot]);
         objArray = erase(objArray, spot);
      }
   }
   
  //loop # = length of objArray, or however many digits are in the score
   descent(j in 0..length(objArray)){
      let var = ToString(score)[j];
      Obj_SetTexture(objArray[j], GetCurrentScriptDirectory~"Image\" ~ var ~ ".png");
      //remember you need to redefine the vertices after setting a new texture to an obj effect, so do that
      //ObjEffect_SetVertexUV(objArray[j], 0, 0, 16);
      //etc.
      //Also set position

      Obj_SetPosition(ObjArray[j], x + j*16, y);
      //insert your own coordinates for x and y, just remember to displace each digit by j*(however wide the image is), I used 16 as an example
   }
}

EDIT: corrected a few things, logic was still the same, however
« Last Edit: March 02, 2011, 05:33:38 PM by Knot »

Re: Danmakufu Q&A/Problem thread number 4
« Reply #855 on: March 02, 2011, 06:06:18 PM »


Okay so I'm super excited that you can add to an array instead of intense copy pasting.

But now I'm back to an old problem, for example here's a tiny bit of code:

Code: [Select]
task DrawHighScore {
yield;
let Array = [];
ascent(i in 0..11) {
let Obj = Obj_Create(OBJ_EFFECT);
Array = Array ~ [Obj];
SimpleEffect(Array[i], 300-(14*i), 100, Image_0, 17, 24, 1, 8)
}
EffectUpdate(Array[3], Image_Comma, 17, 24, 1);
}

This isn't really drawing the high score, it basically sets up a bunch of 0's and then for testing purposes I went and re-updated the 4th character into a comma, to see if it works, but it still remains a 0, and its not the function I think because doing it the old fashioned way isn't changing the texture either, and that function pretty much covers everything from rescaling to getting the new picture and setting up the vertices, etc.

So yeah, back to the old problem of the array never seeming to return anything

Re: Danmakufu Q&A/Problem thread number 4
« Reply #856 on: March 02, 2011, 06:31:46 PM »
Oh wait I just clued in what you guys meant by double-creating! Whoops whoops whoops...Sometimes I wonder how I'm even able to get this far sometimes XD

Re: Danmakufu Q&A/Problem thread number 4
« Reply #857 on: March 02, 2011, 11:19:19 PM »
So here's another issue I've encountered while making the Stats frame, It isn't a huge problem but since I'm very picky with graphics when I'm the one making them, I can't get over the constant distortions in all my imported sprites, Danmakufu tends to do this alot with my custom bullets and graphics, and I'm wondering what im doing wrong...

Here's a picture of the distortions, there's also a bit of it noticeable on the numbers too.



And here's the vertices setup:

Code: [Select]
                ObjEffect_SetPrimitiveType(Variable, PRIMITIVE_TRIANGLESTRIP);
 
          ObjEffect_CreateVertex(Variable, 4);

ObjEffect_SetScale(Variable, Scale, Scale);
ObjEffect_SetLayer(Variable, Layer);
 
          ObjEffect_SetVertexXY(Variable, 0, -Image_X/2, -Image_Y/2);
          ObjEffect_SetVertexUV(Variable, 0, 0, 0);

          ObjEffect_SetVertexXY(Variable, 1, Image_X/2, -Image_Y/2);
          ObjEffect_SetVertexUV(Variable, 1, Image_X, 0);

          ObjEffect_SetVertexXY(Variable, 2, -Image_X/2, Image_Y/2);
          ObjEffect_SetVertexUV(Variable, 2, 0, Image_Y);

ObjEffect_SetVertexXY(Variable, 3, Image_X/2, Image_Y/2);
          ObjEffect_SetVertexUV(Variable, 3, Image_X, Image_Y);

Re: Danmakufu Q&A/Problem thread number 4
« Reply #858 on: March 03, 2011, 05:38:54 AM »
Separate your graphics by at least one pixel on the image, dnh tends to bleed pixels at the fringe of the graphic rects. What you're seeing is the edge of whatever is next to those characters on your graphic. I really don't know why it does this, it just does.

To answer the other question that you for some reason didn't ask in this thread:

let string = "" ~ ToString(variable);
let n = 0;
let res = "";
while (n < length(string) && string[n] != '.')
{
   res = res ~ ToString(string[n]);
   n++;
}

res is the string with the decimal and all zeros after it removed after the code runs. variable is the original number, before being converted to a String.

Even after two years of dnh I'm still abusing Nuclear Cheese code :V

Re: Danmakufu Q&A/Problem thread number 4
« Reply #859 on: March 03, 2011, 07:54:41 AM »
Separate your graphics by at least one pixel on the image, dnh tends to bleed pixels at the fringe of the graphic rects. What you're seeing is the edge of whatever is next to those characters on your graphic. I really don't know why it does this, it just does.

To answer the other question that you for some reason didn't ask in this thread:

let string = "" ~ ToString(variable);
let n = 0;
let res = "";
while (n < length(string) && string[n] != '.')
{
   res = res ~ ToString(string[n]);
   n++;
}

res is the string with the decimal and all zeros after it removed after the code runs. variable is the original number, before being converted to a String.

Even after two years of dnh I'm still abusing Nuclear Cheese code :V

Thanks ^^ I managed to make a pretty good system for drawing numbers using effect objects, something that concerns me a little is that there's a slight slowdown after all the effect processes, its minor, but I wonder if it'l become too much after backgrounds and danmaku and such.

Oh and that could be the problem, it happened a few times before when I was making shot graphics, but the problem is that each yellow text is their own graphic, so they arent connected, what seems to happen on every graphic is that the very bottom pixels are put on top, no matter what modifications I make to the vertice setup, It's so odd...

Re: Danmakufu Q&A/Problem thread number 4
« Reply #860 on: March 03, 2011, 04:17:51 PM »
Oh and that could be the problem, it happened a few times before when I was making shot graphics, but the problem is that each yellow text is their own graphic, so they arent connected, what seems to happen on every graphic is that the very bottom pixels are put on top, no matter what modifications I make to the vertice setup, It's so odd...

All textures are infinitely tiled, so you're seeing the wrap around on the same graphic. The solution is still the same, add at least 1 pixel of blank space around the graphic.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #861 on: March 03, 2011, 11:46:12 PM »
All textures are infinitely tiled, so you're seeing the wrap around on the same graphic. The solution is still the same, add at least 1 pixel of blank space around the graphic.

I cant believe I didn't think about that! it's a simple fix, there's gonna be a lot of to do though, all numbers and static words, etc.

Anyways here's my screen so far, once the cutout is gone, it should work well, and I made it so textures are only updated if their assigned variable changes, this made it run smoother since effects arent updated every frame, so it plays pretty much at the same FPS as it does without the stats table:

http://i786.photobucket.com/albums/yy145/FurryGoatSammy/Frame.png

(By the way, 57 or so is as high as frames will go on my parent's comp, the one I used to take this snapshot, it runs at the same ammount either way)

Re: Danmakufu Q&A/Problem thread number 4
« Reply #862 on: March 05, 2011, 05:21:37 PM »
I have question involving a formula I used to use, but I cant seem to remember how it went.

Basically it was used for circle collisions, like if a bullet gets close enough to a player's circle shaped radius, it might bounce in another direction, or if the item effect is close to the player's sprite enough to be collected, it dissapears and does it's work.
I need it again since I'm making items that home in on you if you get close and become collected once really close.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #863 on: March 05, 2011, 06:20:01 PM »
Distance formula: ((x1-x2)^2 + (y1-y2)^2)^0.5

Also, if you have small questions like this you might as well stop by the IRC channel for danmakufu, you'll get a much faster response. #danmakufu @ irc.ppirc.net
« Last Edit: March 05, 2011, 06:21:37 PM by Knot »

Mr. Sacchi

  • All shall be well and all manner of thing shall be well.
  • Not postponed. Not in the end. Not for long.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #864 on: March 05, 2011, 09:43:26 PM »
Alright, I dunno if this is the RIGHT place to put this but.

http://www.mediafire.com/?qrxbp7p65df2d53

This is a Cirno Boss I'm working on, for now only 2 spellcards are made, I wanted to know if they are ok for a normal difficulty level (Also, I should note that the second one has a Timeout phase and a "move" phase right before that, there's more than enough time to win but...)

Yeah, the first one was shamelessly stolen from ruro's tutorial, sue me.

And, the health/timer for the second one are right, the health/timer for the first one are not, too lazy to go and fix them.

Also, any special reason why the default background is on the second card? I'm pretty sure I put the custom one there.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #865 on: March 05, 2011, 11:43:58 PM »
You accidentally put another } after the closing bracket for @DrawLoop {, apparently. That removes everything after.
Also, you didn't define the variable "lay".

http://pastebin.com/RhCP73hQ
« Last Edit: March 05, 2011, 11:49:19 PM by Myouri »

Re: Danmakufu Q&A/Problem thread number 4
« Reply #866 on: March 07, 2011, 08:51:40 PM »
Iv'e started doing something other than the frame today, Iv'e begun a background for stage 2 and something Iv'e noticed is that theres a lot of lines being cut trough all the graphics, its a little odd and distracting, especialy on the top of the cubic flower garden things.

http://i786.photobucket.com/albums/yy145/FurryGoatSammy/Clipping.png  (screenshot is > 150kb -Hele)

This seems to be a common thing in most of the backgrounds I make, I'm thinking theres something wrong with the way I draw or save my files, also Iv'e already tried adding more transparent space, but it only made it worst. ^^;

Note: the tops of those boxes are supposed to be flat, the lines arent a design choice XD the reason their there is that the wall graphics are also drawn with the same sizes inwards to give the walls of the inside of the box
« Last Edit: March 07, 2011, 09:00:22 PM by Helepolis »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #867 on: March 08, 2011, 12:13:26 PM »
Did you try setting your graphicrect 1 pixel shorter to find out whether it is dnh issue or image issue. I didn't had this issue with my 3D stage. You need to give more information about your files.

- Are you using powers of 2 for the images?
- PNG or BPM ?
- Graphicrects?

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #868 on: March 08, 2011, 01:43:44 PM »
It looks like the side of the walls are poking through the top part of the walls. Maybe try putting the top a tiny bit higher? Or make the sides a bit shorter?
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #869 on: March 08, 2011, 05:27:47 PM »
Did you try setting your graphicrect 1 pixel shorter to find out whether it is dnh issue or image issue. I didn't had this issue with my 3D stage. You need to give more information about your files.

- Are you using powers of 2 for the images?
- PNG or BPM ?
- Graphicrects?

the verticle sides of the boxes have twice the scales of the horizontal sides, so their stretched,
theyre all png images,
and their rect is the exact same size of the image, so I assumed that they would be exact size, but i'll try recuding by one pixel