Download

Rama Available, Counseling, Steam/Multiplayer Code, UI, C++ Game Mechanics

Rama’s BP Pull Requests Accepted in 4.5

Dear Community,

I’ve put together a pic with most of my BP-related pull requests that Epic accepted that are now in the Engine as of 4.5!

I made these pull requests for your benefit, and wanted you to know these new tools that are available to you!


*(download or right click -> open in new tab to easily zoom in!)*
![0c0e2f7ab5f7f8d9a6080be22203cae400611afc.jpeg|1280x960](upload://1IE7ysc9X9NUdKPDRaO5YKly2oA.jpeg)

**Random Point in Bounds** 

You can now easily obtain random points within the total bounds of an array of actors, or within the bounds of a single component!

For example, you can use this **to play random sparkle emitters** with the bounds of a group of level actors, or a single volume, or even just a single component!


**Line Trace Component Returns Bone Name now** 

You can now easily find out what bone was hit when you do a Line Trace Component!


**Color Interp** 

You can now interpolate between two linear colors!

Please note the first input should be your current value that is carried over from tick to tick :)

**Vector - Rotator**

You can now drag from a rotator pin directly to a vector pin, and vice versa, and the correct conversion node is created for you!


**CoPlanarity Test** 

Please recall from 4.4 that my submitted CoPlanarity Test BP node was accepted and is available for your use! Any time you need to know if 4+ points are coplanar you can use this node! There is a tolerance value that you can control! **The tolerance is in World Space**

Improvements Made to Get Actors in Selection Box

In 4.5 you can now specify whether to only check against colliding components when checking if an actor is within your selection marquee / selection rectangle!

HUD BP
13b13bd3c2f8cdadf7c624dd749fbd31efadb6f5.jpeg

Enjoy!

:heart:

Rama

Fun With Beams!

This video shows the Ship Creature’s charge up affect as it prepares to blast the ground to create new structures or deal with unauthorized base visitors!

In this video I am using several kinds of beams in several different ways!


**Beam Types**

1. straight beam, with source in local space, target in world space. Target is set in C++ to match position of the unit.

2. arced beam, with a tangent that is getting set in code, source in local, target in world/absolute space

3. straight beam with a source point in world space that is set in code, and a target that is in world space, also set in c++.

The Hardest Part

The hardest part of what you see in the video was making the tangents for the arced beams stay consistent no matter which way the ship is looking in order to point directly at its target!

I had to use an odd hybrid of world and local space to accomplish this :slight_smile:

Here’s what the code ended up looking like!



//World Space Location of Target
NewBeamLoc = FMath::VInterpTo(
	NewBeamLoc,
	(VISVALID(Tracking_Actor)) ? Tracking_Actor->GetActorLocation() : Tracking_Location,
	GDELTATIME,
	12
);

 
//Half way between Eye of Creature and Target Location
const FVector MidPoint = (NewBeamLoc + GetEyeLocation())/2;
	
int32 Index = 0;
for(UParticleSystemComponent* Comp : BeamArcs)
{
	if(VISVALID(Comp))
	{
		//TEMP SHOULD REALLY BE HGIHER UP
		Comp->SetVectorParameter(FName("Target"),MidPoint);
		
		//Set the particle tangent position!
		if(ArcTangents.IsValidIndex(Index))
		{
			//Local Space settings set by Designers in Editor
			// 	as this controls the overall appearance of the arc.
			// 		not modified during runtime.
			FVector BPTangent = ArcTangents[Index];
			
			//World Dir
			FVector DirToTarget = (NewBeamLoc - GetEyeLocation()).SafeNormal();
			
			//World Right Vector
			FRotator WorldRight 	= FRotator(0,DirToTarget.Rotation().Yaw,0);
			WorldRight.Yaw 			+= 90;
			 
			//Oddly enough, Tangent has to start at 0!  Strange but true!
			//		(would have thought it would be be the beam anchor location)
			FVector Tangent 			= ZEROVECTOR;
			 
			//Forward
			Tangent = DirToTarget * BPTangent.X;
			
			//Right
			Tangent = WorldRight.Vector() * BPTangent.Y;
			
			//Up
			Tangent.Z = BPTangent.Z; 
			  
			//Tangent Beam Particle Parameter
			Comp->SetVectorParameter("Arc",Tangent);
		}
		Index++;
	}
}




Things to Note In My Code

1. The Designers can control the actual arcs of the beams in local space using a dynamic array of Vectors that I exposed to BP Defaults for the creature.

2. I am having to obtain the world direction and the world right direction between the eye of the Creature its current target, and then convert the local space coordinates set in BP into world positions. These world positions are the locations for the beam tangents that I set via beam particle parameter in Cascade.

3. **The end result is that the beam arcs stay consistent no matter how the creature rotates,** but, the beams are still tracking a world space location and the arched beams end at the midpoint betwen ship and its world space target!

Enjoy the Video!

♥

Rama

**New UMG Node

Get All Widgets of Class

Ideal for UMG Level Transitions**

I needed this node for Solus and so I am now sharing it with you!

The issue was that I could not save a reference to my new widget because it is loaded and then a level change occurs which resets all my HUD variables.

So I needed to access the widget after it was created dynamically, not relying on stored references within the HUD class.

I also did not want to have to store a reference to it in my Game Instance class cause then that leads to garbage collection issues.

I had to make the node for my own use and I have tested it as working in Solus!

**Now you can retrieve an array of any type of user-made UMG widget that is currently in your game at any time!
**


**Download**

https://wiki.unrealengine.com/File:VictoryPlugin.zip

C++ Code

Here’s what the C++ for this node looks like!



void UVictoryBPFunctionLibrary::GetAllWidgetsOfClass(UObject* WorldContextObject, TSubclassOf<UUserWidget> WidgetClass, TArray<UUserWidget*>& FoundWidgets)
{
	//Prevent possibility of an ever-growing array if user uses this in a loop
	FoundWidgets.Empty();
	//~~~~~~~~~~~~
	 
	if(!WidgetClass) return;
	if(!WorldContextObject) return;
	 
	UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject);
	if(!World) return;
	//~~~~~~~~~~~
	
	for(TObjectIterator<UUserWidget> Itr; Itr; ++Itr)
	{
		if(Itr->GetWorld() != World) continue;
		//~~~~~~~~~~~~~~~~~~~~~
		
		if(Itr->IsA(WidgetClass))
		{
			FoundWidgets.Add(*Itr);
		}
	}
}



**Pic**

(right click -&gt; open in new tab to see it better)
![GetAllWidgetsOfClass.jpg|1280x960](upload://k3rJSJemWVjAQ9p7eXZQVNYeJAl.jpeg)

Enjoy!

Rama

Here’s a challenge for you xD
I can’t hire someone for it, but something like that in Marketplace I would pay whatever were to be charged… 100, 200, 500$… I would buy:
https://forums.unrealengine.com/showthread.php?3396-PAID-Dynamic-Mesh-Slicing-System

**Rama’s Multiplayer Game Mode Solution

Find Player Start

Choose Player Start

Can Player Restart

These Core Multiplayer Functions are Fully Implementable/Overridable in Blueprints!**

I have found a solution for the issue of implementing FindPlayerStart, ChoosePlayerStart, and CanPlayerRestart in Blueprints!

And I’ve tested it as working!

**You can now implement core network coding of choosing player starts entirely in Blueprints!
**


**How To Use**

In my picture below I show how to use my Game Mode overrides!

1. **First make a new BP and select my VictoryGameMode class** which comes with my Victory BP Library (make sure you have the latest download https://wiki.unrealengine.com/File:VictoryPlugin.zip)

2. Setup the Victory Game Mode BP the same as my picture below!

3. Celebrate! You can now implement core multiplayer logic in Blueprints!

![VictoryGameMode.jpg|1280x960](upload://9IpVbBoysg8W1JaL94JHYMxDeVQ.jpeg)

CPP Override and CPP Override Var

Please note the notation I am using, any variable that has CPPOverride Var in its name is used only with the corresponding event. This is how I enabled you to override core Game Mode functions via my Victory BP plugin!


**Simple Data Types**

Please note that for the function that is designed to return a boolean value, CanPlayerRestart, you must pass the boolean and also a special variable, **CPPOverride SelfReference**, this is how you tell the CPP that you are implementing a BP override

Non Destructive Solution

My solution is entirely optional and if you do not implement the event in Blueprints, and your programmer does it in C++, my solution will not interfere at all with your existing code base!


**Log Message**

If you do implement my solution in BP, I am printing log information to indicate this, so you/your programmer knows you are using a BP override and any C++ code will not be run.

C++ Code

Here is my C++ code for FindPlayerStart which shows how I worked around the issue of overriding FindPlayerStart via Blueprints!

Again I’ve tested this as entirely working in PIE and commandline games!

.h



//Find Player Start
public:
	/** Use this var inside the body of CPP Override ~ Find Player Start event to override the C++ functionality! */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Victory Game Mode")
	AActor* CPPOverrideVar_FindPlayerStart;
	
	/** 
	 * Use CPPOverrideVar_FindPlayerStart inside of this event to implement FindPlayerStart in BP ! <3 Rama
	 *
	 * Return the 'best' player start for this player to start from.
	 * @param Player - is the AController for whom we are choosing a playerstart
	 * @param IncomingName - specifies the tag of a Playerstart to use
	 * @returns Actor chosen as player start (usually a PlayerStart)
	 */
	UFUNCTION(BlueprintImplementableEvent, meta=(FriendlyName = "CPP Override ~ Find Player Start"))
	virtual void CPPOverride_FindPlayerStart();

	virtual class AActor* FindPlayerStart( AController* Player, const FString& IncomingName = TEXT("") ) override;


.cpp



//Find
AActor* AVictoryGameMode::FindPlayerStart( AController* Player, const FString& IncomingName )
{
	//Clear any previous to indicate whether BP did an override
	CPPOverrideVar_FindPlayerStart = NULL;
	
	//=======================
	//BP Hook by Rama
	this->CPPOverride_FindPlayerStart();
	//=======================
	
	if(CPPOverrideVar_FindPlayerStart) //Did BP user set the var?
	{ 
		//Indicate that the BP override was found and is being used.
		UE_LOG(VictoryGameModeLog, Log, TEXT("

"));
		UE_LOG(VictoryGameModeLog, Log, TEXT("FindPlayerStart: CPP override found in %s and used instead of C++ implementation"), *GetName());
		UE_LOG(VictoryGameModeLog, Log, TEXT("

"));
		return CPPOverrideVar_FindPlayerStart;
	} 
	 
	//Default C++ Implementation
	return Super::FindPlayerStart(Player,IncomingName);
}



**Enjoy!**

Rama

BP Node to Get Your Computer’s IP Address!

Dear Community,

I’ve finally succeeded at implementing a node that many have been trying to implement since the Beta!

This is a BP node that gets the IP address of your computer!

My node relies on http://api.ipify.org, a free and easy way to get your current IP address.

Because this node involves an HTTP request I can’t make it a static library node, so I instead made a VictoryPC class that contains only this functionality.

You can easily re-parent your current player controller blueprint to use my plugin VictoryPC class!

File->Reparent

and if you are not using a PC already, make sure to go to World Settings and use my VictoryPC as your player controller!

As long as my Victory BP Library is an active plugin for you, then this VictoryPC class will show up!

Download:


**Celebration!**

Yay!

Now we can all get the IP address of the local computer for use with multiplayer games or webserver activities!

Enjoy!

Rama

Pic

Here’s the setup you should create in your Blueprinted version of my VictoryPC!

2902549c08d489d31bb43f8a7049793370d4801e.jpeg


**C++ Source Code For You**

Here is the C++ source code I wrote just earlier today!



```


bool AVictoryPC::VictoryPC_GetMyIP_SendRequest()
{
	FHttpModule* Http = &FHttpModule::Get();
	
	if(!Http)
	{
		return false;
	}
	 
	if(!Http->IsHttpEnabled()) 
	{
		return false;
	} 
	//~~~~~~~~~~~~~~~~~~~
	
	FString TargetHost = "http://api.ipify.org";
	TSharedRef < IHttpRequest > Request = Http->CreateRequest(); 
	Request->SetVerb("GET");
	Request->SetURL(TargetHost);
	Request->SetHeader("User-Agent", "VictoryBPLibrary/1.0");
	Request->SetHeader("Content-Type" ,"text/html");
 
	Request->OnProcessRequestComplete().BindUObject(this, &AVictoryPC::HTTPOnResponseReceived);
	if (!Request->ProcessRequest())
	{
		return false;
	}
	  
	return true;
}
	
void AVictoryPC::HTTPOnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
	this->VictoryPC_GetMyIP_DataReceived(Response->GetContentAsString());
}
 


```



♥

Rama

Creating BP-Only AI Systems

Dear Community,

I really enjoy helping people create BP-only AI systems! I have my own special method that does not involve Behavior Trees, but gives me all the power and convenience of Blueprints.

I can help you add AI to your project without needing your whole project on my computer, using remote access IT tools or Skype!

I recently wrote this post explaining more about how you can do BP-only AI systems!


**AI in Blueprints Without Behavior Trees**

I routinely counsel people in BP-only AI systems that do not use Behavior trees, but rather a very simple system that I designed myself (no C++ or plugins required).


**For anyone who is interested:**

"AI movement and detection"

The real core of AI movement is done via the UE4 Navigation system, you can utilize its wonderful functionality without needing BTs.

Detection can be done easily in BP, especially now that we have **Vector Length Squared** in BP, so that more efficient distance checks are now possible.

Core of BP-Only AI Systems

To implement your own AI logic you really just need a tick function, or a short looping timer like 0.01 seconds, and then you can use all the power of BP to create your own AI logic flow :slight_smile:

Blueprint Inheritance becomes very important when you want to design AI systems that can be used by many different subclasses, like for many different types of characters. So you’ll want to make sure you always call the parent function on your core AI Events! Right click on any Event, and select “Add Call To Parent Function” to see what I mean! This is absolutely mandatory for BP Inheritance!

Send me a pm if you would like further assistance related to using BP-only AI systems!

Have fun today!

Rama

Rama has been a huge help to me with game optimization and steam integration. I highly reccomend his services. He is very knowledgable, a nice guy, and easy to work with!

I’ll ditto that statement, CptShip. Rama has been helping me with two different projects at the same time and has made my life much easier in both instances. Not only can he work wonders in C++, he also understands how to bring his work into Blueprints in a meaningful way for those who don’t want (or don’t have the ability) to touch code.

Hi Rama, sent you a msg, would love to hook up with you to engage you in a consulting role to help us out. Please check your inbox!

hey rama sent you a message could please look at it!!!

A man in demand. Message from me too whenever you get the chance to get to it :slight_smile:

Hey Rama, sent you a PM :slight_smile:

Rama, a pm is waiting for you from me! :slight_smile:

Rama, I see you’ve already added the ability to load 2D textures from a file via blueprint. How much would you charge to adapt that plugin to present that newly read texture info as an array of vector4s? Or perhaps make a more generic texture to vector4 array conversion node? With the accompanying vector4 array to texture node of course? I personally think this would be a very handy thing for people trying to do procedural content generation. Please PM me with a quote. Cheers,

J^2

Check your inbox, we sent you a PM. Thanks :slight_smile:

Just wanted to say WOW! Rama just improved the performance of my game like crazy. My game was at like 45-60 fps at about 16-20ms now I saw my game peak at 160fps and the ms was down to 5ms. This was all done in one hour by the way.

I suggest anyone who doesn’t know about profiling, ask for this service.

Thanks again Rama I know we have been working together off and on for almost a year but never actually spoke. Great talking to you today, look forward to working with you again.

Isaac

Great to hear from you all!

You’re welcome Isaac!

I was exceedingly pleased myself to see that profiling graph go from looking like Mt Everest with some slightly smaller mountains to going flat line to the point that we could not figure out which line was representing performance hits!

I helped Isaac reduce his game thread performance hit by a factor of 10 within about 20 minutes of seeing his project for the first time!

:slight_smile:

Rama

Hello Rama! I just wanted to let you know that I sent you a PM.

Hey Rama!
I sent you a reply to you in your PM several days ago specifying the things you wondered about what services was needed.

Thanks in advance :slight_smile: