How do I, couple of questions (Performance & odd behavior)

0 favourites
  • 4 posts
From the Asset Store
A collection of various characters spritesheets for creating a 2D top down, RPG, tower defense, or other similar game.
  • Hey guys,

    So I have this game (http://goo.gl/HEFZBH or the forums' thread if you prefer scirra.com/forum/space-whackinator_t111739) and I have a couple of questions, some of them are general others are specific to problems. Not sure where to post exactly (and I didn't want to post multiple threads so I kind of figured one would do, if that is bad, let me know I'll shoot it down)

    The first question is about the player movement. I have the setup below.

    Every Tick > Set Player.X to Mouse.X[/code:vv47vsc9]
    
    That is fine, however in the game one of the enemy types shoots a snare bullet at the player. So I wanted to slow down the player's movement. I tried something like below:
    
    [i](note the "wait" isn't nested sub event it is just the formatting messes with how it looks. They are both on the same level same as below too).[/i]
    
    [code:vv47vsc9]Every Tick > Set Player.X to Mouse.X
    ---------------> Wait (0.2) seconds.[/code:vv47vsc9]
    
    That practically did nothing. So I tried something else. 
    
    [code:vv47vsc9]Every Tick > Set Player.X to Mouse.X - 5
    ---------------> Wait (0.2) seconds.
    ---------------> Set Player.X to Mouse.X[/code:vv47vsc9]
    
    That didn't work either. I thought I am thinking of this the wrong way, instead of "lagging" the player sprite. Why not apply a "lag" effect on the mouse itself. There was no such option. Then I tried to put the player's timescale to 0.3 and that didn't affect the movement, only the animation of the sprite itself. 
    
    So I am not sure exactly how can this be done using mouse (I can and was able to do it EASILY with keyboard but mouse... is proving to be elusive).
    
    [b]This above has been resolved thanks to LittleStain.[/b]
    
    The second question is memory. Now since this is the first game I have done in Construct 2 (aside from many others using tutorials and some stupid stuff to get to know the software more), I don't know much about the memory thing. It says on the toolbar 297 MB. I am a little concerned by that due to the fact that I feel I don't have a lot of things going on. 
    The project has about 15-20 sprites of which 4-5 has animations (1-3 animations per) and each animation is average 4-6 frames. I feel that 297 is too much (my initial target for the game is web or standalone .exe stuff like an offline game, if there is interest I might port it to mobile but I am not going there just yet). Is that a correct feeling? Or am I being paranoid? If I am correct, what can I do to enhance this?
    
    Third question is weird behaviors (actually 2 in one):
      1- When I launch the game and test it, sometimes the ball hits walls/enemies/rocks multiple times in succession (as it is cornered for example between a wall and an enemy) and instead of bouncing it goes through the wall/enemy as if it wasn't there. It is rare and doesn't always happen, but when it happens it breaks immersion/looks extremely weird. Is there a way to counter this behavior?
    
      2- Behaviors that happen in specific browsers only. Now I had someone test the game on both Chrome and Firefox (I only test on Chrome for now). They mentioned that in Chrome everything is fine (as I test it) and all walls function pretty well (aside from the occasional above problem). But when he switches to Firefox things get strange. The top wall in the game suddenly becomes "hollow" and things tend to move through it almost consistently. They mentioned this only happens on Chrome... now what exactly does Chrome do that Firefox doesn't that causes this? And how do you deal with specific browser problems such as this?
    
    Sorry for the long post but these questions have been boiling up for a long time and I have been putting them off. I do appreciate you reading this and definitely thank you very VERY much for trying to help/your time <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />
    Vallar.
  • I would try using lerp (linear interpolation) for this

    something like:

    every tick player set position x=lerp(player.x,mouse.x,0.5) y=lerp(player.y,mouse.y,0.5)

    the issue with the walls could come from the bullet missing the collisions due to speed

  • That just worked like a charm with the lerp! Thank you very much.

    As for the missing of the collision, the ball's maximum speed was about 400-500 at that level. Hardly ground breaking... nonetheless is there a way to fix this aside from slowing down the ball? As the game as you see does depend on it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bump still having a problem with the other issues:

    1- Now since this is the first game I have done in Construct 2 (aside from many others using tutorials and some stupid stuff to get to know the software more), I don't know much about the memory thing. It says on the toolbar 297 MB. I am a little concerned by that due to the fact that I feel I don't have a lot of things going on.

    The project has about 15-20 sprites of which 4-5 has animations (1-3 animations per) and each animation is average 4-6 frames. I feel that 297 is too much (my initial target for the game is web or standalone .exe stuff like an offline game, if there is interest I might port it to mobile but I am not going there just yet). Is that a correct feeling? Or am I being paranoid? If I am correct, what can I do to enhance this?

    2- When I launch the game and test it, sometimes the ball hits walls/enemies/rocks multiple times in succession (as it is cornered for example between a wall and an enemy) and instead of bouncing it goes through the wall/enemy as if it wasn't there. It is rare and doesn't always happen, but when it happens it breaks immersion/looks extremely weird. Is there a way to counter this behavior?

    3- Behaviors that happen in specific browsers only. Now I had someone test the game on both Chrome and Firefox (I only test on Chrome for now). They mentioned that in Chrome everything is fine (as I test it) and all walls function pretty well (aside from the occasional above problem). But when he switches to Firefox things get strange. The top wall in the game suddenly becomes "hollow" and things tend to move through it almost consistently. They mentioned this only happens on Chrome... now what exactly does Chrome do that Firefox doesn't that causes this? And how do you deal with specific browser problems such as this?

    4- Is it better that one can use Webstorage (for ingame store) + the normal save/load (for saving and loading the game normally) system built in Construct or would Save/Load do the trick for both uses?

    Thank you very much for reading and trying to help

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)