Madguy's Recent Forum Activity

  • I'm currently attempting to create a minimap that looks something like the one pictured here:

    http://wip.warpdoor.com/content/images/ ... n_shop.png

    I'd like it to be a 1:1 representation of all of the tiles on my randomly generated map, with each tile taking up a single pixel, which would make it around 160x160 pixels. To accomplish this, I'm using a tilemap where the tiles have a height and width of 1.

    The problem: This seems to cause a performance issue. Under the Profiler, I can see that having this minimap on the screen causes my Engine usage and Draw Calls to double or triple, which in turn makes the overall CPU usage much higher-- enough to potentially cause frame rate issues.

    If there is some alternative solution to creating this sort of minimap, I'd love to hear it. Considering the minimap is static for the duration of the level, it seems like there must be a more efficient way to accomplish this within Construct 2 than displaying an entire tilemap on the screen.

  • Sure, here you go:

    https://www.dropbox.com/s/beczig6sgpctmb2/FunctionTest.capx

    This capx includes the two versions of the code. The second version is commented out.

  • I'm guessing this is a known issue, but I haven't been able to find anything about it on the forum history. It looks to me like simply calling a function is using a larger amount of CPU power than I would have expected.

    As an experiment today, I wrote a very simple condition that looks like this:

    Test Group

    For Each PlayfieldObject

    If Variable1 = 1

    -> Set Variable 2 = 1

    There are about 40 instances of the sprite PlayfieldObject. Looking at the profiler, Test Group is using a very small amount of CPU memory, like <1%. Not bad considering this is running every tick.

    Then, I rewrote the code to incorporate a function:

    Test Group

    For Each PlayfieldObject

    If Function.Call("testFunction) = 1

    -> Set Variable 2 = 1

    On function "testFunction"

    If Variable1 = 1

    -> Set return value to 1

    To my surprise, this caused the CPU usage for the group to spike past 20%! Same basic functionality, the only difference being that in the second version of my code, I've used a function as one of my conditions. (and just to note, placing the function as an Action causes the same CPU spike).

    The game I'm working on has a lot of stuff going on at once (lots of AI characters, pathfinding, etc.), and while I'm attempting to be as efficient as possible, this concerns me, as I have a lot of functions being called on a regular basis-- not necessarily every tick, but I have some pretty extensive AI code that runs 5 to 10 times per second for each nearby character, and utilizes a lot of functions.

    Ashley is this something you were aware of? If this isn't something that can be solved, it seems like this might be worth a mention in the Performance Tips article?

  • Ashley Holy crap, I made a breakthrough on this, and I think it's a legit bug-- though it's likely a pretty rare one.

    My Pathfinding Cell Size was set to 64, and Cell Border set to -35. Kind of an odd choice of settings, but it worked well for me, EXCEPT...

    Check out this screenshot of my 10240x10240 layout-- the areas in red are the collision cells, which are created using the algorithm from the example pathfinding capx.

    http://tinypic.com/r/2n0j0he/8

    There's a horizontal line of collision cells missing! And yes, this ONLY occurs when the window size is at certain settings like 1920x1080! If I change the Cell Border to other settings, that missing line fills in! Bizarre!

    I'm going to investigate further and write up something official..

  • Here's a screenshot of the problem in action:

    http://postimg.org/image/ca9epgr7b/

    The highlighted object is attempting to path through a wall, which you can see by the node arrows close by (they use the same algorithm as the demo project that comes with Construct 2). It looks like he's actually aware of the wall to his north, but not the one to his west, since he's attempting to path around the wall to his north, but not the one to his west. Which makes no sense, because they're using the same tilemap.

    The wall is part of a tilemap that's been given the Solid property. All characters in the game were given the same pathfinding properties and custom obstacles (including the tilemap) and had their obstacle maps regenerated at the same time, and most of the others in this same scene are pathfinding around walls properly.

    Aside from a really bad cell size/border, what could cause something like this to happen, and so inconsistently at that?

  • Thanks for your quick reply. It made no sense to me either.. I'll investigate further and attempt to whip together a .capx.

  • I wanted to address this issue here before writing up an official bug report-- It’s probably going to take me some time to get an easily reproducible case of this in a .capx, and I wanted to see if it’s a known issue or if there’s some sort of workaround.

    Up until recently, I had my game running at a Window Size of 1280x1024. I switched the size to 1920x1080, and started noticing some issues with my objects’ pathfinding.

    Occasionally, my objects (which are using Custom Obstacle Pathfinding movement) would attempt to path through walls (which were added as a pathfinding obstacle once, shortly after the start of the layout). I have not been able to reproduce the issue with any sort of consistency. It’s like the pathfinding just occasionally decides to give the object an incorrect path with little rhyme or reason, causing the object to walk into a wall and continue trying to walk through it until pathfinding is stopped. According to the debugger, a path has been found for the object-- apparently it’s just a bad path.

    After extensive testing over the past few weeks, I’ve determined that the pathfinding issues do not occur at 1280x1024, at all-- not once. Literally, the only thing that I change for this testing is window size-- none of the game logic is changed at all. Simply put, the issue occurs regularly (if inconsistently) at 1920x1080, but not at 1280x1024.

    Ashley (or anyone else who may have dealt with this), does this make any sense to you? Is there anything in the pathfinding code that would be affected by window size? Like I said, I’d be happy to provide an example .capx and write up an official bug report, but I don’t want to waste anyone’s time either if there’s some sort of workaround or if I’m somehow doing something wrong here.

    Many thanx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I wanted to bring up this topic again, as I've been looking for a solution myself.

    Ordering sprite objects is pretty easy to do in a non-costly way. It could look something like this:

    CONDITIONS:

    System -> Every 0.05 Seconds

    System -> For Each SpriteObject order by SpriteObject.Y ascending

    SpriteObject -> Is on-screen

    ACTIONS:

    -> SpriteObject -> Move to top of layer

    However, Tilemaps seem to be another story.

    Someone please correct me if I'm wrong, but I don't think there's a simple, effective way to have a Sprite to pass behind or in front of a tile in a tilemap based on Y position, since there is no way of changing the Z-order of individual tiles. You could change the Z-order of the entire tilemap based on a sprite's position, but that's not really ideal at all for a bunch of reasons.

    The only workarounds I can think of would be:

    • Use sprites more often. This would be the only way to effectively have a small cactus like in the first post.
    • Have two tilemaps, one for tiles that the sprites will always pass in front of, and one for tiles that sprites will always pass behind. This would be effective for something like the large trees from the third post, where you could have a base that the player always passes in front of, and upper parts of the tree that the player always passes behind. Though in this case, it would probably be more efficient to use a sprite for the tree instead.

    If anyone has any other solutions to add, I'd love to hear them.

  • I'm wondering if this at all relates to the issue that I started having recently? https://www.scirra.com/forum/performance-issues-stutter-in-chrome-out-of-nowhere_t106103?

  • > I'm pretty positive that the issue has something to do with Chrome, and not the game itself or Construct 2.

    >

    So you've tried IE and Firefox and they are not affected?

    This particular game has always had performance issues on Firefox and IE that weren't present in Chrome, so I haven't used those browsers on a regular basis and it isn't easy to make a comparison. However, IE does seem to be outperforming Chrome now, which was never true in the past.

    Again, the game is very CPU-heavy.. has a very large map (10240x10240 to be exact), usually close to 1000 objects though I'm trying to get this number down (it's procedurally generated), and a lot of AI going on, though I've done my best to make this all happen as efficiently as possible. Chrome (when it's working) is soundly trouncing the other browsers.

  • Last night, the game I'm working on started having a lot of frame rate stutter on my Windows 8 desktop PC. I'm pretty positive that the issue has something to do with Chrome, and not the game itself or Construct 2. Older backups of the game are having the same issue, and the game is working fine on a much slower PC that I had lying around. Furthermore, the game runs completely fine when I preview in Node-Webkit.

    Prior to when this issue started occurring, I set the game (running in preview mode in Chrome) to fullscreen mode while simultaneously changing the window size from 1280x1024 to 1920x1080, and then set it back to windowed mode. I repeated this several times. At one point, I got a black screen and a popup stating that WebGL had failed. And that's about when the problem started occurring. There was also a Construct 2 crash at some point around that time.

    I've also noticed that the text (in text objects) looks a bit different than it used to, which indicates to me that there's something going on with the way things are being rendered..

    I should note that the game isn't graphically intensive, but it is fairly CPU intensive due to a lot of AI routines firing frequently. Normally, the game hovers around 60 fps, but I'm seeing a lot of lag now. Interestingly, I've also been working on a game that's very graphically intensive but not CPU intensive-- and that game is working without a hitch in Chrome!

    So far, I've attempted the following: reinstalling Chrome and Construct 2, enabling ‘Override Software Rendering List’ under chrome://flags, deleting my browser cache, and doing a system restore to a couple of days ago. Nothing I do seems to be getting Chrome back to working the way it did before. It's not a HUGE deal since the Node-Webkit preview is working fine, but still.. totally baffled.

    Any suggestions? What could have caused webgl/html5 to randomly start having performance issues in Chrome?

  • One of the games I'm working on at the moment is around 150 MB, almost all of which is images. Previously, when I previewed the game, it would take about 5-7 seconds to load. Now, seemingly out of nowhere, the game started taking about 25 seconds to load, and I am really stumped as to what might be causing this.

    Things I've tried in my efforts to solve this:

    • Restarting my computer.
    • Previewing on different browsers. (the problem happens on all of them)
    • Reverting to an older build of the game.
    • Reinstalling Construct 2.

    I didn't install anything new on my PC that might have caused the problem. From what I can recall, I closed Construct 2, ran one of my Steam games, closed the game, opened Construct 2 again, and the problem had started occurring.

    I don't seem to have any other problems with things loading slowly off the hard disk.

    When loading the game in Chrome, I see the "Waiting for localhost..." appear and disappear a bunch of times (if that means anything to anyone).

Madguy's avatar

Madguy

Member since 6 Jan, 2013

None one is following Madguy yet!

Connect with Madguy

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies