Pakost's Forum Posts

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • OMG Yann thats a brilliant idea you got!

    You are right the towers dont shade each other correctly but i got a solution.

    Here

    Instead of getting all masks on top of the shadow layer i let them along with the shadows to arrange in the layer the same way as the main layer stuff.

    So now when the object is infront of another, the mask of the front object is over the shadow of the object in the back so it doesnt shades.

    That works as a charm. There is one major problem though.... That way i got all the objects in the game multiplied by 3, as object count and as sprites. Even more i got them all ordering by Y (not sure if this affects the performance).

    Btw is there a way to make the mask out of the object sprite in construct2, so i dont have to double the sprites in game?

    Anyways for my project i think i'll stick with the simpliest way. Have all sprites along with shadows and live with the overlapping glitch. Sadly but i think that technique will get too much for the performance.

  • Thanks for the answers guys. And for all the praises. I'll try to explain better what my dilemma is.

    I'm using z order plugin for all the sprites. The best way is to cut the shadows and let them arrange along with all the objects. Even better, if I left them with the object (most of the objects are with their shadows atm) they usually get good results.

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

    But the problem is that when you get 2 shadows on top one of another, you get double dark shadow. So my best option atm as i see it is to leave it like that(the object count drops x2).

    TELLES0808, I hope there is something i really dont understand about blending modes, but i dont think if all stuff are at one layer, the shadows, even seperated from objects, can blend correctly, cutting only other shadows out.

    So my second option is to gather all shadows and place them in a layer, and the layer gets 50% opacity, so the overlapping of shadows look good but there are another issues. Z order plugin works only per layer, so all the shadows would be over or beneath the sprites in the main layer.

    Yann here are some examples of the downsides of that option:

    Shadow is in upper layer:

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

    Shadow is in lower layer:

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

    And last GenkiGenga i dont think hiding shadows on overlap is good idea... it will result some popping. My best hope is that it can be achieved with some kind of blending mode or something, but i really dont see how.

  • Hi guys

    Im making an orto game where i plan object to have shadows.

    I guess all shadows have to be in one layer and the layer to become transparent, so the different shadow sprites wont overlap, and get darker.

    But here lies my problem. If the layer is placed below the main layer, no objects will be shaded, only terrain. And if the layer is placed above, objects will be always in the shade.

    So anyone knows how to deal with this?

    Maybe there is another way to blend shadow sprites transparency, so it's always 50% transparent for example?

    Thanks

  • Works like a charm.

    It took me some hours to understand and implemend it but finally i did.

    Thanks both of you guys, and Magistross thanks for the example. Couldnt do it without it.

  • Nice :)

    It may work in my case but I want to make a woodcutter searching for the nearest tree to cut. Maps could be quite big so the elipse will get too huge.

    If there's another way i would prefer it.

    Anyways i'll keep that in mind im sure i'll use it in other cases. Thanks.

  • I was wondering what is the best way to make the function Get Nearest to work not in circle but in elipse for faking perspective in ortho game?

    Thanks

  • Thanks for help guys. I thought it can be done only with For Each expression but it seems i was all wrong (not my first time :). Ill defenetly check the tutorial newt, thanks.

  • The problem is i want to add 1 to zz only once. If i put it with For Each event it starts continuously adding.

  • Hi guys

    I want to do the following:

    <img src="https://dl.dropbox.com/u/19082408/ForEach.jpg" border="0" />

    For each Sprite when instance variable aaa becomes 0, to add 1 to global variable zzz only once.

    Any thoughts how i should do it?

    Thanks in advance.

  • Thanks for help guys.

    Im kinda blocked with work at work atm, but once i have some time i'll test those options.

    Cheers

  • Thanks for the time you guys spend to help with my problem.

    I'm mere an 3D artist so I'm trying to keep the game as simpler as i can. Math is not one of my best skills.

    mystazsea I think i got what your idea is and it sounds reasonable, but still i prefer using the z order plugin, it saves me a lot of headache.

    R0J0hound i tried several times to understand the tutorial you linked, before i post that question. Well I'm helpless :)

    Anyways i figure i can do this:

    <img src="https://dl.dropbox.com/u/19082408/WallCut.jpg" border="0" />

    Cut the walls in half horizontally. So the upper part covers the units behind the wall, and the lower is staying behind the units infront of it. Problem is that there should be no taller than the cutline units and sprites but i hope it wont be a problem.

  • Hi guys

    My question is simple

    Is there a way to select sprites not by collision polygons but by visible pixels or something like that? In my case i use On mouse clicked on object.

    Thanks