tarek2's Forum Posts

  • Rhindon In a sub Event

    Is touching object

    SubEvent >On any touch end >>>> Do your actions

  • My first Construct 2 game Résumé Run is out now on Google Play!

    Rise to the Occupation!

    In this world, you’ve got to put yourself out there to get what you want. Résumé Run puts that power at your fingertips, but you’ll need the skill and will to match.

    Run, jump, and unleash an array of power-ups while working your way to the top. Hand out as many résumés as possible before time expires! Get promoted by collecting new résumés, applying to hiring managers, and defeating bosses!

    Each playthrough is unique, requiring new avenues and shortcuts to save time. Can you climb the vicious corporate ladder and become CEO?

    How far will you go to get the job? Download Résumé Run today!

    https://play.google.com/store/apps/details?id=com.rodrigosantelices.resumerun

    Hi BeastCoasting

    you should check your Game it may be something wrong with your App as it doesn't allow me to download in any of my devices it says none of my devices are compatible.

    My Devices are:

    Samsung Galaxy Tab A SM-T585 16GB Black, 10.1

    Samsung galaxy s8

    Are very new Model devices that's why I'm surprised

    I'm from the UK if that helps

  • tunepunk Thanks a lot for the capx that's a great example it definitely improves performance a lot but in my case what I win in performance I lose it on accuracy ending behaving a bit jumping as they can be 4 or 5 famili1 instances at the same time touching one sprite. is a bit complicated and demanding I will keep testing

    Thanks anyway for your help take care

  • tarek2

    16 objects doesn't sound like a lot. Care to explain how it works?, maybe I can come up with something more efficient in your case.

    Are they all checking distance too eachother and get picked if colliding?

    That's what I thought is not many and the problem they will be more on the gameplay, at the moment I'm testing just to see where are the limitations to have an idea.

    Yess that's right 16 objects on the screen and say like (150 of the screen) they are all instances of the same object even I stop everything off the screen, I use a family to check distances between them and make sure they don't check distances with their selfs by filtering the UID of each one and them when picking the family don't pick this Uid wich mean himself so they check distance against all the other ones on the screen.

    To give you a perfect Example of the mechanics is like (Agar.io) when you split and has to stop the overlap between your cells you can be split up into 16 pieces and all of them they cant overlap they have to move next to each other

    I'm not sure if I explained properly haha

    so say 170 instances of one object is the total

    from those 170 instances, 16 are the player and the rest are the enemy

    I filter the 16 instances for the player by instance Variable say Var = "Player" to identify them

    Then check the distances between this 16 instances

    For what I see the problem can be when I filter pick the ones with Var = "Player" c2 will have to loop through the whole 170 if I'm not mistaking and all of this every thick, even if I put another condition first like (is on screen) or (is Active)

  • Looking Awesome!! good job man, I was a big fan of Ninja Gaiden looking forward to seeing the final product

  • Thanks a lot tunepunk for the capx and the tips

    I do use at the moment all the ones that you mentioned the (Line of sight, Is on screen, boolean is Active) etc... but the cpu still goes high when I'm checking distances just between 16 objects on the screen, the only one that I didn't try yet is like the test you did putting all 16 UID in a list and just keep checking distances from that list but I'm not sure if this is even possible to do, I been playing with your capx to see if I can make it work but no luck, I see there is a new feature in c3 that it looks interesting that I didn't know existed the one you use in your capx the plugin "Picked" I may this can help to put the picking in list and just loop through that list I will have to keep testing.

    For my purpose, I need to be able to check distances every thick between the objects on screen and depends on what distances are then apply some actions to them so I need to refer to them one by one independently is quite complicated probably to make it work with a list

    And I agree with you the best results I had from all the Tests that I did, the Line of sight was the winner all the time is very optimized

  • Hey tarek2 thanks! I wanted to have the game out this year before xmas, but im not sure Ill be able to achieve that at the rate Im going!

    What are you working on at the moment?

    Artpunk I just saw your post by luck I didn't get any notification haha

    Yeah man, it happens all the time just keep it at it I'm sure you will get there, xmas is the best time though people love to spend on Xmas.

    I'm working in a game was inspired by Pacman and Agario some kind of fusion jaja is a very funny history how I choose this Game I was tired of starting projects and leave them after some time, until one day I said enough I'm gonna do a very simple game for mobile so I can start and finish at list one game, so I chose this game as I calculated is gonna take me two to three weeks and is one year past already and I don't see the end yet any near I'm going crazy with this I had so enough of this game that I just wanna put it out there in any state like it is now but I keep going lets see, the main problem now left is the performance is a lot of distance checking between objects very often, and I can't-do much about it as the game needs that, so I'm still looking for tips and solutions for the loops, let's see what happens if I finish this game will be a Miracle I end up choosing the most difficult game that I could find by mistake.

    But I did have good things swell, example another main reason I started this game I wanted to get experience with C2 so this game was perfect I learned a lot about picking and many different stuff so has very positive things and I feel like I improved a lot with C2 which is great.

    once I see that I have something solid like there is a chance like I can release it I will post some pictures.

    Take care

  • I don't know if this work for you, but I sometimes use dictionary to store picked UID's. That way the for each loops doesn't have to loop through a whole family, but only the ones stored in the dictionary. That might work when you have many units in the same family, but let's say 20 out of 100 selected, as you don't have to loop through the 80 that are not selected. I found it to have some performance benefit in some cases.

    For me the picking itself seems to use a lot of cpu in some cases, so i try to find ways to use some more lightweight way of picking objects. Restructuring the condition order can help a lot too.

    For example:

    For each unit (loops through all units)

    is Selected. (then picks and filters the ones selected)

    insead use.

    Is selected (pick the selected ones)

    For each unit. (loops through only the selected ones)

    Small things like that can help a lot, but you probably know that already. Trying to filter down with conditions as much as possible before running any for each loops and actions, seems to work pretty well in most cases.

    Hi tunepunk I show you did an interesting test on this very good test Thanks

    Did you manage to find any good results or ways how to improve ?? I will be very interested in that

    do you know if is possible example you have 20 objects on the screen the idea is to take the UID of all those 20 objects and just loop between them checking distances between them and depends the distances do some actions those objects, is it possible without looping through the whole 150 instances that are not on the screen

  • I have the same problem and still looking for a solution I hope someone can give us a good hint, I got 16 objects checking distances between them so when is in a empty project with just that 16 objects works ok and when I put the same code on my main project where they are like 150 instances of the same object the CPU goes double and triple doesn't matter how much I filter it with boleans and conditions and all kind of tricks is not working and this is just to check distance between 16 instances on the screen

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • tarek2, Nice, you got it!

    Many thanks!!! Be blessed.

    No problem mate, I'm glad you Fixed

    [quote:3r8zyll6]Someday I'll have this skills

    You have already the Skills you did everything by yourself and is looking Great

    Haaah too bad I just noticed a big hole on my capx on the (Else) I left it open even when you close the Menu it will still keep running and checking his Actions, that's what happens when you do millions of things at the same time and quickly, sorry for that I'm pretty sure you corrected already but here is a corrected capx just in case. The popup Button should work better swell before sometimes use to get stuck

    Take care

    https://www.dropbox.com/s/rscirg288hbewpq/SlidePopup4.capx?dl=0

  • Oooh I see, you simply use Object.Pin.PinnedUID . Nice tarek2, many thanks man! Be blessed.

    No problem

  • There is some way to identify in witch object the pin object is pinned?

    Like: ObjectA > Is pinned to ObjectB > Do this

    ObjectA > Is pinned to ObjectC > Do that

    Hi something like this?

    Object A here = is represented by the Text Object

    And ObjectC, ObjectB etc.... = is represented by the sprite object

    Note: I apply the actions to both Objects but you just remove the object that you don't need to apply any actions

    Example:

    ObjectA > Is pinned to ObjectB > ObjectA Do this & ObjectB do that so you just delete one of them

    https://www.dropbox.com/s/up58pnl34jrcv7p/PinnedTo2Who.capx?dl=0

  • rbailey83

    Your Welcome mate I'm glad it was helpful

    And about the Last question about the Enemy fight:

    I think everyone has different ways of doing things so you will find that to do one particular thing you will able to do it in many different ways and you just choose the one that you feel comfortable with and that you find it easier to understand just in case you need to come back to it to update and make changes the only exception to this is the end result "Performance" so however, you choose to do it always look which one is the best performance that's one rule that you cant break I guess

    For what I see on the pictures:

    -One thing that I quickly see is that on the Event (20) >>>you don't reference to which tile is because you have only the Enemy_Ork in the picklist and you didn't pick the tile there so it will not work as intended, if you wanna do it that way you need to pick the right tile with the ork then that action knows to which tile needs to apply the action

    -On event 21 the same you don't pick the tile beforehand so all the action that you apply there you apply them to all the tiles in the game as is an unreferenced object

    -Event 20 and 21 have the same "Condition" >>>EnemyOrk.Health is = to 0 or less to something, you could just move the actions from event 21 to event 20 is the same thing you don't need extra checking the same thing

    ======================================================

    Now this is how would have done it, will be easier if we simplify

    We have all the code running from if only you click the tile and the tile is "not Active"

    so the easiest thing will be to make the logic to the inverse for the "Enemy Fight"

    Example:

    On clicked Tile

    Is (not active)

    we have done all the code for that

    Else (The Tile Is Active)

    And is the Enemy = Then Action: Call for the Enemy Fight

    Capx: https://www.dropbox.com/s/2v0ypg746c6n3pf/Tiles%20Spawn%20Objects4.capx?dl=0

    For what I understand if you Fight the Enemy and you destroy it the tile of the Enemy has to be inactive again to be able to interact with it again and I guess all the neighbor's tiles that the enemy looked before has to become inactive swell to be able to interact with them well if I'm not mistaking

  • nevermind, i created a new project and looked from that and the function is showing, just wasn't showing for me when i tried looking for it in the example project you sent me

    Haa it may be that you had it already added to your project because once you added to your project you will not find it anymore on ad new objects because is already there and ready to use:

    This is the how is working on this new capx:

    Everything starts if you touch a tile

    On touched Tile:

    And the tile is not active meaning is untouched yet >> then choose random animation

    Then if the chosen animation is equal to "Enemy" then we call for the overlap check on the neighborhood

    Else: if is not the "Enemy animation" then we don't check overlaps just set the tile to active meaning that has been touched already you cant touch it anymore, and set the "Animated" to true this is to avoid any more animation change on this tile as will happen the scenario that will check for overlaps in different tiles and their neighbours and this one will be chosen again so by checking the "Animated to true" will be skipped

    If the Enemy has been chosen:

    Then The Function "CheckOberlaps" will check and do:

    -First, we filter to do the check to the none "Active Tiles"

    -One more filter don't check for the enemy tile which is = to Function.Param(0)

    -Then we proceed with the condition to check for the overlap

    Action: All the tiles overlapping and that meet the above Conditions >>set them to Active true

    Nex event on the Function:

    Pick the Enemy tile who called the Function = Function.Param(0)

    Action: set him to (Active & to Animated) true to avoid any further checking or animation change on him

    Last event on the Function:

    Now we pick all the ones that where Overlapping and the ones that haven't been animated yet = meaning still untouched

    Action: Then change animation & random choose Frames

    Action: set them all of them to animated = you cant touch them anymore

  • datiel12

    Your welcome mate, take care