Pakost's Recent Forum Activity

  • I see

    I'm new to all that scripting/coding stuff so excuse my ignorance :)

    So you are saying Magistross that using collisions for detection also runs check every tick for all units? Not good.

    I'll try your approach and will run some stress tests.

    Thanks

  • Yeah Magistross I remember that well since it works fine for my woodcutter to find the nearest tree. In that case I needed it now and then when the last cutting tree gets exhausted.

    In this case tho, I need an event ran every tick. I imagine making calculations about every unit in the field every second gets too much.

  • Thank you both guys for showing that interest in the topic

    The calculations showed will help me great deal about some other stuff i need to implement so learning that trick is quite useful for me.

    Anyways, after a long evening in testing i think i got what would be the most comfortable for me to use. Since I am no programmer and my math is intermediate, and my trade is more like art orientated than coding, i prefer the visual than the logical approach.

    The 8 point collision poly is not quite accurate by me since i will have graphic appearance of the ellipse, so i divided an invisible object in 2 frames, each frame containing opposite semi ellipse collisions, so in fact i get a 14 pointed collision of the ellipse.

    <img src="https://dl.dropboxusercontent.com/u/19082408/789.JPG" border="0" />

    Blue line is the 1st frame collision

    Yellow is the 2nd frame collision

    I haven't yet tested it but i feel confident it should work as expected.

  • Thanks a lot for the answer

    Math is not my brightest side but i think i got the idea... I'll try it out tonight when i got home.

    The problem i see with this is that i should every second make this calculations about every unit on the field. Since i plan to have many units i dont know if that is the right approach. Maybe i should simply detect distnaces between the 2 units, and only if the distance is smaller then the largest radius of the ellipse, only then to make that calculations and see if the other unit is within the ellipse radius? What u think about it?

    Anyways if anyone can answer my question about the collision polys with more then 8 point i will greatly appreciate it, i was often wondering about it:

  • Hi guys

    I have a problem, or more like dilemma, about detecting units in elipse range. Here is what i mean:

    <img src="https://dl.dropboxusercontent.com/u/19082408/123.JPG" border="0" />

    So, as i see it, there are 2 approaches about this:

    • First approach is to make a collision surface, detecting foes on collision. That have many advantages, but one main downside - the 8 pointed collision polygon is not enough to make a decent looking detection. When trying to add more points (16 would be enough as i see it)it sais all collision polygons over 8 points are very havy.

    So there is my question: How exactly expensive is to have polygons with more then 8 point? (is having 16 point polygon twice as heavy as to have 8 point poly, or there is another cunning reason we shouldnt make more then 8 points?)

    If there is such reasons i can make it works by setting the sprite with 2 frames, both to have slightly different 8 pointed collision polys. So i figure if i play the animation fast it will detect foes for both the yellow and the blue collision polys.

    <img src="https://dl.dropboxusercontent.com/u/19082408/456.JPG" border="0" />

    • Second approach is to make it by detecting distances. But the problem is, because of the camera angle, i want it to be an ellipse, not a circle. Im not sure if that is possible to make with the -Get Distance To-. The only way to achieve this, as i see it, is to have a hidden layer with all the foes and rally points, and keep it scaled so it becomes like top view (not even sure its possible).

    Anyways, if anyone have any thoughts or advices for me, and most of all answer of my 8 pointed collision poly question, pls dont hesitate to write.

    Thanks for baring with me and my problems ;)

  • Hi guys

    I'm making an orthographic kind of game. Its not top view, but 3/4 or something, so I'm trying to simulate the perspective, meaning units walking up and down move slower and moving sideways move faster. That i managed to make quite simply, and i think it feels alright (just changing the pathfinder speed along with the sprite animation for direction).

    My problem is that i cant make the pathfinder find a path, obeying that rules (when destination is up or down, the cost to be higher, and when it's sideways, the cost to be lower)

    Sadly I think i cant do that, not with the pathfinder as it is, and my programming skills at so low lvl as they are.

    Anyways i thought its smart to ask before cutting that out. So anyone have any idea how to do it?

    Thanks

    NB: You can get the idea if you start the game and create a barracks.

  • I think i got it running.

    I had some problems like ome6a1717 said, adressing the units.

    Since the unit is in the family, it seems to detect the distance to itself. So here is what i did

    For each Unit

    distance(Unit.X, Unit.Y, Family.X, Family.Y) < 20

    Unit.UID not= Family.UID

    I got a lot of work on the movement of units, so its really smooth and logical, but i think i got the main idea.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks TELLES0808. Looking at it now, at work, where i cant start construct2 to try it out, is hard for me to understand, but i think i got the idea.

    Tonight ill try it out.

  • You are right TELLES0808, comparing distances seems better than collision checks. I guess an For Each condition is on order so this happens every time units are too close.

    That leaves me with the second problem - the action.

    The units are supposed to gradually push away from each other. Even more it's supposed to have in mind all other units around it. Frankly I have no clue how to achieve this.

    Any ideas?

  • Hi guys

    As in all rts like games i need my units to push away from one another, so they dont's stack if not too many. I wanna do it the right way, so the collision between them must be smooth, meaning units should keep certain distance between them, unless they are pushed closer by other units or obstacles.

    I've searched the forums but couldn't find post about this (maybe i dont know how to put it in words), and i think its common matter so maybe a little brainstorming is in order.

    Performance is an issue too, since i plan to have many units per layout.

  • Thanks a lot for the interest of that thread guys.

    Yann your approach is good for using z ordering only when i have to move buildings or character. Unfortunately my game is supposed to be more like tower defense with many units, so there will always be units going up and down.

    Would be nice if i could move up and down in a layer only a certain class objects, having in mind the position of the others object in that layer, because most of the objects i have are static, but they need to be arranged every single time along with moving (units) objects. Since all the z ordering is structured by go to top and bottom of the layer that is impossible, I'm afraid.

    C-7 thanks for sharing this technique, its really simple, the way i like it, but unfortunately it wont work for me either :(. I need all the objects to be in one layer, ordering by z, so i can have taller units than the buildings. This works only if the characters are shorter than the building roofs. Anyways at least i can do that for the objects that surrounds the playable area like cliffs, woods etc, so they don't get arranged.

    Btw your game looks fantastic.

    When i got the game to alpha or something ill make some stress tests and decide for good what I'll do but for now i think I'll stick with the easiest way - leave shadows with the objects and let them stack :)

    Thanks a lot guys for sharing your thoughts.

  • TELLES0808 im not quite sure but i think this z order plugin does quite the same. The only difference by me is that it arranges sprites on X also, if Y is the same.

    But since this events runs per tick, and im planning to have alot of objects, i wonder if it will still be in no importaince to the performance.

    Anyways, if i find a way to make those masks from the sprites in construct, so i dont double the imported images,its worth a shot. But I couldnt find a way to change the blending mode of a sprite with an action, so i suppose that cant be achieved.

Pakost's avatar

Pakost

Member since 4 Feb, 2013

None one is following Pakost yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies