Animation is lagging

  • #10, by EldarionIISunday, 21. December 2014, 19:15 10 years ago
    Ok. I've used XnConvert and it's not lagging anymore! Thank you smile

    Now I'll polish timing.

    Thank you for tip about light I'll read this later.

    Newbie

    18 Posts


  • #11, by gustySunday, 21. December 2014, 19:23 10 years ago
    AFRLme: There is no question about webP format, I read stuff about it and this is way to go, so I will definitely use it. But anyway, I'm planning go quite crazy on animations in my game. I understand that best way is cut objects which moves (=animations) into smaller parts, but still, I would have a lot of these small moving images in almost every scene.

    I'm not sure I'm following you in that preloading theory. What exactly do you mean by "frame to frame loading"? It's like that one frame of animation is loaded and when it's loaded another frame starts loading? Then my sense tells me that preloading whole animation is much much better, isn't it?

    Example: I would like to work it out like this: I have two scenes. First is an empty room which is start scene and another one is a busy street where cars going by and another characters walking around, trees are moving in wind and stuff like that. So the second scene is quite heavy on animation. What I would like to do here is after clicking on the door in empty room, I would set an action which would preload all the animations in the next scene (busy street). So when player enter the scene, every animations are smooth and non-laged - the scene is prepared and all parts of it are preloaded. Now with frame-to-frame method, I'm not sure if all animations would load that quickly in order to not have any visible lags.

    Speaking about first method, I would be fine if after clicking on the door in empty room, screen would go black for a while in order to give engine some time to preload all the stuff. But what I really want is a good first impression - character enters "busy street" scene and everything is smooth and beautiful, whole scene is prepared..

    Forum Fan

    159 Posts

  • #12, by afrlmeSunday, 21. December 2014, 19:27 10 years ago
    No problem smile

    Graphics are very nice. I assume for your blink animation you played the idle animation 3x & then it blinks? I recently wrote a tiny tutorial on adding dynamic blink to the end of an idle animation. http://www.indiedb.com/members/afrlme/tutorials/dynamic-char...

    I just tacked the blink animation frames onto the end & added a little if query to the first frame to determine which frames should be played. If random value returned less than 13 it played idle animation frames else it played idle frames & then the blink frames at the end. Very simple & reduces amount of frames needed smile

    WebP is a big difference in size no? Most of the time. I've even had files compress down to 1/5 of the png size.

    The dynamic lighting tutorial using images is a great way of reducing memory & it also looks pretty good too, well not as nice as openGL lighting but it's a pretty decent alternative for anyone not wanting to script.

    P.S: there seems to be a little bug near beginning of your game. It kept forcing player back to a certain position on the left side of the room, maybe an action area or something?

    There's a few grammar/english translation mistakes but nothing serious. Not too bad. Just the way some of the texts are phrased.

    I liked the menu screen, it looks really nice. I think it would look even nicer if you added in a few animations (environmental animations maybe such as moving clouds, or insects/birds flying in out of screen & maybe characters hair blowing in the wind) would certainly make it more vivid/alive.

    Also there's an issue with on mouse over scene objects. They set cursor even if object is currently being held. It might be an idea to use an if query to check if an item is currently held or maybe set a condition on item held/dropped.

    Imperator

    7278 Posts

  • #13, by afrlmeSunday, 21. December 2014, 19:53 10 years ago
    @ EldarionII: Just spotted the scuba diving rat in the restroom scene. Very amusing! grin

    Also if you check the data structure section of the wiki under "game" table you will find some information regarding the cache & pic buffers/threads etc. It's not a lot of information mind, but it's better than nothing.

    @ gusty: hmm it loads frame by frame as opposed to needing to wait for the entire animation to load before playing. Preloading still meant waiting for entire animation to load.

    Chopping larger animations up is not really required any more either. You can however still downscale certain animations though & then scale them back up to actual size with lua for animations that don't need to be sharp such as certain environmental animations like rain, snow, dust, clouds, blurred things etc.

    As long as you don't go over excessive with your animations then your game should run fine. Maybe not as smooth as you like on low end machines/laptops, but not much you can do about that other than create your game in lower resolution like 720p or less or use less frames for animations etc.

    Converting images/animations to webP does help optimize your game for low end machines & mobile devices though.

    Also think about whether or not you actually need to use an animation for something... for example in the demo that EldarionII just provided, in the restroom is an animation that plays a drop of water leaking from a pipe every so often. I'm assuming the entire thing is pure animation. In the game I'm currently helping develop I've only animated the initial build up of water & the splash bit at the end. The actual movement part I did with lua script, although in the next version you will be able to send objects to specific (absolute) coordinates which means you can do it with an action part! wink

    Lighting is another thing. For dynamic lighting I tend to use single image files & control the transparency of the image with an action part or lua & a loop created with the jump to x action part. This requires less memory than loads of animation frames that are the same size/width of the current scene.

    There are loads of different things you can do to optimize your game.

    * edit: by the way I forgot to mention about the memory / process tool thing that was added to VS 4.0. If you hit "home" key on your keyboard (I think it's POS1 on German keyboards & INICIO on Spanish keyboards) then you can toggle an overlay screen thing (for games running via editor) which displays loads of graphs & information about processes & memory allocations for various things such as animations, textures, actions, scripts etc.

    Imperator

    7278 Posts

  • #14, by EldarionIIMonday, 22. December 2014, 13:48 10 years ago
    I did't notice that a second page was created O:

    Thank you for your review and help. I've already added your scrips to blink part smile
    It is not a bug when she does not allow you to go somewhere else at the beginning. I want to force players to find that photo 1st. Couse it contains improtant information about what player should do. If you have other ideas how to do so I would be happy to hear them smile

    It seems that animation is still a bit laggy, so I guess I have to use your tutorial about light grin

    After some improvment I'll create topic with demo version to get some attenrion to our project, but feel free to share it anyway. In fact I would be very greatful if you'd show it to your friends. We are almost ready for Kickstarter campain and we need an audience more than anything right now smile

    Thank you!

    Newbie

    18 Posts

  • #15, by afrlmeMonday, 22. December 2014, 14:18 10 years ago
    In regards to the photo, maybe you could create the initial part as a cutscene & have the character speak a few words, notice the photo on the counter, go over & collect/look at the photo, then after closing of the photo scene, say a few more words & then give player control of the character.

    Trying to control the player in the current way is not so obvious. As an alternative you could wrap the exits in a condition "if_photo_looked_at" do exit actions else display text "I don't think I've found everything in this room yet!" - or something along those lines...

    Did you get the blink working ok? It randomizes when it should blink as opposed to always blinking on every loop.

    I don't think there was any lag on the photo bit when I ran your demo, was a little bit on the closet scene when I tried to take the bottle thing from the shelf but wasn't that bad. I was suffering little bits of lag here & there in the game/demo I'm currently working on because we had/have lots of little animations all over the place. After I converted every single image/animation to webP everything ran nice & smooth again on my laptop, no idea if it will be as smooth on other peoples laptops though - problem with 1080p 2D is that animations/image sizes can be quite large & when you combine lots of animations running together at the same time in a scene, well... it all adds up.

    Since 4.1 we can now control scale, rotation, position, movement & transparency of objects/animations which means it's possible to do a lot of things now with less frames. smile

    Imperator

    7278 Posts