farflamex's Recent Forum Activity

  • I thought I understood how For Each worked, but apparently not and I've been stuck on this one all day long.

    Hard to explain so I'm attaching an image. This is the exact code as it runs in my program (not the original code, but in my frustration I've had to hack it down to this, to try to work out what's going on).

    <img src="http://www.soccerstar.org.uk/foreachimage.png" border="0" />

    The text boxes show two different values. There is nothing else in the code, this is exactly how it's set in my program right now. The top text box (outside the for/each loop) shows the correct value that's stored in the tile variable. The one inside the loop shows a different value.

    I don't understand what's happening here at all. My understanding of how this SHOULD be working is, it runs through the loop and when the tile with those X/Y/Z coordinates is picked, it will then show that tile's value in the text box, which should of course be exactly the same as the one above.

    Presumably I'm doing something wrong, and that 2nd pick isn't picking the same tile?

    To add to this, this isn't the original code. In the original code, it doesn't do a 2nd pick of 'ShipTiles' at all, it's attempting to push all of the values in the tiles into an array. So the code inside the loop in the original (which also doesn't work) just says ('Put ShipTiles.Condition into Array.At(X,Y,Z)). It puts the wrong values in. So in that case, it's not doing a 2nd pick of the Shiptiles object, which may be partly what's wrong above.

  • The stuttering has mysteriously gone away today. No idea why, if anything, I've added stuff to my game since yesterday, so it looks like it's nothing to do with C2 but something to do with my PC.

    To Tokimson, I found that a blank project ran at a steady 60fps. I tested it yesterday while my game was stuttering, but it ran at 60fps and never changed. So I dunno what's causing that on yours.

  • Ok, I tried it in r114 and it's still stuttering, so at least it's not that. The Chrome update seems like a possibility, otherwise it's just a coincidence that it started on the same day as the update.

  • I know you can download them, but it won't let me load the game in because it's been saved with r115. Is there a way to get it to load in to r114?

  • I've found IE9 to be really bad, not only does it run very slowly (like 30fps) but it seems to be running in the wrong resolution. Unfortunately I don't have another computer as good as this one to test on. I guess it could be something in the background interfering, like a virus scanner? When it first started, the drive was whirring away for no apparent reason, so maybe something else is happening.

    On the upside, I tried to think of a way of getting rid of some of my objects and managed to trim 300 without affecting my game - infact I think it's probably improved it, so some good will come of this :)

    Is there a way of downgrading to r114 just to test?

  • I've tried removing all of the objects that I recently added to my game, knocking it back down to 500 objects, along with all of the extra bits of code I've added recently which are all in seperate groups, and the game still stutters quite badly.

    Unfortunately I don't know how to get r114 working now because my game is saved in r115 and won't load back in to r114.

    But something does seem to have changed. Between the update and the Chrome update, I seem to have picked up some very noticeable stuttering :(

  • That's a very good point which I forgot to mention. I upgraded to r115 yesterday and it was yesterday that it started happening.

    And now you mention it, I think I saw a message in the corner of my Chrome today saying that it had auto-updated.

  • I first noticed this a few days ago when testing on Firefox, but put it down to the FF GC which people have mentioned. I did some optimising anyway even though it was running smoothly at 60fps in Chrome. In particular I removed about 500 objects, but those were on seperate screens anyway and that didn't change anything.

    Since then, I've put more objects in my game and I'm now up to around 1300 objects in total. The majority of these are still on the seperate screens - information screens which run at 60fps and don't require decent fps anyway because they're static. But now my game is starting to stutter on Chrome too (on the arcade screen which only has about 200 objects showing at most) and runs around 55 to 59 fps. The stutter appears to be exactly once per second.

    I've tried testing my latest code additions and disabling them, but it still stutters. The slowest of them takes 0.004 seconds to process but I've set that to process only once per 10 seconds, so it can't be that. I did think that my optimising might be causing this, because I set loads of calculations and other stuff to process once per second, so there's no calculations them BAM, everything calculates on the same pass. But I've changed these to 1.2 seconds, 1.3 seconds or more, to try to get them to process at different times. Still no difference.

    I've also tried disabling each group one by one, but nothing is making a difference. I did disable almost every group and it started to run smoothly again but obviously I can't delete 75% of my game.

    Is there anything else that could be causing this sort of stuttering? Could those 1000 off-screen objects be a problem, even though they're on invisible layers? Is there anything else internal to C2 that might cause this sort of thing?

    I'm afraid I can't supply a capx because my game is over half done and I really don't want to show it yet.

  • You're right, in my game at least that's becoming a factor. The enemy ships are faster than the player and the bullets are faster too, making them hard to dodge (impossible if the enemy gets right ontop of the player). But if I make them too slow, it's too easy to just run away. Difficult to balance, but hopefully I'll find the right balance with endless tweaking :)

  • Thanks for that capx Yann. The amount of comments are very useful for helping to understand how this works. To be honest, in my case, I'm fairly happy with just pasting the code into my code, all that math hurts my brain. But it's good to know it's doing exactly what I wanted :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In terms of making the AI less accurate, I needed this in my case, because I have ships firing several lasers at once. Obviously if they all just fire at the precise angle, they'll overlap each other and just appear as one laser, which isn't what I was after. But the simplest answer for me was to just add a random angle to the result, somewhere between -5 and +5, so give a nice spread of lasers.

  • Actually your capx does contain that answer I was looking for. Basically I wanted to know if I could repick the same objects without ruining the initial pick, I see that I need to do a 'Pick all' before the 2nd search. It wasn't so much that the 2nd search was spoiling the first one, more that the 2nd search couldn't find any matches because the first had already limited the search to nothing.

farflamex's avatar

farflamex

Member since 7 Oct, 2012

Twitter
farflamex has 15 followers

Trophy Case

  • 12-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies