jwilkins's Forum Posts

  • Skills aren't tracked through instance variables, there are far too many of them to do that.

    The PlayerSkillSetup function scans an array that is populated with the collected skills of the player(s) for the requested skill. If the skill exists in the players Y rows (each player has their own X row) then the function returns the "skillExists".

    This system has worked fine for the previous 40+ skills I have setup this way, hence why I haven't bothered sharing the PlayerSkillSetup function since it's never given me these issues with those previous setups.

  • try to insert a browser log of the UID in between each of those actions and see which one is interfering?

    This was a good idea, but gives me... bizarre results.

    If I set it up like this, where the browser alert comes after everything else and I disable the ValueText object spawn, it returns the correct UID:

    However, it fails to actually update the players variables. Their HP remains the same (double checked in the debugger to be sure).

    Enabling the ValueText object spawn causes the browser alert to once again return 0.

  • This is Construct 3, but it is built on a project that was originally started in Construct 2, and had far too many old Functions for me to feel comfortable updating them to the new Function system. I've continued to use the old function system as a result.

    What UID is it showing in the browser logging?

    This is the frustrating part of this issue. If disable the actions that update the players health and spawn the text object, the browser alert returns the correct UID:

    However, the moment I toggle those actions back on, the Browser alert returns a UID of 0.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have a function I run to check if the player has a skill when it would be triggered. This has worked perfectly fine for the implementation of 40+ other skills, but this one time it just refuses to work properly. In this case, the skill is supposed to heal the player slightly when the conditions are met to pick up a coin:

    So as you can see, "PlayerSkillSetup" is ran, and if the player has the skill it is checking for ("skill_greed1") the Function.ReturnValue should equal "skillExists", at which point it runs the highlighted code.

    And it does run that code, but on nothing. Because despite passing the PlayerFamily.UID through the "PlayerSkillSetup" function and verifying it is picking the correct instance, the highlighted code runs on nothing. It spawns the ValueText object at 0,0, so it is running.

    I have tried a dozen different work arounds on this thing to no avail, and I cannot see what very well may be an obvious issue, help would be greatly appreciated!

  • That could be, the AI accepts instruction mostly from one source (a general "AIUpdate" Function) but does occasionally have to get instruction outside of that routine, which might be the culprit. Glancing through my events I don't see any that should be updating the animation externally, but that doesn't mean its not there.

    I'll keep that in mind if this rears its head again, for now the force "Start Animation" is working with no consequences.

  • lionz sorry, I should clarify, this is in regards to the current animations "Is Playing" value, specifically the one the debugger displays when inspecting the instance in question:

    My understanding is that the debugger value is always updating to the current animation in real time, that is what it appears to be doing at least, and while "Is Playing" remains true most of the time, randomly it does turn false when switching to the attack animation.

    Bandaid Solution in case anyone has this same issue in the future

    While I have no clue what is setting this value to false and stopping my animation from playing, I was able to "fix" the problem by putting a "Start Animation from Current Frame" action after the "Set Animation" action.

    To be clear, this shouldn't be necessary. The existing code works 95% of the time, but after adding this "Start Animation" action and running the game at 10x speed for an hour with an AI controlled enemy attacking a dummy, I haven't seen the issue pop back up. The debugger still shows the "Is Playing" value being set to false randomly, but this bandaid bypasses that.

  • I have this long standing, very random bug in my game I am trying to pinpoint with no luck.

    The short version is that when an enemy switches to their attack animation, very occasionally their animation freezes. Through the debugger I discovered this happens because SOMETHING is setting "Is Playing" to False.

    But here's the thing, to my knowledge the only action that can do that is "Stop Animation", and I do not use that action anywhere for any object (including these enemies) in my project.

    Searching the entire project for "stop animation" only gives me results for some disabled code I kept around for reference.

    Is there something else that can manipulate "Is Playing" that I am not aware of? Anything that might help me here would be greatly appreciated, this bug has been sitting there, randomly occuring, for months now.

  • This is pretty easy to test, just use the Advanced Random behavior to update the seed, then save (either using the debug save option or the plugin) close the game, then load the save.

    If you look in the debugger, the PRNG Seed is no longer whatever you updated it to be using Advanced Random. This of course ends up affecting everything that is tied to random generation.

    Now, I could get around this pretty easily by just updating the seed again after a load, but previously I didn't need to do this, and I am worried it could create issues if you save/load at just the wrong time. Am I actually just missing something and this is always how it worked and I've broken something elsewhere?

    Tagged:

  • I've got a top-down layout that uses seed generation and a tilemap to infinitely generate terrain. Whenever the player reaches an invisible edge of the layout, their position is reset and the tilemap is repopulated with their new offset co-ordinates.

    Terrain cannot be modified by the player, so I don't store any of the terrain information in an array or anything.

    I do want to include "fog of war" (FoW) though, hiding undiscovered tiles until the player gets close enough to them.

    I can't simply place a FoW layer that erases tiles the player gets near because the entire layout is being re-generated constantly. Instead I need to store the offset positions of cleared tiles, and I'm curious what is the most efficient way of doing this? I could make an array and place in every tiles offset X and Y, but that array will quickly get massive as its expected the player will be uncovering tens of thousands (if not more) tiles during their exploration.

    Suggestions? Thanks!

  • You do not have permission to view this post

  • I'm building an NES/GBC style game, so it uses spritefonts. Currently, I am building all the menu/UI/dialog text to pull from a language array, where it simply pulls using a key word. For example, it might find the keyword "currency_menu" and return "Gold".

    To me this should work pretty well if I choose to ever localize in the future, theoretically I can just load a new language into the array, and switch the spritefonts for ones with the languages alphabet.

    Does this make sense? Is this a bad idea? I've never considered building for future localization until now.

  • As a quick update, oosyrag's suggestion worked pretty well, though I didn't use the container idea. Mainly because this only needs to be checked during lane changes, so I create a "LaneChecker" object in the function that checks to see if the lane the player is trying to move into is obstruction free. This object is created, positioned, and sized based on the players position and VectorX values, and then I just check to see if it is overlapping anything in the new lane.

    Regardless of if it is or isn't, the object is destroyed immediately at the end of the checker function.

    Thanks for the suggestion oosyrag! It's much more consistent than the old patch-job I had, and it was easy to test by simply not destroying the lanechecker object at the end of the function and changing its sprite based on whether it would allow a lane change or not.

  • That makes sense, its not quite as self contained as I'd hoped but it does seem straighforward, I'll try it out and see how it goes!

  • This is conceptually a little complicated so here's a screenshot of the project:

    So this project uses the Platform behavior in conjunction with the Solid collision filter/tags. You can see in the screenshot above that there are 7 "lanes" of collision/depth, and the player object only collides with solids tagged with the lane theyre in.

    This works fine, but we run into edge-case issues when switching lanes. Currently the game does the following to move lanes up down:

    1. First, it calls a function that checks if the position above/below the player in the lane theyre trying to move to is free.
    2. Next, it initiates a tween that moves the player either up or down lanes, and temporarily disables the lane collision checking while the tween is active.
    3. Finally, when the tween is finished the game updates the collision filter for the player object to check for collisions in the lane the player has moved to.

    If the player is standing still, this works fine. We run into problems when the player is moving left/right during a lane change, because during the tween the player continues to move left/right, and the position they end up at when the tween ends and re-initiates collisions could include a solid the player is now stuck in.

    Up until now I've been able to slightly combat this issue by checking directly above/below the player and slightly in front of them as well, but this has only lessened the frequency of this issue, it still occurs.

    I could of course stop the players horizontal movement during the lane change tween, but this makes movement really clunky and unsatisfying, so that's not ideal.

    Any suggestions on how to accomplish this would be appreciated, if I could predict the range of locations the player could end up at during step 1, then I feel like I could eliminate this issue, but I don't know how to do that or if there is a better alternative. Thank you!

  • dop2000 Thank you so much for linking this! I was trying to find any information about this issue but didn't run into that post. Turning worker mode off does seem to help, though I'll keep poking at it to make sure.