[Solved] Coding: Vs file generation works but not reflected in game

Btw I am “EverNewJoy” From the Forums:
My Tutorial Hub with lots of videos

Update

I tried editing the shootergame cpp files and using the rightclick vs file build feature as well

Dear Friends at Epic,

Hi there!

First of all thank you for the awesome UE4 engine!

I am trying to do a mostly code-based project.

I started with a third person c++ project.

I can run the project just fine in the editor.

I am using VS 2012 express.

  1. In the editor if I launch vs it works just fine.

  2. I can rebuild solution in VS

  3. If I right click on uproject file and click “Generate Visual Studio Files” it does so quite happily without errors.

4. I have tried deleting the .sln file, which is recreated after #3 runs.

  1. But the changes I’ve made, either in VS or through external C++ editor, are not reflected in game (I right click on the uproject to run it by itself, but its the same in the editor too).

Here is the code I’ve changed that I am trying to get to show up in game.

Basically I extended the camera distance to 2000 as a test and I made it so the character yaw should rotate with controller

AVictoryGameCharacter::AVictoryGameCharacter(const class FPostConstructInitializeProperties& PCIP)
    	: Super(PCIP)
    {
    	// Don't rotate when the controller rotates. Let that just affect the camera.
    	bUseControllerRotationPitch = false;
    	bUseControllerRotationYaw = true;
    	bUseControllerRotationRoll = false;
    
    	// Character moves in the direction of input...
    	CharacterMovement->bOrientToMovement = true;
    	// ...at this rotation rate
    	CharacterMovement->RotationRate = FRotator(360.0f, 360.0f, 360.0f);

	// Create a follow camera
	FollowCamera = PCIP.CreateDefaultSubobject(this, TEXT("FollowCamera"));
	Components.Add(FollowCamera);

	// Create a camera boom (pulls in towards the player if there is a collision)
	CameraBoom = PCIP.CreateDefaultSubobject(this, TEXT("CameraBoom"));
	CameraBoom->AttachTo(RootComponent);
	Components.Add(CameraBoom);

	// The camera follows at this distance behind the character
	CameraBoom->TargetArmLength = 2000.0f;
	// and offset by this amount
	CameraBoom->SocketOffset = FVector::ZeroVector;

	// Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
	// instead of the camera
	FollowCamera->AttachTo(CameraBoom, USpringArmComponent::SocketName);
	CameraBoom->bUseControllerViewRotation = true;
	FollowCamera->bUseControllerViewRotation = false;

	// Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character)
	// are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++)
}

**Update:**

I downloaded the shootergame and edited the ShooterCharacter.cpp as follows:

The only change I made was to change the running speed modifier to 12

    RunningSpeedModifier = 12f; //was 1.5

then I right clicked on shootergame.uproject to rebuild the vs files.

then I right click to play the shootergame

When sprint using SHIFT I the running speed is not reflecting my cpp edit 

Please let me know how I can update cpp files and get them to show in game :)

    AShooterCharacter::AShooterCharacter(const class FPostConstructInitializeProperties& PCIP)
    	: Super(PCIP.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName))
    {
    	Mesh1P = PCIP.CreateDefaultSubobject(this, TEXT("PawnMesh1P"));
    	Mesh1P->AttachParent = CapsuleComponent;
    	Mesh1P->bOnlyOwnerSee = true;
    	Mesh1P->bOwnerNoSee = false;
    	Mesh1P->bCastDynamicShadow = false;
    	Mesh1P->bReceivesDecals = false;
    	Mesh1P->SkinnedMeshUpdateFlag = SMU_OnlyTickPoseWhenRendered;
    	Mesh1P->PrimaryComponentTick.TickGroup = TG_PrePhysics;
    	Mesh1P->bChartDistanceFactor = false;
    	Mesh1P->BodyInstance.SetMovementChannel(ECC_PawnMovement);
    	Mesh1P->BodyInstance.SetCollisionEnabled(ECollisionEnabled::NoCollision);
    	Mesh1P->BodyInstance.SetResponseToAllChannels(ECR_Ignore);
    	Components.Add(Mesh1P);
    
    	Mesh->bOnlyOwnerSee = false;
    	Mesh->bOwnerNoSee = true;
    	Mesh->bReceivesDecals = false;
    	Mesh->BodyInstance.SetMovementChannel(ECC_PawnMovement);
    	Mesh->BodyInstance.SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
    	Mesh->BodyInstance.SetResponseToChannel(COLLISION_WEAPON, ECR_Block);
    	Mesh->BodyInstance.SetResponseToChannel(COLLISION_PROJECTILE, ECR_Block);
    	Mesh->BodyInstance.SetResponseToChannel(ECC_Visibility, ECR_Block);
    
    	CapsuleComponent->BodyInstance.SetResponseToChannel(ECC_Camera, ECR_Ignore);
    	CapsuleComponent->BodyInstance.SetResponseToChannel(COLLISION_PROJECTILE, ECR_Block);
    	CapsuleComponent->BodyInstance.SetResponseToChannel(COLLISION_WEAPON, ECR_Ignore);
    
    	TargetingSpeedModifier = 0.5f;
    	bIsTargeting = false;
    	RunningSpeedModifier = 12f;
    	bWantsToRun = false;
    	bWantsToFire = false;
    	bReplicateHealthToAll = true;
    	LowHealthPercentage = 0.5f;
    }

then I right clicked on shootergame.uproject to rebuild the vs files.
then I right click to play the shootergame

You’re totally on the right track here, but you may have missed a very important step between those two actions. After you generate Visual Studio files, you’ll need to open Visual Studio and compile your game module.

Load up the “.sln” file for your project into Visual Studio, set the build configuration to “Development” (on the top toolbar), then right click on “(YourGame)Editor” and hit “Build”. If this completes successfully, you can run the Rocket editor and see your changes take effect.

Let us know if that doesn’t work for you.

–Mike

“then right click on “(YourGame)Editor” and hit “Build”. If this completes successfully, you can run the Rocket editor and see your changes take effect.”

I think I am missing you at this step, though I am glad there was a whole step I was not doing, I just have to figure out how to do it :slight_smile:

I’ve attempted to rebuild my solution 2 different ways, seen in pics below, but the game via editor or right click does not show the change (2000 cam boom and player unit should follow controller yaw rotation)

When I rebuild my solution I get some errors, only one of which looks concerning to me due to lack of experience, which is the .exe error.

I’ve enclosed pictures of my attempts to follow your instructions.

Again I am not sure what the (YourGame)Editor part is, is that the Build and run section of the Solutions View?

I set the build to development in two places:

project settings
http://imageshack.com/a/img580/8910/rcpx.jpg

debugging
http://imageshack.com/a/img189/273/k3qb.jpg

the build attempt / error

http://imageshack.com/a/img15/1489/nsl4.jpg

http://imageshack.com/a/img694/5285/xpfs.jpg

Oh nvm I see the (your game)editor now :slight_smile:

And for anyone getting startled by the errors make sure to see these instructions

https://rocket.unrealengine.com/docs/ue4/INT/GettingStarted/Programming/VisualStudioSetup/index.html

"You’re totally on the right track here, but you may have missed a very important step between those two actions. After you generate Visual Studio files, you’ll need to open Visual Studio and compile your game module.

Load up the “.sln” file for your project into Visual Studio, set the build configuration to “Development” (on the top toolbar), then right click on “(YourGame)Editor” and hit “Build”. If this completes successfully, you can run the Rocket editor and see your changes take effect.

Let us know if that doesn’t work for you.

–Mike"


Woohooo!!

That worked!


Thanks so much Mike!


**Question:**

What happens when my 30 day trial for VS 2012 runs out?

I dont have the $500 or so to spend on VS at the moment :)

Will there ever be a method that doesnt require VS ?

**Question 2:**

The compile time for such a small project seems quite long,

will there ever be a way to speed up this code compilation iteration time, perhaps related to #1 question above?


**Help for Others**

For anyone who is trying to figure out how to get their project to reflect code changes, you need to first

 1. make changes to the .cpp files in Source
 2. right click on .uproject and build the studio files
 3. go into vs as per Mike's helpful instruction and open the solution view
 4. right click on (your game)editor and Build

Hi Nathan,

You can make non-code based projects with blueprints. Otherwise, you will need visual studio 2012 to compile.

As far as compile times, Mike will have to answer, that is a little over my head.

What happens when my 30 day trial for VS 2012 runs out?

Visual Studio 2012 Express for Windows Desktop is free for use as long as you want. You do have to create an account with Microsoft but there is no charge to keep using it with Rocket. Did you install the Professional version by chance instead?

will there ever be a way to speed up this code compilation iteration time

Yes we are working on improving iteration times. The first time you compile your project it will take awhile, but subsequent compiles will be quicker. Actually, there is a known issue with the current Beta where if you only have a handful of source files in your game, compiling will take much longer than it should even on subsequent compiles. We’ll be improving this.

–Mike

Thank you Alexander and Mike for the answers!

Mike:
" Actually, there is a known issue with the current Beta where if you only have a handful of source files in your game, compiling will take much longer than it should even on subsequent compiles. We’ll be improving this"

Actually I have noticed that sometimes, seemingly almost randomly, compile times will be VERY fast, like about 200% faster

but majority of the time it takes a good 7 seconds for only tiny amount of classes and code

Thanks for the info about VS 2012 express, sounds like I will be able to make my Rocket game dreams come true!!!

I already have my own functional custom AI base to work with :slight_smile:

Rama

I posted a tutorial on this here:

http://forums.epicgames.com/threads/972861-Tutorial-How-to-Edit-C-Compile-Your-UE4-Project-Code-and-See-Changes-In-Game