Announcement

Collapse
No announcement yet.

[Free] 2D Sprites demo & Benchmark & Low-end template

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [Free] 2D Sprites demo & Benchmark & Low-end template

    Click image for larger version

Name:	sd01_project.jpg
Views:	1
Size:	110.0 KB
ID:	1160935

    I want to share this simple small project that may be useful to you if you want:

    (As benchmark): Evaluate UE4 for making your next 2D android/ios/html5 game. Benchmark the efficiency of Blueprint and Paper2D to compare with other engines or with old UE4 versions/updates/configs.
    (As test demo): Know how the simplest UE4 2D app runs on your device or compare with different platforms.
    (As a template): Start your new 2D game or Learning Blueprint tests with the most simplified template possible (205kb zipped project / 35mb shipped .apk).


    How to interact with the demo:

    Tap or click one of the 4 screen zones to:
    Click image for larger version

Name:	sd02_HelpControls.jpg
Views:	1
Size:	305.1 KB
ID:	1160938

    More about this little project development and objetives:

    There are many benchmarks already done here and there, followed with good discussions and mainly to compare with other engines, but mine has a different objective and scope, and why not to make and share this if anyway I was making this for my own fun and needs.

    Currently is a fact that Paper2D + blueprints are relatively slow compared to more lightweight solutions, I did myself a very similar test using the same 128x128 PNG sprite with Smart Mobile Studio (A cute programming thingy that compile Object Pascal syntax to HTML5) and displays 3,000 individually animated Sprites at 40FPS on my Laptop (see live here) while using this very similar UE4 project when I reach 3,000 sprites I get a painful 9 FPS on same PC. (Will write PC specs later)

    Then, since I'm already decided for UE4 because I'm in love with the editor and Blueprints, my objectives and scope are:
    - Reach the highest performance possible in low-end devices and old PCs/Laptops with Blueprints-only project. (No C++ allowed, If I need C++ to make a simple 2k sprites run at 30FPS, then I better go to non-UE4 solution, but I will not)
    - Build smaller packaged projects possibles (APKs, HTML5 projects).
    - Do all this with collected tricks, ini configs, console commands... etc
    - Don't asking for a New additional feature to add complexity, talking about drawing call batching or sprites grouping that will limit individual Actros movements, since I think the problem is that drawing simply 3k sprites is suffering from many checks and complex 3D features still running behind, and what we need is to have a way to get rid of them so simple games can run as fast as this HTML5 demo I talked about before; which is not using any caching or instancing optimization.
    - Test and keep a report of any new UE4 update to see any improvements or drawbacks.

    Characteristics:

    All in this project is minimal, reduced or stripped-down.

    - There is a MyGameMode BP that is the center of the little everything, spawning sprites and handle input sent by MyPlayerController.
    - MySprite BP has a Paper2D component and does its animation on the Event Tick with some Sin/Cos math expressions.
    - Isabella sprite texture is 128px X 128px PNG with alpha channel. This paper2D sprite uses TranslucentUnlitMaterial. There is also the simplest 3 verts sprite tringle with OpaqueUnlitMaterial.
    - All sprites have No-Collision and Generate Overlap events disabled.
    - Most plugins are "supposedly" disabled except Paper2D (No matter how hard you try to disable VR plugins in 4.9 their LIB are still included as .SO files inside your APK )
    - Project settings are meticulously revised and many features "supposedly" disabled such like HDR, Bloom, Anti-Aliasing, Motion-blur, etc.
    - The scene is a single auto-activated Orthographic Camera pointing -Y axis from (x:0, y:600, z:0) and MySprite are spawned at run-time.
    - A few console commands are executed at Begin-Play event to set lowest Scalability, unlock FPS limits and more should be added to get rid of remained postprocessing stuff, etc.

    Click image for larger version

Name:	sd03_consoleCommands.jpg
Views:	1
Size:	72.6 KB
ID:	1160948

    My tests and devices specs:

    Device:
    Laptop Toshiba i5-2410M 2.30 GHz, 16gb RAM, NVIDIA GeForce GT 540M, (Yes, I work UE4 with this and I'm happy )
    SpriteDemo:
    1000 sprites - - - - 31 FPS (35ms)
    3000 sprites - - - - 9.4 FPS (106ms) (Switching to triangles or/and disabling Tick Event only add like 2-3 FPS to reach 11 FPS max, almost unnoticeable)

    HTML5 on Chrome browser:
    200 sprites - - - - 27 FPS (37 ms)

    Device:
    Samsung Galaxy S4 mini GT-I9190
    SpriteDemo:
    200 sprites - - - - 27 FPS (37ms) (same as HTML5 on my Laptop )
    1000 sprites - - - - 4.5 FPS (215ms)

    Want to help or contribute?

    Thanks! Try this project share your results, your thoughts. Share any tip/config/trick you found to improve it. Any improve will be shared with everyone here. Any other new trick you found on your 2D game to reduce package size, gain execution speed, apart from the official docs (size)(performance)? Plase share it, (or if you post it anywhere I'll find it )

    Let's help Epic find things that are making our 2D small games having bad performance, and let's ask them to improve this little things. They are not targeting old devices (obviously) but maybe there are small feasible things that can be made to make UE4 much better than already is. Anyway remember that if you are targeting Samsung S5 and your are happy with 2,000 jumping sprites at 30FPS another team could compete with you with a similar game displaying 10,000 jumping richer sprites at 30FPS running in the same Samsung S5.

    DOWNLOADS

    project: DROPBOX (205kb)
    dev. APK: DROPBOX (40mb)
    HTML5 : Live. (Takes sooome time to start)
    Last edited by piXelicidio; 09-10-2015, 10:40 AM.
    Regards,
    Denys

    WIP: Crabby Ball (2D platform game)

    #2
    Here it is attached the sprite image used in this demo. I own this image and I share it for free on this website along with many other .PNGs
    Attached Files
    Regards,
    Denys

    WIP: Crabby Ball (2D platform game)

    Comment


      #3
      Found in Saved/Cooked... Many big files from the engine content that I'm pretty sure my app doesn't need. I'm trying to get rid of them: https://answers.unrealengine.com/que...ou-dont-n.html

      Click image for larger version

Name:	ask_EngineContentCooked.jpg
Views:	1
Size:	170.1 KB
ID:	1087250
      Regards,
      Denys

      WIP: Crabby Ball (2D platform game)

      Comment


        #4
        "Almost" did it! Something to cut off about 3mb (like 6mb uncompressed) from engine content! Better than nothing.
        Click image for larger version

Name:	sd04_reducingSizeAfectingEngine.jpg
Views:	1
Size:	19.1 KB
ID:	1087289

        Explaining the steps of how I did it:
        (NOTE: This solution could be risky and will affect all projects using current engine and editor, for good or bad)

        The thing is you can't delete these assets because the engine freak out (crash), let's then replace and modify with caution:

        0) Go to your Engine installation and backup your Engine\Content folder.

        1) Package your project for Android (or any other platform you are working on, is the same)

        2) Go to Saved\Cooked\Android_ETC1\Engine\Content and search all *.uasset sorting by Size. Now you have something similar like the image above from previous post.

        Now lets work with the first one, biggest one: SM_ColorCalibrator.uasset

        3) Go to the Content Browser in your editor and enable Show Engine Content view option.
        4) Search your first suspect SM_ColorCalibrator.uasset, open it, and repeat with me: "WTF is this?";

        4.1) Create a simple 3 vertices polygon on your favorite 3D soft and export to FBX and also a 1 pixel size image (PNG or TGA).

        5) Take a look to the engine asset again, analyze if your project will really need it, SM_ColorCalibrator.uasset most probably 99.9% not, then since this is a mesh right click to Re-Import with your new Mesh! The little triangle!
        In case the asset were a texture Re-Import with your new One-Pixel texture, for example: T_SmokeSubUV_8V8, kill it.
        If the asset is a Material, you could simplify the shader to the minimum if you like, or leave it untouched to avoid recompiling shaders delays.
        Any other asset type...leave it or modify at your consideration.
        Finally save changes.

        6) Repeat the process for every big size asset you find until you get tired and give up.

        7) Package your game again, and enjoy! See how many MB you save and tell me about.

        Warning! Remember, do not delete the assets or Editor will crash next time. Also be careful if you replace editor textures like Audio 2D icon... etc.
        Regards,
        Denys

        WIP: Crabby Ball (2D platform game)

        Comment


          #5
          Cloned this project with Game Maker Studio, same 3,000 sprites and animation script mirroring my UE4 project.
          Each sprite is a Game Maker Object (or Actor), having independent movement, behavior, scripts... etc.
          It runs at 98 FPS stable and smoothly... (while my current UE4 project did only 9.4 FPS)

          Click image for larger version

Name:	sd05_3kIsabellasWithGameMaker.jpg
Views:	2
Size:	880.3 KB
ID:	1087315
          Regards,
          Denys

          WIP: Crabby Ball (2D platform game)

          Comment


            #6
            Thanks for sharing your benchmark. That confirms my finding from 5000 sprites rendering test:

            Click image for larger version

Name:	5000sprites_vs.png
Views:	4
Size:	8.9 KB
ID:	1087317
            | twitter | github | #ue4tip

            Comment


              #7
              Originally posted by Nate View Post
              Thanks for sharing your benchmark. That confirms my finding from 5000 sprites rendering test:
              You're welcome!, I have read your thread before from cover to cover
              Feel free to use any of my sprite images in your tests.
              Regards,
              Denys

              WIP: Crabby Ball (2D platform game)

              Comment


                #8
                Yesterday shared my test comparing to Game Maker and a guy told me on Facebook that all my tests are very wrong made, that he can show 50,000 sprites on UE4 at 40fps or something.
                I asked to please show me that project, I'll be very interested to run on my PC and improve mine.
                This morning my post was removed from the FB group. Can't remember if ti was "Unreal Engine 4 community" or "Unreal Development Club".
                That's very funny that some UE4 users are very defensive when talking about this 2D benchmarks... When this tests could help improve the engine.
                Instead of attacking they should spend that energy telling me what i'm making wrong, how I can improve the test, or what is happening inside UE4 that 3k sprites give me 9.4 FPS.

                Happily the chat on Indie Game Developers group on FB was much more balanced and constructive.
                Regards,
                Denys

                WIP: Crabby Ball (2D platform game)

                Comment


                  #9
                  Finally the HTML5 build is working >>> http://web.denysalmaral.com/games/ue4spritedemo/

                  27 FPS for only 200 sprites :-/
                  Last edited by piXelicidio; 09-11-2015, 08:04 AM.
                  Regards,
                  Denys

                  WIP: Crabby Ball (2D platform game)

                  Comment


                    #10
                    17,000 individual triangles at 30 FPS!

                    Replaced the translucent sprite for small tirangle meshes and disbled the Blueprint script for animation. Reached 17,000 tirangles at 30 FPS.
                    Possible conclusions: There is no overhead on using the Actor class on UE4 for each individual element. What is slowing down my sprites are their Translucency and Blueprint code. This small triangle meshes with the blueprint code can reach only 3,000 trianles at 30 fps.

                    Click image for larger version

Name:	sd08_17ktrianglesMeshes_withoutBPcode2.jpg
Views:	1
Size:	355.8 KB
ID:	1087431
                    Regards,
                    Denys

                    WIP: Crabby Ball (2D platform game)

                    Comment

                    Working...
                    X