A few questions from a noob

Hey everyone,

I’m making a tower defence game just to get some practice in for ue4, and need some things clearing up for better performance, workflow etc!

  1. If i want to get an enemy to move towards a location or a turret to rotate towards a position, is it better to use a timer or event tick. I know event tick can be heavy on memory and all that stuff, but other than a timer it seems to be the only way to do something constantly?

  2. Whats the difference between custom events & Functions and when should they be used? I usually use only custom events, but other people i see use functions too, is there any specific scenario or improved performance or does it not matter which is used?

  3. What would be the best way to store and retirve information in regards to stats (ammo, health etc) as my turrets, towers & enemies will all share certain variables such as health. At the moment im just making the variables on each then changing them depending on what type of turret, enemy or tower it is (enum). Eg if enum == rapid fire, ammo = 100, health = 50 etc

Any other advice, things i should look into or best practices if i want to make games for ue4 in the future? This is also vital for my coursework as my university uses ue4 and i wanna go in armed to the teeth with knowledge.

Thanks!

  1. Depends on how smooth you need it to be, doing it every tick means you’ll do it with every frame. You can achieve similar smooth effects by using timers and interpolation. Normally it should be fine to use tick, but you’ll want to avoid doing a lot of math with every frame as it can drastically affect performance. You’ll also want to read this.

  2. I couldn’t tell you if there’s any performance differences, but I believe it comes down to personal preference in most cases. Functions you can move to an entirely separate graph, but you lose the ability of using things such as delays and timelines.

  3. Personally I would store this kind of data in the actor itself. Then you can simply cast to them to retrieve individual stats or change them if you so desire.

You should also download some of the projects available for free such as the Content Examples, Multiplayer Shootout and Shooter Game. Take a look at how things are setup in those such as how they’re using GameModes*(Server Only)* and GameStates*(Replicated across all). The multiplayer aspect of UE4 is quite the confusing concept for newcomers, and in terms of BP nodes it is massively underdeveloped(If you plan on making anything MP and want to use BP nodes only, using the advanced sessions plugin is pretty much mandatory)*.

Thanks man!

Functions are “units of code”, used for code reusable and more clean architecture.