Very Basic FPS Help Needed: Compile Errors

Hey everyone, I’m trying to follow the linked tutorial to learn how to make a basic FPS from scratch because I really want to learn how to do all the coding etc. myself so I can make something very specific later that I don’t think I’ll be able to rely on templetes for.

But the very first code I tried to compile keeps returning errors.

The tutorial is kind of hard to follow because it’s apparently for an older version of UE. It’s riddled with caveats and alternative terms for different versions so maybe it’s just a compatibility issue and maybe it’s not even updated for the current version. But I’ve followed it as best I can and I’m getting this when I try to compile.

It’s possible visual basic isn’t set up to compile with/for UE4. But I downloaded a lot of UE pluggins for it.

I’m just not at all sure what I’m doing here. If anyone has any insight I could use the help…

Hey all, my bad I should’ve known to attach the actual code. I didn’t get very far with my first attempt anyway since the first compile failed.

So instead I worked on conceptualizing the game on paper in the meantime. No point coding if I don’t know what I need to code right?

Anyway, I’ve circled back around to trying to get UE4 to work now that I have my ideas fleshed out and uh. Written down haha. And as soon as I create the project Visual Studio opens up and tells me this?

https://forums.unrealengine.com/filedata/fetch?filedataid=131275&type=thumb

So maybe I just don’t even have visual studio set up properly? I don’t know enough about this stuff to have any clue what this means. I’m gonna guess that if I change the SDK I’ll be programming a game for windows 8 since that seems to be the only other option. And if I upgrade the toolset that will change something about the project as set up by UE4 but then will that mean it won’t keep working with UE4? I have no idea.

MAYDAY. MAYDAY.

UGH.

So got back to the compile step again and it’s doing the same thing.

I’ve attached a screenshot of the tutorial and my visual studio screen so you can see it side by side. I’m doing exactly what the tutorial says exactly the way the tutorial says to do it and EVERYTHING is underlined red. Visual Studio says everything i’m typing is undefined, or name followed by ‘::’ must be a class or namespace name.

How can this be possible. I’m literally just cutting and pasting from a tutorial, can the tutorial really be THAT wrong? If so, WHY is it up on the unreal wiki???

Thus far this has been the only tutorial I’ve found to setup an extremely basic FPS using C++

The game I want to make is… not like any other game I’ve seen or played before (uh, the whole point of making one myself right?) so I don’t want to use any kind of premade template. What I need is a tutorial to use C++ to set up esentially a completely blank game with absolute minimum move around functionality for me to buil everthing on top of.

So if this tutorial is broken please let me know. And if anyone knows of any better tutorial out there for someone that knows basic Java and has never done C++ before that would help too.

I’m going to paste in the code below as well.

fpsMode.h



// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "fpsMode.generated.h"

/**
*
*/
UCLASS()
class REDTIDE_API AfpsMode : public AGameModeBase
{
GENERATED_BODY()

virtual void StartPlay() override;


};


fpsMode.cpp



// Fill out your copyright notice in the Description page of Project Settings.

#include "fpsMode.h"

fpsMode::fpsMode(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{

}

void fpsMode::StartPlay()
{
Super::StartPlay();

StartMatch();

if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("HELLO WORLD"));
}
}


I’m not sure if you ever resolved this, and if you did, nice!
What I think this might be is that, when creating a new C++ class, UE4 doesn’t add the full path to your include for the header file. From what I’ve understood, it shouldn’t matter too much if it’s in the base folder, but what shouldn’t matter and what the editor complains about are wildly different. :slight_smile:
So, try adding the folder name to the beginning of the #include in your .cpp file.
i.e. #include “[FOLDERNAME]/fpsMode.h”
This issue will also crop up again if you try to create extra folders to organize your code. Just remember to add that first part and compile to see if Unreal is less upset.

Good luck!