Acryte's Forum Posts

  • 12 posts
  • You may have figured this out already but...

    Just use a variable and add one to it each tick. Then reset it to 0 after you do something. Then check if it is greater than an amount (# of ticks) since you reset it to 0. Pretty simple. You can also use it inversely as well (Lag). You say: each tick, if Lag > 0, Lag = Lag-1

    I'm making a fighting game so this is a great way to detect whether a combo is dropped, or a universal way to add a set amount of lag to stuff. For example, if I do an attack that has 40 frames of lag, I can set Lag to 40. Then on all my actions that can't be done if you are lagging, you just put a conditional of "if Lag <= 0" pretty simple. Usually, when Lag goes from being > 0 to being = 0 I will zero ANOTHER variable called FramesPassed. This variable keeps track of the number of frames since the END OF LAG. This is also useful, for example... if you jump but release the jump button quickly enough after the jump registers (and before lag ends or a certain few frames after Lag ends), you can have it perform a short hop (lower jump) instead of a full jump. There are plenty of ways to utilize this...

    Similarly if you allow cancelling at the beginning and end of a move into certain other moves you can use variables that keep track of frames since the start of the move.

    Basically in my game for example, I keep track of:

    Frames of Lag

    Frames since Lag ended

    Frames since the start of a move

    These allow me to have frame accurate control over my game (unlike many games, serious fighting games require constant framerates and timings for things)

  • On an unrelated note, I went completely dyslexic and read his name as Red Ass Box...

  • aaah, nice don't know why I didn't think of that.

  • Nah man, I couldn't think of another solution so I just stuck with the Rotating layer + H/V inversion technique. Would have been nice to have figured out another way but I didn't feel like getting hung up on it if it works, since I still have plenty of game structuring left to be developed.

  • I had originally posted this in the bugs section of the forum because I wasn't sure where to put it. Since it didn't involve bugs that were specific to Construct 2, it was closed.

    I am now reposting this here because I have fixed the problem, and someone else may soon experience similar issues.

    Note: I use Chrome Beta for my developing. Since I'm only developing a tech-demo for the game I want to pick up development support for (which will be remade by a dev team), gamepad support and constant framerate were the most important features, and being browser exclusive didn't matter.

    My problem surfaced a couple days ago... Chrome always held a steady 60 FPS at a 13% or so CPU usage, but recently it dropped to 30 or 40 FPS constant with 4% CPU usage. Wasn't sure why. If I went up to the minimize, maximize, and close buttons, left-clicked and held the mouse button down on one of the buttons, the FPS would jump up to a perfect 60 FPS and stay there. You could move the mouse around as long as you didn't release the mouse button. Once you released it, Chrome dropped back down to 40 FPS again. Similarly, if I opened the task manager that is built into Chrome and ended the "GPU Process" process (3 times) and then refresh the page, the CPU usage jumped up a ton (45-90% depending on if it was native rez or being resized) but at native res the FPS was at 62... So I knew something was up with the way Chrome was using or interfacing with my GPUs.

    I was on the latest Java, Flash, nvidia drivers (for 660M), and Chrome 30.0.1599.22 Beta-m. Being up to date on them didn't fix anything.

    Turns out, I switched to Chrome 31.0.1612.2 dev-m which you have to update to manually if you are using beta since beta will only give you the latest beta release and not the dev release.

    Anyways, problem solved. I'm back to a beautiful 60 FPS constant at a mere 7% cpu :)

  • Hi, I am unsure what is going on with this problem. It isn't project specific but is happening when using Chrome on all projects. Chrome WAS running at an average of 13% CPU usage at a constant 60 FPS with webgl on for all my projects and for the sample projects. I'm using Chrome 30.0.1599.14 Beta-M. Now for no reason I can ascertain, Chrome has dropped to 40 FPS or so CONSTANT instead of the 60 it was normally at. CPU usage has dropped to 4% too instead of sitting at 13%. Here is the weird part...

    If I change my screen's refresh rate to 40hz instead of 60hz then Chrome starts putting out about 20 FPS constant. So if I drop my screen refresh rate by 20 Hz, it drops my FPS in Chrome down by 20 FPS to boot. I have all Chrome extensions disabled. Firefox Nightly says its putting out 64 FPS instead of the usual 50 FPS and instead of using it's usual 75% CPU it is now at 19%. I didn't update my graphics card drivers recently either. Only thing I can think of is that I updated to the current beta of C2 but I don't think that would have to do with anything. I also updated Java to Version 7 Update 25 (1.7.0_25-b17) at some point but I think that was before this problem surfaced.

    Any help figuring this out would be much appreciated... I really loved having 60 FPS constant no greater or less using Chrome, and I really need to get this back under control.

    ===============

    Edit: I just loaded fraps and a 60 fps video that I had play inside Chrome, and can confirm that Chrome is able to be putting out 60 FPS if it wants to, now I just have to figure out why it doesn't.

    ===============

    Edit2: UUUGH WTF? So if I bring the mouse up to the minimize, maximize and close buttons and click and hold the mouse button down, I can then move the mouse button away from the buttons anywhere I want on the screen and the FPS climbs right up to a constant 60 FPS, but once I release the mouse button it drops itself back to 40 FPS....

    ==============

    So I went to Chrome's task manager (very useful) and there is a task there call "GPU Process". When I end that process 3 times, the screen will go black. After I refresh the window, I'm able to pull 62 FPS but my CPU usage has jumped up considerably to 45% now instead of being much lower, and the FPS is allowed to go past 60 (it is sitting at about 62-63 wth). Is this probably an issue with my graphics card drivers then? What do you think may be causing this issue?

  • I recently ran into a problem when using 9 patches: The origin can only be placed top-left or center. If you have a meter or something that you want to shrink from the left to the right, not from the right to the left, but want to use a 9 patch, you may encounter some issues.

    If you wanted to achieve this using a Tiled Background, clipping from the left to the right, it can be achieved by setting the width to a negative. This trick doesn't work with the 9 patch because of the way the margins work. If you want to do this, it requires placing the 9 patch on its own layer and then rotating the layer 180 degrees. Then you just invert the image both horizontally and vertically in the image editor. (It doesn't give you the option to rotate 9 patches so you have to do it this way)

    Feels kinda dirty doing it this way however, is there any other way to accomplish this? I tried setting negative margins but that doesn't really work and I didn't anticipate it working. Is there a specific reason why they don't let people anchor the origin for 9 patches and tiled backgrounds to user defined positions aside from top-left and center? Any thoughts as to other solutions to this issue?

  • Thanks, I appreciate it. I might use one of those methods if I can get it to be consistent, otherwise I'll probably have a user defined setting.

  • Thanks, I appreciate it. Tell me, is it possible for us to code it to recognize (automatically) what browser type is being operated on? Then I could just have it set the threshold to a variable and adjust it based off what browser is being utilized.

  • Hi, im coding a fighting game in c2 and started working on it in firefox nightly. it worked great but i recently switched to chrome beta because it runs a constant 13% cpu instead of 75% and holds a constant 60 fps.

    I noticed that after switching browsers, a few of my functions werent triggering. I had set a threshold for joystick Y input at 60% for jumping and greater than or equal to 60%for Y and 60% for X for diagonal jumping and also for wavedashing. It went from having a large trigger area to a hairpin trigger area.

    it only seems to affect the diagonals and strangely enough only on the right side and not the left... idk why its happening or what the difference is between browsers. I set X to 35% threshold and fixed it for chrome but now im catering to one browser over another... not sure why its occurring and i was wondering if its simply something that is already documented regarding how chrome processes joystick inputs vs firefox.

  • Much appreciated, it's almost perfect, but you see how the segments are tilted diagonally? When I resize it's width the clipping is straight up and down, if I was to rotate the sprite, I'm guessing that it will still have a straight up and down line? or will the X axis be relative to the sprite itself and allow me to maintain that diagonal line as it fills the segments?

    EDIT:

    Would it be possible for my to throw it into a container that way I can rotate the container while counter rotating the sprite/tiled BG?

    EDIT2: I made it work by going into photoshop and rotating the original image 18 degrees clockwise, and then using the rotated image in c2 and rotating it -18 degrees so that the X axis is at the same angle as the subsection lines.

    Is there a non-destructive way to accomplish this? Rotating rasterized images reduces the quality of the image, and while most of are shapes, I would assume there is another way to accomplish this inside C2 alone.

    Containers don't seem to work the way I assumed they would. Rotating the container doesn't rotate the objects contained within them from what I tried, and changing the width of the container doesn't seem to clip and hide the objects contained within it...

    Is there a good way to accomplish this without having to physically rotate the sprites in photoshop?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi, I'm fairly new to c2 (2 weeks) but I'm doing pretty well. I'm making an advanced fighting game. So far I've photoshopped all the hud elements, coded all the movement/jumping/dashing/airdashing/dodging/rolling etc type techniques, and animated my character using placeholder sprites I snagged from guilty gear (hehe). Most of the stuff in the game I haven't had a problem with so far, but I am not sure the best way to handle my current problem.

    This is the meter bar when it is full... it has a red trim and full red bars.

    <img src="http://i28.photobucket.com/albums/c238/Acryte/GAMEIMAGES/SPBARFULL-P1.png" border="0" />

    This is when the meter is empty:

    <img src="http://i28.photobucket.com/albums/c238/Acryte/GAMEIMAGES/SPBAR-EMPTY-P1.png" border="0" />

    The meter will fill up in slivers/chunks as you gain meter from doing certain attacks and actions.

    Intermediate layer for when meter is full it has red outline:

    <img src="http://i28.photobucket.com/albums/c238/Acryte/GAMEIMAGES/SPBAR-FULL-P1.png" border="0" />

    Meter Bars (when a bar subsection is full it will turn red)

    <img src="http://i28.photobucket.com/albums/c238/Acryte/GAMEIMAGES/SPBAR-METER-P1.png" border="0" />

    Meter Bars (when a subsection is partially full it is yellow)

    <img src="http://i28.photobucket.com/albums/c238/Acryte/GAMEIMAGES/SPBAR-FILLING-P1.png" border="0" />

    How can I, and how should I, go about making this to where I can use sprite layers, blending modes, etc... in order to not have to animate out every frame aka every sliver of meter that fills up?

    I basically want it to use the blank meter sprite but then reveal the partial meter sprite until it fills a whole subsection, then hide that subsection of the sprite and use the red meter subsection piece.

    I could probably also make the red meter part easier by making each individual piece for the red meter subsection's their own sprite... that's fine, but it still doesn't help me with the filling up of the current subsection of meter with the yellow bar.

    I don't want to stretch the width obviously as that would constrain the image, or can I have it keep the image aspect ratio and then clip the image as it resizes it? Any help would be much appreciated. It should go without saying I'm trying for the most concise and straightforward approach that minimizes number of sprites and animated frames.

    Obviously if there is 150 SP total in the meter, I could have 150 animation frames and then just have it show the frame in the animation of how many SP you have, but that is a lot of overhead in frames and I'd prefer a more dynamic way of doing things.

  • 12 posts