CJD's Recent Forum Activity

  • ok so:

    " window.indexedDB.deleteDatabase('_C2SaveStates'); "

    Worked flawlessly, I couldn't find any issues with it other than it doesn't discriminate when it comes to which save its deleting,

    so I can't really have multiple saves and the ability to manually delete each.

    I thought perhaps I could delete files with NW.js since it has file manipulation, but uh, I can't find the file path for these so I can't really delete them with this method.

    Any suggestions on how I can find these files? They're saved as .jsons since thats what I set them to, I really wanna use this method because it allows me to make folders and organize my game in a way that looks professional,

    I can even hide my files in their x64 Program folder and work on a launcher for my game.

  • Apparently, using localstorage is a way to get around this,

    Based on what a couple forums have stated:

    " You can use LocalStorage to track which saves are in use, where you can iterate and delete keys. "

    My problem is, Im saving keys for each save slot, checking them, and deleting them, I am NOT clearing memory up on my system by this method, am I?

    In theory all that would be happening is I cleared a key, now that save cannot be used, so in other words,

    That save permanently uses memory unless I found it manually and deleted it.

    The best I could possibly do to make sure a player isn't gradually using more and more memory is by overwriting an existing save state with this method slapped ontop of it.

    It feels like an oversight, the only "risk" I've seen with giving people the ability to delete save states is the idea that you can delete system components with it.

    But this is an ENGINE, and I am a developer of a game utilizing it.

    It would be my job to make sure thats not possible, limiting file input types is already a thing in C2 and C3, furthermore, I can add name comparisons on savestates as a second security measure.

    I saw suggestions of running Javascript instead and people stated it was a " Hacky " method, I don't think so.

    Your using the engine to pass code, hacky would be like changing the engine itself.

    So, I was wondering, how does this whole

    " window.indexedDB.deleteDatabase('_C2SaveStates'); " Thing work anyway?

    Where do I input the specific json and how do I manipulate this line of code to include the target file?

  • I must be some kind of challenged, but finding the make new forum page button on this website is confusing,

    It literally took me a week to find it this time around.

    Its just not intuitive at all and I think part of that is to blame on repurposed servers from old C2 posts in favor of C3.

    I feel like it *should* be on the "Forum Home" page, with a separate link on the "search" page to give people the option to just, make a new post if they can't find what they're looking for.

  • Shame this went inactive after 21, now 22 posts.

    Looks like I'll have to start another sometime soon.

  • Getting a new issue that might stump me for awhile, picked count will pick the correct number of instances colliding with AIGroup,

    But occasionally it'll add 1 extra to that count, this is a tad annoying.

    Instances dont overlap it again, it just adds one to the final count.

    The event is triggered once for all overlapping instances,

    Oh it also SPAWNS IN with a count of 1, despite not overlapping any AI yet.

    My temporary fix is to just -1 from the final count and double check that its for each group rather than all of them, I feel like this is running from the issue and not actually fixing it,

    Any ideas?

  • Small issue, why does pickedcount only return one?

    So I changed the method of counting collided instances of my sprite "AIGroup"

    In my head, Pick by AI Overlapping my AIGroup Sprite, Set the value of counted AI to Picked Count.

    This only returns 1 for whatever reason, is picked count some kind of Boolean Expression where 0 is it picked nothing and 1 is something?

    Im kinda disappointed if so.

    I need picked count to return the number of picked instances, which it doesn't seem to do.

    Edit: I changed out my pick method to pick by comparison and it worked, I'm good now lol.

  • Definitely a welcome surprise to get resources for this,

    I guess this problem has become so much of a mess that the only thing everyone can do is throw calculators at it.

    Shame I'm taking acouple lenses off my scope, but I may come back in the future because for reasons I explained above,

    both of my solutions kinda suck in their own ways! So although they'd work fine I may need to swap them out for a formula generated by these calculators.

    I might know trigonometry, but I definitely don't feel like using that knowledge for anything more than operating a calculator lol.

    That plus I'm sure it'll work, that golden 1 line of code, 1 expression quota is too attractive for me to give it up.

  • Alright I've settled on a simple solution with a complex one being tried out in the future.

    Thanks for the website you gave me, it's an excellent resource to have, and thanks for the assistance; Really helped me think.

    The solution I settled on was just making a box, don't move it, don't do anything but count, and elect a leader from that count then finally delete the box once a horde is established.

    The lead makes a call to action zone, anyone outside of it isn't effected and is left behind.

    The call to action zone then makes a mid point, or final destination in its center which they all move to.

    Destinations are stored in a library, which I can curate by typing it in.

    Its not costly for performance, I don't think, they all behave in unison but can easily break off and do literally anything else if interrupted.

    Anytime a AI is interrupted but then left alone after a while, it returns to walking down that route.

  • Nope, it only follows and counts, I could have it change size to fit more but Id rather control that through a variable.

    Perhaps an elected lead soldier would have more influence, thus a greater horde range.

    In the old thread I did something similar to that line work with the only difference being a box follows the line at its middle image point, the square would change its width and height to equal the length of that line.

    It works but having that many instances all at once just to do something that could probably be done mathematically seems abit much.

    Itll fix my problem but make another one in its place.

    But yes, I know its anti-climatic but I literally am just asking how to make a box follow between multiple AI, only letting them go if they stray too far.

  • Looks like I am terrible at constructing sentences,

    No you are absolutely correct, sort of.

    Your assuming they all act in unison which I dont want them to, having so many chances to drop off means they all can act individually.

    I can change their AI behavior on the fly,

    but with the way you portrayed it, if a group of zombies spot you, the whole horde moves in unison towards you.

    This is good for zombies but Im not making zombies, lets use a different analogy, how about an army soldier.

    When they form a army, a leader is who sets the first goal to move, but at any point the player approaches an individual army soldier, they dont ALL jump on the player, its only the few that spot the player that do; Else, they continue moving along their path set by the leader

    when to many soldiers get close to each other, I want a box to spawn around them, count the number of soldiers.

    The box count is used to PICK from any zombie in the horde to act as the leader.

    When a leader is elected, the leader spawns another object, this object is a "CallToAction", it selects every soldier overlapping it ( its a large object ) and spawns yet another object which is a way point which sets the X and Y pos for their path finding to move towards.

    This part I can absolutely do, this is easy, its just the first step I can't do of making a box follow them to count everyone still in it.

    Any soldiers that don't hit the CallToAction are dropped off, they didnt make it, or they were too far away.

    Rereading my last post's order only made sense in my head, but yeah I can see how its confusing.

    The first formula you sent me was incredibly close to what I wanted, but the way it behaved upon further testing showed it wasn't quite what I was looking for, and on top of that,

    was not exactly what you said it did, here, let me post the original formula you made to see if I got anything confused:

    so for both X and y I did with adjustments for both obviously:

    AIGroup.x+300*((zombie.x-AIGroup.x)/sqrt((zombie.X-AIGroup.X)^2+(zombie.Y-AIGroup.Y)^2))

    so if I typed this correctly, the original formula said " hoard.x ", plus radius number,

    times Zombie.x subtracted by hoard.x,

    Then divide both by a square root of the power of 2, plus zombie.Y and hoard.Y to the power of 2.

    Upon further testing this seemed to have just worked like a lerp(), just longer written,

    It did have some weird effects to it that I can't quite explain where it looked like it was trying to get the position of ALL AI within that radius, but I imagine thats only because this effects all AI within that radius, so the box just teleports around trying to move over every single one.

    It did favor the first AI instance that initiated it though, so it usually hovered around it.

    Most of the solutions above either work but are impossible to add,

    Or don't work at all.

    I genuinely think its a misunderstanding thats stopping us from coming to a solid conclusion, this should be as simple as an expression, I just can't think of it.

    So instead of focusing on the whole goal I just need to know how you make a box follow multiple of the same sprites that are close to eachother.

  • First one is Cos or cosine of A and B, you typed it twice, had it been Cos and Sin it would give me a clockwise and counter clockwise view.

    Second one is asking for the number of zombies, which, I don't have.

    The point of what I'm trying to do is get that number which is why although I'm sure it would work, your adding the position of all zombies then dividing it by the number of them, I just don't have the number to begin that division.

    Also, I don't think Construct allows " ... ", I know some programming languages will take that as " so on and so forth ", but I don't think Construct has that operator.

    The website you showed me might be useful for future use, it looks like a generator which is super handy and might use for future projects, thank you for that, but unfortunately it looks like Ill have to keep looking.

    I have a solution under my belt which may work but it'll be quite complicated to create.

    But I dont want to do it if I know I'm absolutely sure it's possible to do this with a single expression, I think I'm close but perhaps we need extra brains to hop in on this thread to lend assistance.

    Thank you for your time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, yeah it looks like through further testing, "radius" isnt the radius the box will move adjacent, construct takes it as distance crossed each time the event is fired.

    In other words, if the event is fired once every 0.2 seconds, and its "radius" is 2 pixels, it will cross 2 pixels every 0.2 seconds.

    The goal I'm looking for is a box that follows the average of multiple AI instances, it is then used to count how many are in said box.

    The way it works in the gif is almost backwards in how I want it to work.

    A lead AI is not picked until everyone is counted. when a horde of AI is made, I.E they bunch up, a box surrounds them to count, then pick from that count,

    - this part I can do, as shown in the gif it counted two instances inside the box.

    But getting the box to follow multiple of the same instance probably means I need to approach this in another way.

    Thankfully I had just thought of something that may work, when a AI is close to another, I could store their positions in a library, if they get to far from each other they are removed from said library.

    Ill do that, unless you have an idea on how I could fix the above.

    I realize there was some confusion on what I wanted to do, sorry about that, but this should clarify.

CJD's avatar

CJD

Member since 22 Jul, 2018

Twitter
CJD has 1 followers

Trophy Case

  • 6-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

8/44
How to earn trophies