TMAJA's Forum Posts

  • Damn, I noticed this problem a couple of months ago when I tried to swap to the 2.0.2 compiler. I was really hoping it would have been sorted by the time they forced us onto 2.0...

    Who is at fault here. Is this CocoonJS or Mopub that are screwing up?

  • No worries, honestly I love working through these little problems, and its been interesting to test out different things!

    I cant be sure on wether the behaviour is frame rate independent, but considering 'simulate control' effectively runs every tick, you would imagine it might be affected by frame rate changes. Try experimenting between that and the bullet behaviour for best results is my best guess. As is so often the case, wherever possible playtesting should give you the answer!

    Glad to be of help!

    Hi SeriouslyCrunchy,

    You've been a huge help - this topic has been very interesting! One last question though:

    Would I be right in thinking: System| Every tick - Player Object| Set Platform vector X to Self.X+250*dt

    Is regulating the X movement of the player object by dt therefore making it frame rate independent?

    This doesn't really seem ideal though...

    As far as I could tell after some quick prototyping the platform and bullet behaviours aren't actually frame rate independent (unless someone knows otherwise). This is obviously a problem for me so I need a way of making the movement robust to changes in frame rate!

    Any suggestions?

    Even after a few years programming I'm still yet to realise it's never, ever simple!

  • TMAJA

    Yes, this is getting interesting. We have two ways of doing this, and I honestly think both are viable. If you were to follow the infinite runner template example, you would have to hard code in what 'time' each object would need to spawn at, with its corresponding X and Y co-ordinates, which honestly is a bit of a pain, but would clear up any performance issues.

    However, I'm convinced you can still use scrollto quite happily! So I've spent a few moments editing the infinite runner template and using your approach instead. I think now the best way for you to try this is to edit the way your player character moves forward. You could either give the player character the Bullet behaviour, or if you're already using the platform behaviour, have it so every tick you simulate control of the player character in the direction you need them to go.

    Heres the quick capx I cooked up using the bullet method, if you want to try the simulate control on every tick method, remove the bullet behaviour from the player character and enable the event in the event sheet : https://dl.dropboxusercontent.com/u/245 ... ollTo.capx

    The only way I can see this not working so well is if you need more control then that over your player character.

    Hope this helps!

    Hi SeriouslyCrunchy,

    Sorry it took me so long to reply on here! Your capx was incredibly interesting to inspect, and I have actually changed my characters movement to the simulate control method! Thank you very very much for your informative answer and taking the time to provide some example code; amazing!

    I have come across another related question though - as I am now using the platform behaviour and simulate control to constantly move the player object forwards, is this behaviour frame rate independent? Obviously frame rate can be pretty changeable on mobile devices and my previous method was robust to those changes. I had a look in the manual and it actually doesn't say (unless I have missed something)!

    Thanks!

  • Lordshiva1948

    Thank you!

    SeriouslyCrunchy

    Yes your spot on - the difficulty curve is quite specific so at the moment objects need to be in a fixed location.

    Again your exactly right - having a lot of objects does cause some pretty huge headaches performance wise, especially on lower-end devices. The strangest thing is though, even on high end devices (where the frame rate sits happily at 60) the screen still seems to 'vibrate' as the player is moving. That's why I was originally wondering if ScrollTo was actually the best way!

    I will honestly look forward to your reply, I'd greatly appreciate your continued input - It's a pretty interesting topic!

    (Also while your tutorial isn't 100% relevant to my question right now, it is a well written guide which I will definitely be using in the future!

    Thanks

  • Your game sounds less 'flappy bird' and more 'infinite runner', although flappy bird is of course an infinite runner in itself in a way, so some of the same principles hold true. Have you had a look at the infinite runner example in C2? I also wrote a small tutorial about infinite runners, but I don't think this covers what we're discussing right now.

    I'd like to see a .capx if possible of your attempt with ScrollTo. In my experience, the issue with using ScrollTo for infinite runners is that it in my opinion it gives you less control over certain aspects of the game. Object instance generation and termination are much easier to handle, for example.

    Hi SeriouslyCrunchy,

    I have to admit, I haven't actually looked at the infinite runner example - although I just had a look for it now in the example projects and couldn't find it at all? Do you know what it's called?

    Would you link me to your tutorial? Any and all opportunities to learn are always welcome even if it is not 100% applicable here!

    Unfortunately I cant upload my capx - but I can describe to you EXACTLY how my ScrollTo works.

    My ScrollTo behaviour is implemented on my player object (by just adding the behaviour from the behaviour panel).

    My player object then moves forwards like so:

    PlayerObject| Set X to Self.X + 240 *dt.

    My levels are pretty long (14,000 px horizontal) but not infinite and have a variety of different objects within them!

    Am I doing this the best way?

  • Is there any other reason other than CPU use for you to use ScrollTo? Are there some special events that need this?

    I have to agree with rezagamertag above. As you rightly say moving many objects is more CPU intensive than just moving one, but I'd say in most cases doing it this way will save a lot of headaches in the long run over using the 'ScrollTo' action. Just don't forget to terminate objects that fly off the side of the screen.

    Hi SeriouslyCrunchy,

    Nope, I was using 'ScrollTo' because I thought it was the 'best' was of doing things. It just keeps the camera focused on the player object as it travels through the levels, that all.

    By best I generally mean best for performance; as the game is on mobile devices performance can be an issue!

    Although I did make flappy bird comparisons only the movement is really the same - things get much more complicated after that - levels are certainly much more diverse.

    I'm guessing there is a tipping point somewhere; where the size/complexity of the level eventually makes it so the 'ScrollTo' behaviour is the best way forwards?

    Thanks

  • I would keep the player in the middle and move the entire background / objects to the left.

    This way you don't need ScrollTo.

    Hi Rezagamertag,

    Interesting! Why would you take that route - I must be wrong in thinking moving many objects is more CPU intensive than just moving one?

    Thanks for your input!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi everyone,

    I guess this is more of a 'what's the best way' rather than 'How Do I' but here goes:

    I have a platformer style set-up except my character constantly moves forward (like flappy birds for example).

    Whats the best way to keep the character in the centre of the screen? I'm currently using 'Scroll to' on the player object - but it seems to produce some stuttery effects as the screen moves (not lag - everything else is smooth). Is this really the best way?

    Thanks!

  • I'm using CocoonJs.

    I've tested it and the issue appears across all of their compiler versions 2.0.1, 2.0.0 and 1.4.7: compiling for the Google PlayStore.

    The app has no problems saving or re-loading the data normally. But when I push a new update through the store it doesn't re-load the users scores.

    (Thank you so much for looking at this topic its a major headache for me).

  • "Usually you'll be able to change your project and old games will still load just fine. " - Versioning

    Ashley Sorry for dragging you in here; but I would be hugely appreciative if you could clarify this for me! Does the above mean the 'save' feature will survive the mobile update process? Is it better to use that instead of webstorage?

    Thank you

  • Pretty much exactly. It's strange though - someone must have a solution for this?

    When I'm reading through the documentation on saving the wording seems to suggest this shouldn't actually be an issue - does anyone know if I would be better swapping from webstorage to using the 'save' system?

    p.s thanks for checking this out brunopalermo

  • Hi brunopalermo,

    your answer is spot on - thank you very much! I wish I could give you some 'rep' for such a good answer (the qr code was a lovely touch)!

    Since you were so good with this problem would you consider thinking about this issue? I wouldn't usually cross post but this is a major headache for me.

    "https://www.scirra.com/forum/how-do-i-stop-the-players-score-being-lost_t108964"

    Thanks for your time

  • Hi everyone,

    so I have a mobile game which (no surprises) uses webstorage to save the users score.

    Problem: When I update the app via Google Playstore (or Apple App Store) the users score is lost!

    Am I missing something simple here or is this a limitation of web storage?!

    Thanks for any help at all - this is a major headache for me!

  • Hi everyone,

    I have a 'clicking counting' problem in which I want to prevent the use of multi-touch.

    Basically I want the system to only count one touch at a time, not two touches if the user presses both fingers on the screen at the same time.

    I know there is a way to do this using variables, but is this the best way?

    The app is for mobile.

    Thanks!

  • Well, that all depends on the platform, if you want it mobile CocoonJS, IntelXDK or NodeWebkit, you can check put their respective plugins, they probably have some kind of quit trigger

    A possible way would saving when loosing focus

    Hi Whiteclaws,

    Sounds like a great idea - how would I go about checking respective plugins? I've just had a look but I can't see a manual entry on that...

    >

    > > When do you change the score?

    > >

    >

    > Hi Newt!

    >

    > The user score changes literally all the time. Its a kind of banking app, so the user score is always going up.

    >

    > Any clues?

    >

    It was a rhetorical question.

    As in the the obvious thing you missed.

    I've really thoroughly thought about this and I'm just not seeing it? Maybe I'm just being an idiot! The score changes every tick...and surely I cant write to web storage every tick - that's going to be much worse more taxing on the hardware than writing every minute?

    Sorry if I've totally misunderstood!

    Hi, nice question

    I wonder how to do this too since lot of users exit with home button, open the task manager and swipe the app

    How about saving every tick but I think that will make the phone work very hard, isn't it?

    Hi ijoin,

    Thanks - yeah this has been something that's been bugging me for a while! I steered clear of saving every tick - I try to keep the number of every tick actions to a minimum anyway as they can be pretty hard on the limited resources on mobile - never mind if your actually writing to web storage.

    Thanks everyone!