Download

Updates for ShooterGame example?

I’m making an FPS. ShooterGame is the obvious reference to look at.

It is very helpful, but I’m noticing some stuff that is incomplete, for example:


class AShooterCharacter {
///...
	TArray<TSubclassOf<class AShooterWeapon> > DefaultInventoryClasses;
///...
}

DefaultInventoryClasses is never inintialized, but it is used in the function: void AShooterCharacter::SpawnDefaultInventory()

If I debug that function, I find that code is run and uses the (uninitialized) value to construct a NewWeapon.

There is a comment nearby saying this is part of a hack to give only 1 weapon, but the code creating NewWeapon is still expecting AShooterCharacter::DefaultInventoryClasses to be initialized when it is not. That should have been hacked out along with that hack?

A nice complete base FPS game to build on would save development time.

As an example it would be invaluable, and would probably save a time answering questions (like this one).

Establishing “the right way” with an example will also be very beneficial long term, e.g. to developers joining other teams, sharing/reusing code, etc.
It would suck to see many projects each doing things their own way, and choosing to do something silly.

Thanks

Actually, DefaultInventoryClasses is a EditDefaultsOnly uproperty. PlayerPawn and BotPawn each have two weapons assigned in the editor.

I would be more concerned with the networking, more specifically the questionable hit verification where the client is trusted with the hit position.
Right now, Shooter Game is the best reference out there, so I agree that having everything done “the right way” would be nice. I wouldn’t want to see that networking code in other games.