trashgg's Forum Posts

  • Yeah, unfortunately fx for C2 have to be used sparingly.

    That's ok, I'm used to working with EPS8 format in illustrator and that one doesn't even do transparencies - I'm used to work-arounds. But at least now I know and the game finally runs smoothly.

  • I think I found the culprit. It's not WebGL that's slowing my game, but the WebGL based effects I was using. When I turned off WebGL, it turned those off as well so it stopped lagging. I was using Brightness for my buttons and the Multiply effect for some game elements. I can attest that an effect as simple as increasing button brightness when it's pressed can cause great lag on some phones. In this case, the 8-core HTC phone I was talking about. To be safe I will avoid effects altogether and use work-arounds, aka more animations for my objects.

    Right now I've re-enabled WebGL but removed all WebGL-based effects and the game runs like a dream at 50-60 fps even on my Samsung 4-core.

    EDIT: I just had it work almost decently on my old Huawei dual-core with 512 mb, but only after I enabled hardware acceleration using Chrome flags.

  • I've been working for a month to redesign my game to improve it's frame rate on Android devices. I've only tested it in web preview so far but it took a lot of work to get it to run at around 30 fps on a Samsung phone with an ARM quad-core and 1 Gb of RAM, with some levels going below. Currently it uses around 160 objects and less than 20 Mb RAM (depends on screen size) in level. So I was thinking I finally got it to run decently.

    However when I tested it on the devices of various friends I quickly became concerned. On a Lenovo tablet with the same specs as my phone it ran really slow, below 10 fps, exactly the same on a Huawei phone that also had similar specs, and absolutely horrible on a HTC octo-core with 2GB of RAM, the frame counter dropping below 5. I was almost loosing hope when I decided to try disabling WebGL in the game project. You can Imagine my shock when I saw my game was now running at 50-60 fps even in the more demanding levels on all 4 devices, granted I need to use some work-arounds to replace all my WebGL-dependent effects. Personally I'm really happy to just drop WebGL and use the work-arounds but since WebGL is supposed to be this complete powerhouse I'm wondering if maybe I did something wrong or missed something.

    Is there anything I need to know about using WebGL? Should I avoid text and use sprite fonts instead or something like that? Does anyone have any idea why it's severely slowing my app? I'd really like to make it work correctly instead of just dropping it. Any help is appreciated.

  • It's possible, yes - spritesheeting can in some cases change the scaling quality after export. It's worth testing both preview and export to compare the results, it might only be an issue in preview mode.

    FWIW, C3 will use spritesheets in preview mode as well so you won't have this problem of preview sometimes looking slightly different to export.

    I'll test it, thanks for the input. Can't wait for a first glimpse of C3.

  • It's probably something to do with mipmapping. You could try setting the downscaling quality to low in project properties.

    I just remembered that in your article about saving memory you said that on export all the images are placed in square sheets sized in a multiple of 2 like 32, 64, 128 etc. Considering the fact that the scaling works accurately for such square objects, is it possible that when I export the project to a mobile app and my sprites become square sheets they will all be scaled accurately? Is it possible that these hard edges are only present on my web preview?

  • Oh I know about that option but that's basically for 8-bit style games I think. It basically removes anti-aliasing. What I need is a more accurate linear sampling.

  • I just noticed that downscaling my game makes the sprites look a little too sharp. My sprites are designed so that if I scale them at 50% they still look pixel perfect but the edges seem too hard compared to when I downscale them in Photoshop using the bilinear filter. I guess it's because Construct only uses the linear filter for downscaling. Is there a way I could use bilinear downscaling for my project?

    EDIT:

    After a bit of testing I discovered something.

    Here is my example: the ones above are in a layer with a scale of 0.5 while the lower ones are placed by me over the screenshot and have been also scaled to 0.5 but using photoshop. Notice how the first top two have harder edges compared to the ones below while the last one doesn't. After a bit of testing I concluded that objects that posses a width and height that are both a multiple of 2 (like 2, 4, 8, 16, 32 and so on) rescale correctly and smoothly, even if the object is not square. The rest, not so much.

    Does anyone have any ideas on how to fix this? Please, I worked my ass off to make my game graphics pixel perfect but it's starting to seem impossible to keep them that way in-game.

  • Hello, my game is called Laser Nodes.

    It's a puzzle game I've been busting my brains with for a few months. The mechanics and graphics are 95% done but I only have 3 levels so far. The graphics are made in Adobe Illustrator and can scale from tiny resolutions like 240 x 180 or something all the way up to 4k and still look pixel perfect without unnecessarily overloading memory. It uses different size redesigned sprites depending on window size. Yes, I hate fuzzy looking sprites. I must say Construct allowed me to do some pretty complex stuff, even though my head nearly exploded a few times.

    Hopefully I'l be able to post a link to Google Play in about 2 months and later the app store and windows store.

  • The simplest way would be to take an empty dictionary, and put all the values of the array in it. That will remove all duplicates. Next clear the array and push all the keys from the array back in.

    Thanks for the idea. The problem was I had to find every pair of identical entries in the array and then decide which one will be deleted by a certain criteria. I was away from my project for a while but now I came back and managed to solve this puzzle in a different way, by using the array in conjunction with object variables, thus avoiding a large number of confusing array loops.

  • First of all I have to declare my ever burning hatred for Construct 2 arrays. I have used them before and did more complex things with them then the tutorials thought me but they are a madhouse. Nearly anything I try to do that's more complex than the tutorials seems impossible without bending over backwards. I can't directly do something as simple as finding out the coordinates of a given value in the array without looping, I can't copy information from one array to another properly, never mind manipulating whole rows or columns. Maybe I expected too much of them, thought they'd be more like Excel. So before my head explodes, could someone please let me know if there is a way to find and remove duplicates from an array?

  • I haven't used this yet because I pretty much put everything in one sheet, but I make sure that only a small part of it runs at any given time. It does seem like a very useful feature though. It's description says it's as if you copy pasted the script from one sheet into another so I don't think it will give you unexpected problems.

  • can't send PM, need 500 rep

    I just noticed the same thing. Sucks to be newbies. Send me an email at trashgg at yahoo dot com and I'll reply with the capx attached.

    enemy on destroy add-1? shouldnt it be subtract 1?

    It works both ways, I checked. But thanks to your observation I just realized something. If you kill the first enemy in pattern 1 in less than 1.5 seconds, before the second one spawns, then enemy = 0 and the wave resets and chooses a new pattern. That might be what's happening in bangnew's game. Maybe his enemies get killed much faster than in my example.

    I tried a different approach. Set the number of enemies that will be spawned at the beginning of each pattern's list of actions

    pattern = 0 => set enemy to 4

    spawn first enemy

    spawn second enemy

    spawn third enemy

    spawn fourth enemy

    and so on. For pattern = 2 set enemy to 8 of course. Also, you need to remove "enemy - on created => add +1 to enemy" since the number is already set. This will solve the problem but you should note that the enemy variable no longer displays the number of enemies in the layout but the number of enemies that will be spawned for the current wave.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I tried to copy your code and see what would happen.

    Aside from a few variations and a couple of additions to make things clearer, the code is the same. Instead of tanks coming from you right I have ships coming down from the top in a vertical layout. Also their spawn positions are not random like yours.

    The code worked exactly as intended. The original enemy sprite has a blue tint so I let the ships spawned on pattern = 0 with the original coloring but gave ships spawned on pattern = 1 a red tint and the ones spawned on pattern = 2 a green tint to clearly differentiate them. They never mixed up. There were either blue enemies, red enemies or green enemies on the screen. For pattern 0 and 1 it spawns 4 ships in a wave and for pattern 2 there are 8 ships. Everything seems to work fine so your problem might be in some other detail.

    I would like to give you the .capx file but I can't post links until I have 500 reputation. If you are interested, message me with an email address.

  • Dug out, tidied up and commented. This might be a terrible way of doing it because of looping through the code until it finds the correct member of the family but in my tests it appears to work quite well and saves quite a lot of code.

    Now that's creative . Thanks for the idea. I'll have to try each solution and see which works best for me.

  • The plugin being made by rexrainbow you can safely assume it will never break, and even if it does, it'll get fixed in no time. So no worry there.

    That's good to know. I should give it a try. Thanks again.