Higher res = more lag?
Franto
Member Posts: 779
I just realized that my side scroller might lag on some devices if it's at 1024x768? It was originally at 480x320 before I updated the size and graphics. But now I think perhaps it would have been better off at the old size? What would be a good size for a game that uses independence resolution while also reducing lag? Would a 512 x 384 size do well since its half of 1024x768, or is there some other size I should be looking into?
Comments
Hi, a game works fine even if background image size is 2000x1400.. The frame rate depends upon a number of factor. Some of them are: too many constrain, not destroying actors after it's work is complete, too many particles, to many actors, etc..
A heavy game works very smoothly if you utilize the logic good so you don't need to worry about frame rate unless you put large size images and you don't use logic properly. But best thing is never assume always test..
Current Projects I am working on: Stupid Duck, Zango's Shark Adventure, AoD: Age of Dragons, Rocket Jump: The Pixel Invaders
Facebook: https://facebook.com/reflectivebytegamestudios
Web: reflectivebyte.com
@Franto, added to what @nabbo said, make sure that you disable all physics related attributes in actors that don't need them.
Movable should be false
Density, Friction, Bounciness,Drag, Angular Drag should all be set to 0
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Here is the game if you need to see it, iPad res with resolution independence checked:
http://arcade.gamesalad.com/game/123044
The older version, 480x320 with no resolution independence:
http://arcade.gamesalad.com/game/121077
I'm thinking about switching back to 480x320 and keeping the resolution independence and new graphics made for the iPad res. I want to know, based on the gameplay and the stuff going on, that perhaps it would be best to return to the old size? At least the new graphics are an improvement over the old sprites of the heroes.
@nabbo Oh, I didn't know that constrains use up so much memory. I might be using 10-20 at once sometimes, but not on at all times. The game DOES lag when the knight character uses the default red button attack{N on the keyboard}. It uses about 2 to 3 constrains while it's active and at a minimum is around 2.9 seconds on the timer before it destroys itself if you haven't let go of the button. Thanks for the info.
The Princess characters default spacebar attack is another example, where lasers sprites are fired as long as you hold the spacebar. This and other attacks that have constrains do lock up the game in preview of the creator when active, until the character is destroyed by other actors, in which case the game unfreezes, stops lagging. { I do find it humorous that the enemy actors help unlag/unlock the game by destroying the player character.}
@Hopscotch Thanks for letting me know that physics can also be the origin of lag. Does the creator have the feature of selecting multiple actors and if they have any of the same default values, to show those to be editable simultaneously so that you can just set those attributes to 0 in a single go. I might be rambling a bit. I'm assuming most actors by default have most of those attributes at 0 as I haven't looked at attributes in weeks. Thanks for your post.
@Franto, the physics attributes are actually not 0 by default, they have some base values preconfigured when you create an actor. Also, Movable is on by default. You will have to edit them individually.
Constrains don't use memory but use up processing power. It is not much, but it adds up.
The lag you are describing does seem excessive, I would look at the logic. Especially look for conflicting rules and constrains. Or do you have constrains in each of your laser beams?
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch Yes, each laser has a constrain that subtracts from the Princess's location, so that if they exceed a set distance, they destroy themselves, for example, some destroy themeselves after a range of 150, while a longer ranged attack at 370. On top of that, there is also a timer that destroys them if the warping technique is used on them, that causes them to loop in circles, so that they don't end up stacking and overloading the system like what happened in early tests.
The Knight has no laser attack, but his melee attacks use actors that constrain themselves to his x,y position when ever they are on. They also have timers due to having the problem of sometimes finding a way to stack. On top of that, some of the attacks and techniques do use particles.
@Franto, 1 particles are fine, the more the merrier
I still don't understand your need for constrains in the lasers. Could a rule test not achieve what you are doing?
e.g.
Rule: if abs(game.PrincessX-self.LaserX) > 150
alternatively
Rule: if magnitude(game.PrincessX-self.LaserX,game.PrincessY-self.LaserY) > 150
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
I haven't thought of those methods, I only thought of constrain as the way to keep track of the laser. There was another reason I had to use constrain to attach the laser to a game attribute, I can't remember it at the moment since I haven't touched any of the lasers in a long time.
Here is a screenshot showing what some of the lasers behaviors look like:
@Franto, thanks for the screen shot, it helps.
I suggest you implement it without the constrain. Since the Windows does not have an expression editor on the left of the equation yet, create a game level attribute for the distance offcut:
game.DistanceX and set its value to 370
The just have one rule (replacing your constrain and the two "DestroyX +-" rules)
Rule: if game.DistanceX < abs(game.PrincessX-self.Position.X)
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch Thanks, that helps a lot. I noticed when I upload the game to the arcade, there is no lag, only in the windows creator preview mode. Is it's performance in the arcade indicative of the performance on devices? I did try to load the high res version on a friends iphone a few weeks ago, but it wouldn't load, I couldn't tell if it was the poor internet connection since it was in a parking lot or the device itself.
I'm the windows version before 10.5 since I had some problems with the latest and the Nightly on Windows 7.
I have 10.5 on a Windows 8 evaluation version within a virtual box that works, but I had to make sure all the graphics are finished before heading back over to it since no photoshop there.
I'm thinking of getting either a used mac computer or macincloud in order to use the Mac creator.
@Franto, sadly the arcade is no measure for how the game will perform on a device. The device usually performs way better. Bonus for the arcade is that it is very unforgiving for poorly optimised logic. Meaning, if it runs well in the arcade, it will be slick on the device.
Another problem with the arcade is that you can't have rules switched "off". They have to be deleted not to run. This fact often trips people up.
That said, the Creator preview mode is a strange thing, I have not used it enough to pinpoint where the problems lie, I just know that it does behave strangely sometimes.
As the new cross platform version is still a few months off, it may well be an option to look out for a cheap Mac. Just make sure of the minimum specs as determined by XCode.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch Yes, lol, I found out the hard way about off behaviors being on in the arcade, a pain to delete them all. Glad to know devices perform way better. I saw some Mac computer with 2 ghz and 2 GB of ram at $200 online.
If you don't use neither arcade or preview, I assume you test it straight to the device then? I'll have to learn how to create such a setup.
@Franto, you can't do without the preview.
I do some prototyping on PC if that happens to be all that is available. Preview on PC is not unusable, just has its issues.
The arcade I would love to use, if only the canvas could be sized as needed. Also, sound behaves differently on the different browsers. Physics are also temperamental.
"Development" I do on Mac.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch Yeah, the macs preview is definately incredible, I managed to use it on a Mac at a college, if I remember right, it even had options of showing what the game looks like in different modes like stretch. I don't remember any sort of lag either.
For resizing the canvas on Arcade, the alternative I use is the browsers zoom in feature, put it to around 200% for an ipad res, and to my surprise, the graphics remain as high res as in the preview, even though the original canvas appeared to be small at 100%, instead of pixelated, it appears the arcade canvas doesn't resize the graphics for anything similar to iPad size.
Why do you have two destroy rules with the same conditions in that shot? Usually lag is a result of bloated code. As you learn GS you will understand logic trees better and be able to refine and slim down your code. I have a video showing some basics about integrated code. Click the link in my signature.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Here's the present version of my game if anybody wants to take a look:
http://arcade.gamesalad.com/game/123122
@The_Gamesalad_Guru The laser loops in a circle sometimes, and if theres many, it causes lag. The laser loop occurs when using a support technique that keeps ranged attacks within ranged, which cause the need for a timer to destroy them in case they stayed too long. Using the timer alone wouldn't be safe as there was a support technique that accelerates ranged attacks, if a ton of them flew off at high speeds, they would simultaneously exist for the entire timer's life, and with them being offscreen, would cause lag, thus the double coverage of time and space for ranged sprites.
I see that but you have two similar rules and one has no behaviors in it. Look close you have the destroy rule right under the move behavior and a duplicate rule right under it after the constrain. Plus that constrain should be at the top of the logic stack as the rule above it relies on that data. Remember things read from top to bottom. Sloppy logic leads to lag.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@The_GameSalad_Guru Ah! Thanks for pointing that out. Speaking of which, I keep finding empty or incomplete rule boxes through out my project. If a rule isn't being used by the system, does it still cause lag? If it does, I have a lot of cleaning up to do. I also had no idea that they are read in order from top to bottom, that would explain why some things I tried to get working wouldn't work. Thank you, and great vids.
Yes those rules will be read by the machine. Clean up your code. Nothing should be included unless it has a function. This could also cause an error and bloat your code. This is why I say it's vital to be well versed in the basics of GS logic. You've been here for a while and these are things you should know by now. You need to brush up on the basics.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@Franto I haven't looked at your project but after reading the thread I am wondering if you are aware that actors in Inspector/Scene/Layers are loaded from the bottom up?
The actor at the bottom will be the first to load. When you think about it it makes sense you wouldn't want a large background actor covering other actors. Many people move their actors around to achieve this but are not fully aware of its significants.
An off scene actor which loads any attributes which your game needs to run should be placed at the bottom so it is the first to load. If it is placed elsewhere in the order it can cause problems.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@The_GameSalad_Guru I see, most of the rules happened when I'm trying to drag a duplicate and because of the strange way the Windows Creator drags things, whatever I'm holding will dissapear and instead of ending up where I dragged it to, it throws itself somewhere else. And in actors with 20-50 behaviors, plus the strange lag and occasional crashing that would occur in 10.4, it was very hard to look for them. I believe the mac version doesn't have lag when you scroll through behaviors, although I didn't have time to really look into it when I had the chance to use a Mac.
This strange bug caused me to put on hold development since my real target platform wasn't fully covered, although I had been developing some graphics for my GS games up until april, my learning stopped around Late feb or March, so yes, I should know a ton by now, but I don't. : ( Around April, and until just a week ago, I had been looking at the other game engines and frameworks to see how they compared to GS. I can definately say that GS is at the top when it comes to helpful communities, but it also happens to be among the top 2 in my book for most intuitive and user friendly interface. Some game engines and frameworks, I would spent 4 to 9 hours just to make something that could be done in GS in 10 minutes~!!!!! That's how vast the difference is between GS and other game engines or frameworks. I could have better spent that time mastering GS perhaps, but I feel it was necessary I was without doubts and I did manage to find a few trinkets and prizes along the way that will serve me well in my game development. So it wasn't a waste of time. But if I had hindsight, I would say that I would probably been better off focusing on GS alone and the other engine much like it, but in the long term, what I learned will prove to be beneficial. For example, I did attempt to learn Javascript and spent many hours and weekends to make something that GameSalad would have done in minutes, only problem is that GameSalad restricts your html5 export to an Arcade. So it was the main reason I went out to look at other engines to cover the very platform I sought.
@colander I was only aware about how GS loads images from having used art programs where objects will go over others the high up they are in the layers, with the bottom being behind everything else. I did divide my art assets into background(the moving mountain parallax you see in the demo in the link), the mid ground(where all the characters, enemies, platforms, and attacks are at), and the GUI(where all the buttons, indicators, and other interface features arre at).
What I didn't know about, was that an actor with important behaviors should go to the bottom. Thank you. I always assumed that when the game loads, any actors with system related behaviors would automatically get priority before loading actors that required said attributes. I have no idea why I assumed this. I'm too spoiled by the idea of futuristic super computers that handle such small details automatically.
Mac has lag when you have lots of rules. But patience is virtue
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I've made tons of high res graphics and animations staked upon layers and layers of animations characters etc. Higher res does not mean you are gonna get killed be performance. Optimize your graphics and ensure your code is good. I just did a 1 minute animation for a commercial project in GS and I had no issue. Every level I have in the game has many layers of static and moving animations besides the game character sprites . My code is clean and the game is working in the creator, when publised to Mac and more importantly HTML5 (where you will sweat over resources). It can be done.