SketchyLogic's Forum Posts

  • I have been working on a game that uses webfonts to style the in-game dialog. I have tested the game on Chrome, Firefox, Node Webkit, Mac, and iOS (in-browser), and aside from some slight text bolding on Firefox that can be attributed to different HTML5 implementation standards, the font rendering was consistent.

    But today I tried running the game on another computer (one running Windows 8, where I previously relied on Windows 7), and suddenly all the webfonts appeared smaller. A font size of 20 on the old PC would appear as around 16 on the new one. This was true for Firefox, Chrome, and Node Webkit, and didn't seem affected by window size or desktop resolution. I can make some screenshots, if necessary.

    Any idea what's going on here? I'm probably going to make the jump to spritefonts to avoid future headaches, but it would be good to know what the source of this discrepancy is.

  • The game is upscaled to fit the screen on iPad and down scaled on iPhone. Can this be related ?

    Let's find out. See if the same lag happens in crop mode.

  • Animmaniac: if direct cell manipulation were implemented, you could probably make a work-around by importing the JSON data into an array, then parsing the array data to the obstacle map with a couple of loops.

  • That's fantastic. Thanks a lot Ashley.

  • That's not a bad solution. Unfortunately in my case the citizens all have completely unrelated paths, so using a common array of nodes wouldn't work. However, I could extend on your idea by making a single obstacle-map-calculating object that works out unique paths for any citizen upon request, then parses the node data back to the citizens to be stored locally (or an enormous array for every citizen's every node). The only downside of this method would be that only one path could be calculated at a time, so I would probably have to set up a queue in case two citizens try to calculate a path simultaneously. I have no idea whether this would be efficient on a large-scale, but it would solve my initial stuttering problem. I'll give this a shot if I can't find a better solution. Thanks for the idea and capx.

    How exactly would you want to adjust them? I'm guessing you're looking to be able to specify a specific cell, and either change whether it contains an obstacle, or have it recalculate to check if it contains an obstacle. If so, I don't believe there is a way to do this.

    Oh, I have no idea on the "how". I just figured that a "make this cell an obstacle" function would be hugely more efficient than the current "make this object an obstacle then recalculate" method.

  • I'm currently working on an isometric city sim game. Progress has been good - I'm at the stage where the user can put down buildings, and citizens will move from one building to another whilst avoiding obstacles in-between through use of the pathfinding behavior. I'm currently recalculating the pathfinding obstacle map for each citizen when a new building is placed. This works fine with a small number of citizens but, not surprisingly, it causes a stutter as the population grows (even less surprisingly, this stutter is most notable on mobile platforms). Aside from this, the framerate is consistent and high. My questions are:

    Since all citizens use an identical obstacle map, is there a way of calculating the map once, then applying it to all entities?

    Is there a way of adjusting individual collision map cells, rather than using the in-built "add object"/"re-calculate" functions?

    I suppose if there's no obvious solution I could write my own pathfinding functions, but it would be a shame to not make use of this in-built feature.

  • I see two easy ways you could do this.

    The first would be to make a new object (let's call it "cameraObject"), and place it in the center of the screen. Make it invisible, and make the camera/view focus on it. Then, implement the code: "every frame > cameraObject.y = cameraObject.y - 1". This way, the camera will go upwards, but it will never come back down or go side-to-side. If you use this method, make sure that the camera isn't bound to the edges of the game world - otherwise, it will stop when cameraObject.y reaches zero.

    The second way would be to not use a camera at all. Simply move the blocks downwards when the player reaches a new height. "Every frame > for each block > block.y = block.y + 1". This method might be a little less intuitive to implement, but it can be more efficient, and is the "standard" way of making endless jumping/running games.

    Ultimately, go with the method that feels right to you. It would be silly to say that one method is "better" than the other.

  • There are a lot of ways that you could do this. You would be best off implementing whatever method/formula is most intuitive to you, or whatever fits in easiest with your program. But here's how I would do it:

    1. Apply the reel variables to a 5x3 array

    2. Make a recursive function that takes the variable present at [x,y], and checks whether the same variable is present at [x+1,y] (i.e. the reel square directly to the right). If y>0, then check whether the variable is present at [x+1,y-1] (the reel to the above-right). If y<2, then check whether the variable is present at [x+1,y+1] (the reel to the below-right). If the variable is present in any of these position, then call the same function for that position. If x+1 == 5, then congratulations - you've got a line - do whatever it is that you need and don't call the function again.

    3. Call the function for [0,0], [0,1], and [0,2].

    If you hate the idea of using recursive functions, then I suppose you can do a similar implementation with one or two for/while loops.

  • You can add blank sub-events. Just right-click > Add > Blank Sub-event. You can't add blank actions as far as I'm aware, but you can just right-click > Add > comment, which is normally a sufficient place-holder.

  • For anyone wondering about the effects of screencanvas rendering in the latest update: I've noticed an all-round boost in frame rate on iOS via CocoonJS. In my game, there's a significant increase during cut scenes (essentially 3-5 large sprites being panned slowly) - the scenes have gone from ~30FPS to ~42FPS. However, the increase is negligible during gameplay (10-15 sprites, basic physics, GUI overlay) - the scene has gone from ~28FPS to ~30FPS.

    This means that the change probably won't make a previously unplayable game playable, but it might help make for a smoother experience.

  • I've found CocoonJS to be great for iOS. Aside from memory issues, my Construct game seems to work exactly as expected, and I can maintain a frame rate of around 30-40FPS. From what I hear, Android performance varies. One developer on the Ludei forums mentioned seeing a huge frame rate increase when he removed a tiled background - I suppose Cocoon is still in the "some features are more reliable than others" stage of development.

    I wouldn't mind seeing a performance comparison between AppMobi and CocoonJS. It would be useful to see if certain assets are handled differently, and whether this significantly impacts the frame rate. On a related note, does anybody know whether AppMobi loads all the assets (except music) up-front like Cocoon does?

  • Apply the Toon Shader, then apply the Color Replacement filter with a source of 0,0,0, a replacement of 255,255,255, and a tolerance of 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, awesome. You guys are adding features as fast as I need them! I'll make a post on the CocoonJS forum.

  • I'm currently making an iOS game through CocoonJS. It's going very well; I am 70% through development, and am consistently getting a framerate of 30FPS on an iPhone4. However, a little issue has been bugging me.

    I notice that the application front-loads all of its graphics (at least, it appears to). This causes a memory warning, and results in the application being automatically closed if I attempt to load another app. Although not game-breaking, this is undesirable.

    I figure the possible solutions would be to either load and deallocate the assets dynamically / manually, or find a way of allocating a large chunk of memory that the OS can leave alone.

    Does anybody know if either of these solutions are feasible or even possible through Construct2 and CocoonJS?

  • Sure, I'll send a message later. Thanks for the reply.