Ruskul's Forum Posts

  • - With a good naming system, it is true... But I would postulate that the better the names the longer it takes to type. In a programing language, these variables would be better split among objects or static singletons that are a snap to access.

    In Construct -

    LevelSpawnPlayerType = something.

    in c#

    level.Spawn.Player.Type = something.

    Autocomplete doesn't work in construct until you get far enough. LevelSpawnPLayerT... if another variable LevelSpawnPlayerLocationX or LevelSpawnEnenmy... or som on exists. In other IDE, splitting the variables up allows you to access them using auto complete which would function at each level of organization. That's the primary reason I stick them in objects as opposed to using globals. Also, the variables clutter up your expressions list every time you start typing in expressions. But if it works for you the way you do things, great, keep it that way!

    I should also point out I suck at typing and the more help I get the better. Too slow! I fail at typing in the same way. lol

  • Kyatric - sometimes its funny how solutions can be so easily overlooked. Its like I'm looking for a complex answer and don't notice the simple stuff sometimes lol. Thanks.

  • The Sprite.pickedCount expression gives that info.

    Well twidle sticks, it would be that easy now wouldn't it

    Thanks for your help, always the champ with the answers.

  • Colludium - Thanks, I was just on your steam page a few hours ago, good to see your making progress. Any luck with the green light?

  • +1 about this^

    I was going to suggest a feature for Construct 3 to have a tab in the debugger that displays the current SOL.

    +10 for that, that would be usefull!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Refeuh - Hello,

    Colludium nailed it, The platform behavior is solving the collision as best as it can before you get to even test overlaps. Its not a bug at all and it actually is consistent in what it is doing and why.

    When a collision is resolved in construct 2, there is a certain level of error due to floating point calculations and the type of resolution being performed. If it were guaranteed that collision objects were on a grid pattern and were square, you could calculate resolution perfectly... but as it is there can be up to a 10th of a pixel of error. You can google floating point math errors, and polygon collision detection to get an idea whats going on here.

    On the second badguy, the collision resolution phases of the platformer behavior pushes the player completely out of collisions and then some. It all has to do with how far the object intersected the solid and the type of "push out" that was performed.

    I have had to deal with this a ton in my game, but it isn't a problem that is game ending. You can simply create another animation (OverlapTest) and a frame for your player object that has a collision polygon that is 1 pixel larger than your polygon normally used by the platform behavior. On the rendering side of things, Your player object should be slightly larger than your collision object. This way you get the whole narrow escape but no unfair hits aspect to your game. Let me know if you have any questions regarding this.

    Ashley - I believe this is all correct and similar to something you told me several years ago, please correct me if I am wrong.

  • Hey ,

    I read around and can't figure it out. How do I have an image as my signature?

  • 1. I need a language that gives me a solid foundation of programming and doesn't give me any bad habits when migrating to harder languages such as C++.

    Start with c++ if that is your goal. The idea of learning on language to learn another is a bit of a waste of time and a bit of a round about.

    Nothing wrong with c# though. Visual studio is a great ide, c# is not closer to c++ simply because it has c in its name. It is closer than python though.

    Python is super easy but... idk. I don't like python or javascript. I like strict typing, if you know what that is... and that leads to better dev practices if you are wanting to move to c++

  • There are many ways to go about it but... for the most basic way:

    What I would do is get the angle from the npc to the player.

    You can then set the npc frame to round(angle/45). Set frame 0 to be facing east, frame 1 to be facing south east and so on.

    Does this make any sense?

  • Hello,

    Is there away of knowing how many objects have been included in the sol? For example A overlaps B. How many B exist in SOL?

    I Have a character that can break blocks but I don't want him to break more than 1 at a time.

    My thought was that if he overlaps more than 1 then I select the one closest to him, otherwise I can simply destroy the one he overlaps. Similar would be if Mario jumped and hit 2 brick blocks and broke them both at the same time, which I don't want. Only one.

    Thanks

  • newt - For sure, if I understand what you mean by setting up a variable comparison, I do that lots now. conditions = set variable to 1. After that check the variable, if it is 1 then do stuff, or similar setups.

    My biggest trouble is that I've noticed you need* "for each family loop"s with multiple function calls for scaleability. When functions are used as a design element to make your game scalable and manageable. For example, in my game, every dynamic object affected by world forces (gravity, wind, etc) is in a family called characters. The player, bullets, enemies, etc, are all in this family and this family must call 3-4 functions minimum but may call more. If you only have a few characters, no problem, but for every function I add, I exponentially impact my performance. Knowing this, I design more around less function calls. I'll see what my performance is in the end before taking drastic measures though

  • Ashley - but why would anyone need that?

    I didn't provide a capx because it hinges on my explanation... Which if its supposed to work like that... but I don't understand... why would anyone need that? Its not like they couldn't just select it from the panel? And a properly optimized tilemap usually won't have a whole lot of continuity as far as tile relations go.

    I've attached some gifs that illustrate the problem a little better than words can.

    In this first gif, I begin by creating a slope. I want this slope to repeat for a while but there is no good way to select a larger shape, so I build it block by block for the most part.

    https://www.dropbox.com/s/l1dhtl55qx9b1 ... p.gif?dl=0

    The real kicker comes when I want another slope, that looks the same... or perhaps that I need to move the slope over by 2 blocks... I can't. But if shift click drag copied from the tilemap and not the source, the built in tilemap becomes... well, usable. For example:

    https://www.dropbox.com/s/sgydlsj4s2b9p ... s.gif?dl=0

    I remember Tokinsom having talked alot about this a while back, and I recal alot of people getting excited over simply shift right click copy, which is super handy, but its handiness exponentially grows with dragging. Being able to rotate and flip these selections is the ultimate tile mappers tool. But I know for one thing Tokinsom wanted to be able to copy from the map not the source when he mentioned drag copying...

    Again... I don't understand the need to copy from the source, unless you have a rather redundant source image.

  • Your test includes things like comparing adding 1 to a variable to adding 1 to a variable in a function. That's exactly the kind of a test that basically just measures the overhead of a function. Functions already pretty much do the minimum work they can do, I'm not sure there's any obivous way to speed them up, but that's not to say they're slow. But I guess you might want to avoid them in long loops and such.

    For sure, I was basically looking at function overhead, comparing using functions vs not using them. I was curious though... would there be a way to create event sheet references? Sometimes a function only makes sense from a readability people thinking sort of way if that makes sense. Sometimes functions make sense from a program design standpoint. Would there be a way to have event sheet functions that are only in the event sheet?

    For example:

    If (object.A overlaps Family.Tilemaps) && (object.A.bool == Family.Tilemaps.bool)

    ----Do this, do that, push out of solids, bla, bla, bla, bla.

    If (object.A overlaps Family.SolidBlocks) && (object.A.bool == Family.SolidBlocks.bool)

    ----Do this, do that, push out of solids, bla, bla, bla, bla 20 actions.

    If (object.A overlaps Family.MobileBlocks) && (object.A.bool == Family.MobileBlocks)

    ----Do this, do that, push out of solids, bla, bla, bla, bla.

    REpeat for a few more condistions

    The above can be split into functions, and is preferable for readability and making changes to what happens, But in a game with many itterations through this, the function adds overhead. Whats more the function isn't needed, just a convenience for later editing. If there was an editor side function that could be called that would inline the events on export so that no overhead was created, that would be preferable.

    At the same, the only reason this pattern exists is because there are no combo or/ands in a condition tree. But that is a separate topic. (why is this?)

    for example : (A over B && A.x == b.x) || (A over C && A.x == C.x) || so on...

  • newt jayderyu megatronx Ashley,

    I should be clear, the actual time it takes construct 2 to execute a function can be up to 5x longer than another action single action. Just the calling of the function. (You may say, well of course you would never simply just call a function, but that is not true, (dynamics switch replacements may call functions that don't exist and other cool function uses may call a blank function)). As Ashley pointed out, a tiny thing can execute fast, and even though the functions take longer than that, they are still fast. Compared to a simple event like adding 1 to a variable, calling a function and doing nothing is quite a bit slower.

    Its nothing I would worry about, unless you are like me, where in my project I had been willy nilly splitting everything out into functions. I was never repeating code. But usually, a function can require much more than simply calling it. You must construct its name in a dynamic system, pass it a parameter (usually a uid) pick the object by uid once in the function, and finnaly do what needs done. Usually another function is called where you pass parameters and then use the return value. Thus functions are in functions. Its something that happens alot in programming.

    Now if you are doing this everywhere and only doing a few things in each function (maybe 2-3 conditions, 2-5 actions), you are really decreasing performance relative to the alternative. If you are doing many more things, like running an entire ai tree from one function call, the function use is irrelevant and has basically 0 impact on performance (unless you need to call it 1000 times a tick, but still, you probably have other worries at that point in terms of performance)

    I have attached a capx that hopefully demonstrates the problem. The capx shouldn't be too hard to understand so if a test doesn't make sense, just read the events in the relevant group or ask me. I chose 1000 cycles every tick arbitrarily. I would say, in a decent sized project, it is easy to expect to be doing at least that much work every tick, but it really depends right?

    For the most part, If you do everything in javascript that you can, and use the event system to wire everything together performance will be great. and has been my dev method for the last year. I once made a collision detection algorithm in construct, it was around 2,000 events. I thought it would be fun lol. The java script version barely has an impact while the event based version took a chunk of cpu to run eveyrtick. I think this is to be expected...

    Anyway, I like to create tests just to see what takes time and what doesn't, it has helped me to determine when and where I should put things in javascript rather than events. I also am master and chief at prematurely optimizing, but its my favorite part about coding. If I am in a hurry I don't fiddle too much with it lol.

    https://www.dropbox.com/s/0xhwlwrwq9b1xtx/EventTypePerformanceTest.capx?dl=0

  • Or just make global object with boo's. I am actually finding this much more comfortable then if I'd have to scan trough globals and locals.

    Well, I must admit I do that as well. lol. In large projects its no good to use global variables. There are too many of them and no way to organize them. But I would like to use local variables. They are a bit more meaningful than saying set TempObject.TempBoolean to false