This weekend's update is one of the most significant I have ever accomplished. While it's been about 3 weeks since my last post my progress has been massive. My skills in debugging code and working out problems has increased 10x. My focus in the first week was performance optimization and hitting that holy grail of 60 frames per second. This was a challenge that I was looking forward to because I didn't have the same intimate knowledge of the optimization processes in Unreal like I have in other game engines like Unity or Babylon.js. I had to make use of all of the profiling and debug commands available to pinpoint the bottlenecks in my game and frame loops and work to optimize the milliseconds required to complete each so that the total time did not exceed my target of 16.67ms.
Goal framerate = 60 FPS = 1000 / 60 = 16.67ms or less game & frame loops
Compare that final result to where I started...
That's almost an extra 27 frames per second! Optimization is critical to great performance.
The following commands in the console were crucial to reaching this goal.
stat fps
stat game
stat unit
stat unitgraph
stat raw
stat scenerendering
stat playercontroller
stat lightrendering
stat shadowrendering
stat statsystem
stat tickables
stat foliage
stat landscape
stat particles
The commands stat tickables, stat game and stat unit were very helpful in hitting the FPS goal for the game. I highly recommend using these commands to troubleshoot performance in your games.
Also, this command helped a ton:
dumpticks
To get a list of actors in Unreal Engine 5 that have a registered tick event, you can use the console command dumpticks. This will output a list of all the actors in the scene to the log, which can help you identify which actors are ticking. This information can help you optimize your game since ticking is so expensive. Minimize use of tick, shorten tick intervals, or use timers instead to prevent ticking every frame on objects unless absolutely necessary.
I spend the last week and a half working on the inventory system foundation. I had to work through many different classes and establish the foundation for the inventory system based on the system developed by Vanguard Interactive. Shoutout to Vanguard for such an amazing, well-designed product and great tutorials. Saved me weeks of work on the foundations of the equipment, inventory, container, and player frame modules. I broke a few things in the process but was able to fix them easily using the tools I've come to know and love in Unreal.
Here is my list of progress since the last post:
Disabled ray tracing and hardware accelerated ray tracing
Deep dive into ticks and tick intervals
Used dumpticks command to optimize ticking to reduce round trip milliseconds
Investigated some plugins that claim to optimize ticking via tick radius zones
The game now runs at over 60 fps, but only in standalone mode
Started research and troubleshooting into some of the networking-specific functions that are adding high overhead to the game thread and cutting my FPS in half in some cases
- Net Broadcast Tick Time ~16ms
- NetDriver TickFlush ~16ms
- ServerReplicateActors Time ~16ms
- Prioritize Actors Time ~16ms
This also increased the total World Tick Time to insane heights (25ms extra!)
The issue is made worse when going from Listen Server to Client Server
Enemies no longer tick every frame
Added a scene capture 2D component to the player for use in the inventory preview window (WIP)
Tweaked UI elements for the inventory and attribute menu buttons
Added inventory slot pointers to the character base class for all equipment slots
Head
Shoulder
Chest
Hands
Legs
Feet
Back
Waist
Accessory
Right Ring
Left Ring
Main Hand
Offhand
Ranged
Added pointers to the meshes for each slot to allow for swappable items
Added default skeletal mesh sub objects for each equipment slot
Setup rep notifies with attachment rules and socket destinations for all equipment slots
Added sockets to skeleton for accessories like cloaks and rings to be visible on players
Added generic reusable items class
Added item slots
Implemented drag & drop functionality for items to destination item slots
Implemented equipment interface
Implemented inventory interface
Implemented backpacks and containers interface
Implemented item lists and loot tables
Implemented currency and currency stacking
Added ability to loot corpses
Added containers to the game world like chests or pots with variable slot count
Added tooltips on item hover to show item details including type and descriptions
Added ability to stack items
Added ability to split stacks of items when holding shift and clicking the stackable item
Items can now be dragged onto hot bar
Items can be used on the hot bar by using mouse click or hotkey
Added ability to interact with objects in the world using the 'E' hotkey when within range of a usable actor
Added IK goals to the hands and feet of the skeleton
Updated player frame interface
Added walk ability when holding caps lock
Setup physical materials and sound effects for the landscape material types
Set the physical material for each material layer in the landscape object
Grass
Rock
Wood
Water
Sand
Snow
Cloth
Concrete
Glass
Flesh
Frozen
Organic
Metal
Added trigger volumes for shallow water and wet footstep decals
Cached the locomotion and main state animation graphs so I could do more complex body animations with separate upper and lower parts of the body
Implemented upper and lower body split in animation graph to allow for foot, leg and hand IK (WIP)
Implemented swimming locomotion (still working out a bug where the player sometimes rotates abruptly when entering the water)
Added bubble particles when underwater
Disabled IK while swimming or falling
I am stoked that so much progress has been made. I have leveled up my implementation and troubleshooting skills significantly and feel stronger as a game developer. Unreal is an extremely powerful tool and I feel like I finally have a solid understanding of how things are supposed to work versus hacking things to get something to work.
While the code is not bug free, I am learning to be okay with that. I leave comments in my code and blueprints with TODOs for me to focus on later. I keep them on a backlogged list that I can pull from whenever I sit down for another dev session. This allows me to make progress, feel proud of my milestones, and not sweat the small bugs (there will always be bugs to squash).
Time for sleep!
Cheers, Vinny
Comments