Section Production Progress

No worries, I’m probably going to re-do the last 3 videos, and insert a few after “Avoiding Boolean Flags” in order to tackle aiming and rotations properly.

OK, “Improving Tank Aiming” has replaced “Using FindBetweenVectors()”. See here for the code changes.

The next two will be roughly the same (on tank AI, and ammo display) but I’ll re-record so the videos are consistent.

Not sure why you didn’t just turn on bDrawDebug in the SuggestProjectileVelocity function to showcase the traces the aiming is doing, also this lecture might also have been a good time to remove the GetLookDirection function since all that does is call DeprojectScreenPositionToWorld.

Edit: Also your solution for the aiming only appears to work in one direction, i.e. if you go to look behind you going left before passing directly behind it seems to work, but not going right. So the problem is half solved.

Hi Dan, re the debug line it would be helpful to show it at some stage and here would have been good. My concern is the number of concepts in one video. Having said that I’ll aim to use it shortly as it’s a handy tool, thanks for the nudge.

Re that GetLookDirection() method, it is a little onerous to have a function for one statement but it does provide some self-documentation and the statement spans many lines. I’ll consider removing it in a refactor, thank again.

Re the aiming, I stopped-short of the full-blown solution we’ve prototyped as the concepts are heavier. I still have it up my sleeve if we need it, it’s only a few lines of code. However I can’t reproduce the issue you’re having. Does your code match the commit precisely, not perhaps including some code from the previous version of the video(s)?

If so, could you do me a quick video, or steps to reproduce as I can’t make the aiming misbehave with this simple solution my end. As I said I don’t mind if we do need to go to the fell-blown solution of transforming from world to tank space, but if I can avoid it and keep it this simple I will.

I even got this problem checking out your commit too, so your project should have the same problem.

This code seems to work

	if (DeltaRotator.Yaw < -180.f)
	{
		Turret->Rotate(360.f + DeltaRotator.Yaw);
	}

	else if (DeltaRotator.Yaw < 180)
	{
		Turret->Rotate(DeltaRotator.Yaw);
	}
	else
	{
		Turret->Rotate(-DeltaRotator.Yaw);
	}

Thanks Dan, so I’ve managed to reproduce it my end now. Well-done finding that solution. I’m a bit reluctant to put 2 special cases in as we’re approaching the complexity of the coordinate-transform solution.

The simple introduction of FMath::Abs() works though, basically saying “avoid reflex angles”…

if (FMath::Abs(DeltaRotator.Yaw) < 180)
{
	Turret->Rotate(DeltaRotator.Yaw);
}
else
{
	Turret->Rotate(-DeltaRotator.Yaw);
}

However, this whole approach only works if the tank isn’t on it’s side…

Well I think this is what you were initially trying to achieve, being that you work out which way you want to turn when you are looking in the opposite direction of the barrel.

if (DeltaRotator.Yaw > 180.f)
{
	Turret->Rotate(DeltaRotator.Yaw - 360.f);
}
else if (DeltaRotator.Yaw < -180.f)
{
	Turret->Rotate(DeltaRotator.Yaw + 360.f);
}
else
{
	Turret->Rotate(DeltaRotator.Yaw);
}

I’m not sure it’s worth re-recording 3 videos again, the aiming was improved and any of the code above can be added back-in in the next few videos. Thanks for highlighting it.

EDIT: I’ll also add this annotation to the aiming video, so people can go to a solution straight-away if they wish, without waiting a few videos…

@DanM @ben Thanks for working though these as i have the kids home for summer so its a little hard for me to get on to any lectures. Hoping i might get one in a week until they go back to school.
It agree its useful to see how this progresses and the bumps in the road along the way as its all part of the learning process for us :slight_smile:

1 Like

You’re welcome, it’s so much fun and @DanM is so on the ball it’s great.

AutoMortar™ coming next, see Facebook here.

I’ve not watched the mortar video yet but as Brock on Udemy said, shouldn’t we be using int32 or even better, uint32 instead of int.

Also, if you didn’t know, pressing the end key puts an object on the ground.

Hi Dan, thanks I was aware of End and have mentioned it but perhaps not explicitly enough.

Re integers, absolutely I’ll correct this, thanks

I thought you did too but I always see you do it manually.

Yeah, guess I’m scared that Mac users don’t have and End key and that I’ll have to waffle over that bit. It often snaps to the floor well though when you first drag a blueprint in though.

I have been developing software for around three decades now when I finally decided to turn my sights on game programming with Unreal this last March. I feel like I decided to climb Mt Everest.

I am happy with the way this course is going with it’s warts and all. It feels like real programming time, not some polished, pie in the sky class. As someone who does a lot of plumbing coding with web services, I appreciate the architecture issues you bring up. I like that you are teaching the tools, not how to make a battle tank game. It’s like back in college where they taught system architecture and business requirement gathering and COBOL was just one of the tools to get the business solution implemented.

The knowledge with integrating C++ classes and the blueprints along with being shown flashes of looking at the engine source is invaluable. In this business, when you know how to find the answers is when you know you are making critical progress in learning.

Thanks. This course is worth far more than what I paid for. It is literally the best money I have spent.

Keep up the good work.

Adam

1 Like

Thank you. Tomorrow we’ll be diving deep into particles systems.

Juicy content about the Reference Viewer, source control and particle systems inbound

Got sidetracked with Stardew Valley again, so regarding L180, instead of adding starter content, moving what you want then deleting the rest. Maybe have an empty project with the starter content and using the migrate asset feature?

Edit: nvm lol.

1 Like

So for the impact particle, wouldn’t you want to spawn the particle at the location of OnHit() using UGameplayStatics so you can then call Destroy() on the projectile after?

That is one of the options, have you seen lecture 185 yet where I lay-out 3 options?

Privacy & Terms