nimos100's Forum Posts

  • You cant, there is only one collision map and there are no workaround, its unfortunately just the the way it is designed in C2.

  • I can't see why it would be better to make it in Illustrator rather than PS, when the files get imported into C2 they will be converted anyway.

    The biggest benefit of using vectors to make graphics in this case, is that you can scale without loosing quality, but that is lost when imported and converted to a pixel based one. So I would suggest that you use what you think is best.

    However it might be easier to do animations with vectors, as you can drag things around using the control points etc.

    If you are looking for a good vector program, I would recommend Inkscape which is free and easy to work in as well.

  • That's cool.

    Do you know why the overlap events is faster than the collision one ?

    To be honest, I have no clue according to the manual, even though its not an in-depth explanation they should do the exact same thing.

    But did a test of "On collision", "Overlapping" and "Overlapping with optimization" all screenshots are taken after its started so it changes a little bit up and down.

    As you can see, the "on collision" and "Overlapping" is practically the same in the one named "Low object count", however the CPU util and FPS is highly different. Strangely enough if you look at the Collision checks /sec, its only 43513 for the "On collision" while its 80812 for the "Overlapping" even though the approx. collision checks per tick is higher for "On collision" than overlapping. Regarding the optimized one, there is not a lot to add, think the numbers speaks for it self, and it have no problems with such a low number of objects.

    On the "High object count" however things goes really from for "On collision" the performance was so bad, that it couldn't even register the amount of collision checks. However the CPU again goes to max and the FPS drops massively. Where as the "Is overlapping" gives a lot better performance, however still uses a lot of CPU and also take a quite big hit to the FPS. And with the "optimized" version it is barely noticeable, except it also uses a lot of CPU, however it doesn't hurt performance FPS wise.

    So what exactly is going on with the "On collision" I don't know, because I would assume that "Is overlapping" is doing the same amount of checks as it does, at least according to the manual. And the optimized version as you know, is based on that it only cares about which object it can collide with that are also the closest, so it logically reduces the amount of checks needed to be made each ticks by a lot.

    But would probably need Ashley to explain it, because I don't think its possible to find the answer in the manual at least. So its just something to be aware of I think, if performance drops, you should make sure to at least not use "On collision"

  • That's quite interesting. Can you attach the two capx ?

    Its just a single CAPX, you just have to enable/disable different parts. I added commentary to it, so you can see which one controls what. Not that its that hard to figure out. But just so you don't think both should be enable at the same time.

    [attachment=0:fokh2r5m][/attachment:fokh2r5m]

    Another solution that might work if you need sprite objects, is to create them when something interact with them, and that way you replace the tiles with objects. That way you can probably reduce the amount of objects needed at one given time.

  • In the case that it filling the whole screen I would make it a bit different. Since if you have more huds, i would reuse the background and instead use a smaller sprite to control the Hud, but basically its the same solution.

    [attachment=0:2f7jbjlq][/attachment:2f7jbjlq]

  • I managed to achieve what I wanted : http://canapin.com/construct/tolilo/07/

    I noticed the game slows down when there are many projectiles on the screen.

    My guess is that the event "projectile on collision with block" (where block is a sprite) iterates over all the block sprites, which are still about 4000. So, if there are 10 projectiles on screen, it iterates over 10*4000 tiles on a tick. Is that right ?

    So I guess I'll going back to tiles and find a way to manage stuff like timer regeneration for reach tile.

    You will eventually kill your program when using so many objects, because the moment you have to check vs any of them, it will add a lot of tests, which will rapidly build up.

    Also the way you do collision check is of great important when it comes to performance, which you wouldn't think. I did some testing of this some time ago and here is two examples. They are exactly the same, only the way collision is handled is different.

    The first one uses "is overlapping" including some optimization that I added. The second one uses "on collision".

    If you try them don't press the "1. Spawn objects" more than 2-3 times, the program will kill your browser, as its was created to test performance when doing collisions.

    After you have done that just press "2. Remove overlaps" and then "3. Increase speed by 25" to increase the speed of the objects. (The program was made as a test so, don't spawn objects while its running, there are no error handling in the program so it might crash or bug <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">)

    Personally I test it in chrome, since my internet explorer is causing problems all the time, reducing performance in general.

    "Is overlapping with optimization"

    https://dl.dropboxusercontent.com/u/109921357/Performance%20Test%201/index.html

    "On collision"

    https://dl.dropboxusercontent.com/u/109921357/Performance%20Test%202/index.html

    So as you can see there is a quite huge difference between how you implement collision in C2, a general rule is to never use "On collision" it will always give poor performance, compared to "Is overlapping" and with optimization you can improve the "Is overlapping" which is impossible with "On collision".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not really sure i understand what you mean, but the way i make UI elements such as an inventory screen, is to design it using whatever is needed and place it outside the play area, the exact way I want it to appear on the screen when the player opens it, Then ill put it on a layer normally named "Hud" as its the layer with parallax of 0,0, and then I pin all the elements to the background (A sprite or more commonly a 9-patch) of what controls the particular UI element during start of layout.

    After that I just make a simple function that will either hide or show (Move off screen / on screen) the element when needed. If I need the UI element on more layouts, I simply make all of it global and include the event sheet that controls it.

    So whenever you have to use the hud, I just make a call to a function "Show/hide inventory" for instant and it will automatically switch between showing or hiding it. Which can be done with just checking whether its "On screen" or not. And in the case that its going to show the "Inventory" in this case, I would hook it up to whatever would be needed when the inventory is shown. For instant load all the items carried, calculate weight etc etc.

  • [quote:25tdsuvr]And that would work with the expected performances ?

    You would most likely get a bit of performance increase I would guess. But still your program would have to keep track of all the objects.

    With a tilemap you are working on 1 object containing a lot of tiles, but it is still one object and the benefit of that, is that you can assign a tile graphic which can be a lot smaller than the actual tile object. Meaning that you could make a tile object be 5000px x 5000px with 500x500 tiles of 10 by 10 pixels. And still maintain a near zero performance impact, due to the graphic it self not being more than an 1024x1024 image, and reused for all the tiles.

    However the more loops you use to go through the tilemap will ofc have an impact as its still a lot of tiles. But comparing the tilemap in this case, which would be 250000 tiles all in 1 object, to have 250000 objects, which C2 would have to keep track of, the tilemap solution would work, where as the object solution would most likely kill your program performance. So I think regardless of how you organise your objects, you will never get the same performance as with a tilemap. And the more things you do that involve your objects the worse the performance, which I would guess will decrease rapidly, ofc depending on the amount of objects.

    In my game Dragonhelm I think it uses a tilemap with around 70000 tiles for the world map which I do some generating stuff for at the beginning of the game, but its almost don't instantly and have near zero performance impact on the game it self afterwards, since its just 1 object and I don't have to loop through it all the time.

  • Have seen you answer other questions on the forum, so know you are not completely new to C2, so thought you could use a little challenge, Cheers

  • I don't want to give you the exact answer, but instead give you a hint, that can help you figure out whether its possible or not.

    Right mouse click....but where?

  • Also its probably better to create it when you need it, so you don't have it around when not needed, like so:

    On collision with Enemy
           Create Object txt_Endgame at position (X,Y)
    
    On click btn_RestartGame
           Destroy txt_Endgame
    [/code:3nmhilh1]
  • I actually had this problem as well at some point, which also killed one of my games. However you can add the effect to the layer instead of the objects. That will improve performance by a lot.

  • Yeah you just have to install it to wherever it installs or where you want it. C2 will figure it out automatically I think, well at least if you use the normal install path. Then you will be able to use it as preview browser in C2 and add the nodeWebkit object to your project as you would the mouse controller.

  • Not really sure why it doesn't have an unfocus. But a way to workaround it, which is not pretty, but works is to make a button offscreen, and in the "On slider changed" you add "Set focus button " and then "Unfocus button"

  • Definitely not all that much into mobile apps, but I do believe I have read that there might be problems with those UI elements, such as button and sliders etc. As they are not like a "normal" objects, but are form control elements or at least they used to be, but not sure if that's the case anymore. As you normally wouldn't be able to draw anything above such objects, but it doesn't seem to be the case anymore. But regardless I would assume it still have something to do with that anyway somehow.

    Edit:

    You cant draw above them, just me not thinking straight

    So they are still Form elements and will always go to front, which will cause problems now and then, that's why you normally don't use them for anything except testing purposes, I would say.