DialgaBrite's Recent Forum Activity

    So I was reading an article here on scirra about too much memory usage, and how to avoid it.

    Firstly, I want to thank you for how specifically and throughly you worded it, without using tons of terms that can go over people's heads. I can offer the same praise to the C2 manual, if I haven't yet done so.

    So, I decided that my game's memory usage was slightly too big, but not too terribly (141 MB, and you said to keep in less than 100). However, although I managed to reduce the "estimated memory" by about 11MB, I couldn't find too many more images that were extremely big, or too many junk ones that I was willing to remove.

    So this prompted me to write a message there. After I posted it, I suddenly decided it was better off posted here to allow the possibility of more in depth discussion. So here is my message, take it as if I am saying it here and now as opposed to past tense.

    -----------------------

    May I ask how big of a difference it is to avoid redundant events, conditions, actions, etc and stuff?

    For example, having a variable with 20 possibities, and then putting 20 "if" type events instead of simplifying it into one event that checked it.

    Like for example, 30+ playable characters, the events for changing their animations, and a variable that corresponds to the index of the character being played as (each character has both a numerical value and an "internal name" string). It now sets animation by name to things like currentplayername&"stand" currentplayername&"walk" etc instead of having a large list of events for every possible character. But as some characters are also animated differently, there are actually about 5 or 6 of these "large lists" as different possibilities. There is one variable that gets checked to determine which one is used, rather than having a bunch of "or" conditions for all the characters. However, said "or" events still happen at the start of layout just to set this value. It's just not checking all these conditions every tick anymore.

    I also have some uneccessary things, like, weapons that use no energy, still have energy variables, and also check to make sure they never go above the maximum energy or below zero. And also these weapons to still have energy bars that are animated accordingly. This type of thing is used for consistency, and just in case to allow for future possibilities. But, is the difference in memory usage worth being inconsistent if leaving this type of stuff out makes it lag less?

    Also, every possible enemy (currently 8 boss objects and 6 normal enemy objects) has a collision event with every possible bullet object (currently about 30+), due to the weakness/resistence stuff. I want it to be flexible, and allow infinite possibilities, so there is no rulebound "elements" that these weapons are tied to. Almost every single one of these events also has two sub events, to check whether or not the enemy was killed or not from the hit it just received. I am uncertain whether or not coming up with some kind of system for using families to lessen the number of events would be essential or not. I don't mind making all these events, especially with the inclusion of "replace object" after duplicating and highlighting lots of stuff. Only if it has a large effect on memory usage or lag, do I wish to try to change this.

    I would like to know if this kinda thing is even worth doing, and if so, by how much?

    And given that I have already simplified lots of this type of stuff, am I making it sound like my changes were good enough? Perhaps I didn't even need to do them to begin with? Sorry if this is too vague. I don't expect you to see into my mind completely, just get a feel for the type of thing I have described, if you possibly can.

    ---------------

  • Angles are cyclical so it's not reliable to use linear comparisons with them. 225 degrees = -135 degrees = -495 degrees etc. If you're making a comparison expecting 225 degrees, you will fail to match the other mathematically equivalent cases, in particular -135 degrees.

    I'm aware Construct 2 in some places uses a 0 to 360 value, and in others it uses -180 to +180. But this is just a quirk of the way the equations work out and does not matter if you use angle-aware comparisons and calculations.

    The Sprite object's angle conditions ("is between angles", "is clockwise from", "is within angle") are cycle-aware so you should always use them instead. For example any of these conditions would work (followed by the same condition inverted for the other case): "Is between -90 and 90 degrees", "Is within 90 degrees of 0", or "Is clockwise of -90 degrees". I note that you're using a behavior's angle of motion instead of a sprite object, so it's kind of awkward to use those conditions (you'd have to have a dummy sprite set to the bullet's angle and use the sprite's conditions...) so I've put on the todo list to port those conditions over to the System object so you can use them for anything.

    I would really appreciate that. I was finding it pretty annoying that the "angle" had more useful conditions and actions than the bullet one, even though I couldn't use it without rotating the graphic unwantedly. Also, the bullet behavior has "compare speed" and "compare distance", but not "compare angle".

    Also, thank all 3 of you for actually being helpful. I mean, I admit some of that math stuff actually did go over my head. But at least you actually told me what needs to be done.

    I should also point out though, specifically in regards to the first of the three posts, that I wasn't always getting -135 for bullet behavior at 255. On another file (the one that guy uploaded), it returned -180 instead. When I tried using debug text in my own game, one time I even saw a negative sign with no number even. And then, angle for "moveto" had what I think was 255, actually return 40 point a bunch of digits, even though bullet never gave me decimals. Nothing was seeming to make sense or be consistent for me at all, even a little bit.

    I wound up doing what I want using moveto, but in a different way that doesn't check for angles. I guess this is still something that will take me a while to learn. but it's not gonna stop me from doing what I want to do and spreading love. <3

    Here is the final result of what I was trying to do here.

    I <3 cures.

  • this update illustrates the decimal issue

    You misunderstood why I supplied the capx. I'm just showing the values aren't what you think. I'm not suggesting it is the answer to your mirroring issue. 'at all'.

    I just noticed the second file turned on "set angle" for the bullet behavior. How many times must I say that I do not wish to rotate things? This must be OFF. And it still tells me absolutely nothing about decimal numbers, the possibility of them, or answers any of my questions.

  • this update illustrates the decimal issue

    You misunderstood why I supplied the capx. I'm just showing the values aren't what you think. I'm not suggesting it is the answer to your mirroring issue. 'at all'.

    You do know that file is completely unchanged, right?

    Also, I did not actually wish to download an unstable beta just to open it. Thankfully I have 2 computers and the ability to uninstall stuff. But it wouldn't have been so bad if you had at least warned me, but more importantly, had a better overall tone with me.

    Please. I just want legitimate help here. I am getting kinda annoyed, so sorry for my tone.

    So somebody, please either tell me something specific and obvious that is just going over my head, or say "this is just weird" and draw attention to the idea that it might actually be a bug.

  • Alright, this is just beyond rediculous. When using text to debug my own game, it was giving me negative numbers. 225 (left-up) became -135, while 315 (right-up) became -35. And checking for those numbers, and/or the ranges that included them, still didn't make the events work, either. And the bullets still moved in the correct directions despite this.

    I really truly feel like this is a complete bug now.

  • I took away the movement you gave it, ran it and pressed no keys, and it said this:

    I do not understand this. It sets it to 225 at the beginning, but doesn't equal it?

    Remember, I said in my game, the bullets WERE moving at the angle I wanted, despite not being recognized.

    Can someone please enlighten me on how this is happening?

    Can someone also please enlighten me on how an angle can equal -180? I thought it was always a number from 0-359?

  • Sorry for the changes; check my updated post above. Will check your comments now.

    edit: if you set angle to 225, it will probably be 225.00000031 or something internally. But yes a range check should work in this case.

    edit 2: as always, without a capx this is largely guesswork as other events could be affecting the ones that you've shown

    Even in your example, this is not mirroring it. At all. Even though I am blatantly checking for the same exact number it was just set to. And rotating it will not help me, as I have said I do not want to do that.

    edit: made a mistake, gonna try again. sorry.

    still doesn't. >.<

  • An angle will rarely be an integer value.

    edit: it's not an integer value thing (still a valid point though), but check the capx

    The word "integer" means whole number, right? Please correct me if I am wrong.

    But if I am correct, then I am setting it to one in the bottom event, and then checking for that same exact same number immediately after.

    In the top event, it shouldn't matter, since it's a range anyway, so a decimal number would still fall under it.

    Ok, Try something like this :

    ("side" is a instance variable )

    your question is not clear. if it is not the answer, give a little description

    Firstly, why is the instance variable even necessary? It appears to affect nothing.

    To clarify what I want to do, I want the bee to face left or right, however it also chases enemies, goes upward diagonally if there are no enemies, and therefore, can go in any possible angle. I want whether it is mirrored to be determined by the closed possibility, based roughly on which half of the circle radius the direction falls. With the way I tried to do it, it worked almost always, except when it was going up-left diagonally (not quite sure about possibilities for specific numbers other than 225) And I want it to be "angle of motion" for bullet behavior. As far as I can tell, the regular "angle" variable is tied to the image being rotated, and makes it go al upside down and stuff, and I really don't want that. Also, I just tried exactly what you showed me (with aforementioned bullet behavior variable instead of angle). And what it did was, only ever mirror if it faced exactly dead left. Nothing is making sense anymore.

    And so you know, the bee already moves exactly the way I want. The trouble is ONLY the mirroring, and getting the conditions for such to recognize the angle correctly.

  • When it's set to 225, the top event does not trigger, and the bottom one DOES - aka, a complete inversion of what it should do.

    I tried it in many different ways, including using a completely different behavior - the "custom" one in pretty much the exact same equivelent way. The angle of motion is definitely traveling in the correct way, but it is NOT mirroring when it should and the conditions seem to be firing completely wrong.

    I narrowed it down in the smallest way possible.

    The middle event does not trigger here.

    I am at a complete loss here.

    Some quick help would be appreciated, assuming this truly is not a bug.

    I am using the most recent version. I wasn't before, but updating did not fix it.

  • I think the exported exécutable name is linked withvthe name field no matter what, but you should be able to rename it after export.

    As for the icon, only solution I know is with the program "ressource hacker", once again, It is indeed weird that this is not a default setting in C2

    Thanks. Too bad it's not as easy as it seems like it should be. Can't expect Construct to be perfect though, not when it has helped me improve hugely due to being way better than MMF in ways that are small but important and plentiful.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • bump

  • So I decided to change the game's "name" field, to have its full name - "Cute Rokko Chan & friends" instead of just "rokko". But I still want the exe file to be "rokko.exe", but it has become "cuterokkochan&friends.exe". Is there anyway I can change the file's name separately from the name field?

    Also, how do I change the exe's black hexagon shaped icon? Any customizable icon settings I found only affected things like the loading screen, and the exe file's icon did not change.

DialgaBrite's avatar

DialgaBrite

Member since 1 Feb, 2014

None one is following DialgaBrite yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies