Announcement

Collapse
No announcement yet.

(39) Rama's Extra Blueprint Nodes for You as a Plugin, No C++ Required!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Hey Rama!

    You're doing an amazing job here to the comunity, that's awesome!

    ... I was trying your Victory Get Custom Config Var functionality but I looks like it's not working. It loads random numbers from the config file.

    I'm using the Saved\Config\Windows\Game.ini file!

    Is there anything wrong?

    Thank you!

    Comment


      Ok, I got the ISM node to work. I turned something like 34,000 trees into 1 mesh. Draw calls dropped from 136,000 to ~1500.

      I don't know why it didn't work the other day, but it seems to do the trick today. Trees kept their LODs and everything seemed to work fine visually.

      We seem to have a problem with the trees though, which isn't necessarily related to your node.

      With all those trees instanced in the world using either normal instance, or hierarchical, the FPS is about 4-6. When I use the Victory ISM node the FPS jumps to 15. If I just don't spawn the trees at all, the FPS is ~55.

      I was hoping combining them all into a single ISM would be the answer, but it doesn't seem to be the case, at least not completely. Will have to investigate possible issues with the trees on this end.
      Map Generator 1.0
      Map Generator 2.0
      Map Generator 3.0

      Comment


        Originally posted by Zeustiak View Post
        We seem to have a problem with the trees though, which isn't necessarily related to your node.

        With all those trees instanced in the world using either normal instance, or hierarchical, the FPS is about 4-6. When I use the Victory ISM node the FPS jumps to 15. If I just don't spawn the trees at all, the FPS is ~55.

        I was hoping combining them all into a single ISM would be the answer, but it doesn't seem to be the case, at least not completely. Will have to investigate possible issues with the trees on this end.
        One solution to this is to add an alpha culling in the foliage MAT, i am running some tests at the moment on this.

        Comment


          Originally posted by Zeroy View Post
          One solution to this is to add an alpha culling in the foliage MAT, i am running some tests at the moment on this.
          What is the name of that node in the mat editor?
          Map Generator 1.0
          Map Generator 2.0
          Map Generator 3.0

          Comment


            Posted about this in a separate thread to avoid hijacking this one:

            https://forums.unrealengine.com/show...ee-kill-my-fps

            Any advice or tips would be greatly appreciated. Cheers,

            J^2

            Comment


              Originally posted by Isaac Nichols View Post
              Nice addition being able to see files. Thank you.
              You're welcome Isaac!

              Originally posted by J. J. Franzen View Post
              By "add a single C++ file" do you mean any old file or something specific? I can compile anything, I just need the source.

              J^2
              You can add an empty new AActor class with a name of your choosing and that should do the trick, again this should all be different once 4.8 comes along

              Originally posted by fireapache View Post
              Hey Rama!

              You're doing an amazing job here to the comunity, that's awesome!

              ... I was trying your Victory Get Custom Config Var functionality but I looks like it's not working. It loads random numbers from the config file.

              I'm using the Saved\Config\Windows\Game.ini file!

              Is there anything wrong?

              Thank you!
              I will investigate this as soon as I can!

              Originally posted by Zeustiak View Post
              Ok, I got the ISM node to work. I turned something like 34,000 trees into 1 mesh. Draw calls dropped from 136,000 to ~1500.

              With all those trees instanced in the world using either normal instance, or hierarchical, the FPS is about 4-6. When I use the Victory ISM node the FPS jumps to 15. If I just don't spawn the trees at all, the FPS is ~55.
              Glad to hear there was some improvement, good luck with your tree shader!

              Originally posted by Kris View Post
              Depending on how we end up implementing custom patches/insignias, I may end up taking care of this.

              Kris.
              Lovely to hear from you Kris, let me know how it goes!

              Have fun today everyone!

              Rama
              Last edited by Rama; 04-06-2015, 01:59 AM.
              100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

              UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

              Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

              Comment


                Load Texture 2D From File!

                JPG, PNG, BMP, ICO, EXR, and ICNS are Supported File Formats !


                With this node you can load a Texture 2D from a file during runtime!

                I output for you the width and height of the loaded image!

                Now you can easily create Texture 2D's from image files in Blueprints, during runtime!


                Special Note!

                Tim Sweeney liked this node!


                Enjoy!

                Rama

                PS: Make sure to include the file extension when you use this node!

                Click image for larger version

Name:	LoadImageFromFile.jpg
Views:	8
Size:	238.0 KB
ID:	1072015

                Click image for larger version

Name:	LoadImageFromFile2.jpg
Views:	8
Size:	201.0 KB
ID:	1072016

                ~~~

                C++ Code For You

                Here is the core C++ function involved, entire source is in the download! I wrote my own Enum for the file formats.

                Code:
                UTexture2D* UVictoryBPFunctionLibrary::Victory_LoadTexture2D_FromFile(const FString& FullFilePath,EJoyImageFormats ImageFormat, bool& IsValid,int32& Width, int32& Height)
                {
                	IsValid = false;
                	UTexture2D* LoadedT2D = NULL;
                	
                	IImageWrapperModule& ImageWrapperModule = FModuleManager::LoadModuleChecked<IImageWrapperModule>(FName("ImageWrapper"));
                	
                	IImageWrapperPtr ImageWrapper = ImageWrapperModule.CreateImageWrapper(GetJoyImageFormat(ImageFormat));
                 
                	//Load From File
                	TArray<uint8> RawFileData;
                	if (!FFileHelper::LoadFileToArray(RawFileData, * FullFilePath)) 
                	{
                		return NULL;
                	}
                	
                	  
                	//Create T2D!
                	if (ImageWrapper.IsValid() && ImageWrapper->SetCompressed(RawFileData.GetData(), RawFileData.Num()))
                	{ 
                		const TArray<uint8>* UncompressedBGRA = NULL;
                		if (ImageWrapper->GetRaw(ERGBFormat::BGRA, 8, UncompressedBGRA))
                		{
                			LoadedT2D = UTexture2D::CreateTransient(ImageWrapper->GetWidth(), ImageWrapper->GetHeight(), PF_B8G8R8A8);
                			
                			//Valid?
                			if (!LoadedT2D) 
                			{
                				return NULL;
                			}
                			
                			//Out!
                			Width = ImageWrapper->GetWidth();
                			Height = ImageWrapper->GetHeight();
                			 
                			//Copy!
                			void* TextureData = LoadedT2D->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
                			FMemory::Memcpy(TextureData, UncompressedBGRA->GetData(), UncompressedBGRA->Num());
                			LoadedT2D->PlatformData->Mips[0].BulkData.Unlock();
                
                			//Update!
                			LoadedT2D->UpdateResource();
                		}
                	}
                	 
                	// Success!
                	IsValid = true;
                	return LoadedT2D;
                }
                ~~~

                Download Link (6.5mb)

                UE4 Wiki, Plugin Download Page
                https://wiki.unrealengine.com/File:VictoryPlugin.zip



                Rama
                100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

                UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

                Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

                Comment


                  Click image for larger version

Name:	Paths.jpg
Views:	6
Size:	78.2 KB
ID:	1072220

                  Victory Absolute Paths!
                  Live as of March 3rd 2015 build

                  Get the File Path to your project .exe, your project root directory, and more!

                  These paths are dynamically updated even if you move the entire project to a new location on your computer!

                  All these nodes are fully compatible with packaged builds and return absolute paths!

                  These nodes also work in Development/Editor builds!

                  ~~~

                  More Power For You in BP

                  Now you can easily create your own folders/files, relative to the project root directory or your project's .exe!

                  Please note that in editor builds, the .exe returns your UE4Editor.exe location, but in packaged games it returns your game's .exe

                  Click image for larger version

Name:	Paths2.jpg
Views:	7
Size:	298.6 KB
ID:	1072221

                  ~~~

                  Recommendation:

                  I recommend using the Project Game directory for most of your relative path needs! This works the same in Editor and packaged builds!

                  You can also get your Saved and Logs folders for your project in both packaged and editor builds!

                  UE4 Wiki, Plugin Download Page
                  https://wiki.unrealengine.com/File:VictoryPlugin.zip



                  Rama
                  100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

                  UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

                  Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

                  Comment


                    From the Rama Q&A Desk

                    Originally posted by fireapache View Post
                    Hey Rama!

                    You're doing an amazing job here to the comunity, that's awesome!

                    ... I was trying your Victory Get Custom Config Var functionality but I looks like it's not working. It loads random numbers from the config file.

                    I'm using the Saved\Config\Windows\Game.ini file!

                    Is there anything wrong?

                    Thank you!
                    Hi there!

                    I just ran some tests with my Config nodes, and I did not have any issues reloading data properly from config file.

                    Are you sure that you spelled the section name and var name the same way in both places?

                    It can help to save the section name and var names as string variables so that you just plug them in, guaranteeing that they are the same

                    Please try that and if you still have issues let me or one of my assistants (points to the flying unicorns outside the window) know!

                    Have fun today!



                    Rama
                    100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

                    UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

                    Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

                    Comment


                      Rama, you've definitely been inspiring to us as we play with Unreal 4!

                      Comment


                        Originally posted by Rama View Post
                        Dear Community,

                        Community member SaxonRah has gifted us all with a whole new set of Randomization nodes!

                        Check out these pics!




                        ~~~

                        Latest Version of My Plugin Has The Additions

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

                        ~~~

                        C++ Code

                        Here is the C++ code for SaxonRah's additions to my Victory BP Library

                        .h
                        Code:
                        /** Seed Rand with value passed
                        * @param seed - value to pass to the prng as the seed
                        */
                        UFUNCTION(BlueprintCallable, Category = "VictoryBPLibrary|Random")
                        static void seedRand(int32 seed);
                        
                        /** Seed Rand with current time
                        */
                        UFUNCTION(BlueprintCallable, Category = "VictoryBPLibrary|Random")
                        static void seedRandWithTime();
                        
                        /** Seed Rand with entropy
                        * @param seed - value to pass to the prng as the seed
                        */
                        UFUNCTION(BlueprintCallable, Category = "VictoryBPLibrary|Random")
                        static void seedRandWithEntropy();
                        
                        /** Random Bool - Bernoulli distribution
                        * @param fBias - Bias of Bernoulli distribution
                        * @return uniformly distributed bool based on bias parameter
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static bool RandBool_Bernoulli(float fBias);
                        
                        /** Random Integer - Zero to One Uniform distribution
                        * @return int32 - uniform distribution from 0 to 1
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static int32 RandInt_uniDis();
                        
                        /** Random Integer - MIN to MAX Uniform distribution
                        * @param iMin - Minimum value of uniform distribution
                        * @param iMax - Maximum value of uniform distribution
                        * @return int32 - uniform distribution from iMin to iMax parameters
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static int32 RandInt_MINMAX_uniDis(int32 iMin, int32 iMax);
                        
                        /** Random Double - Zero to One Uniform distribution
                        * @return double - uniform distribution from 0 to 1
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static float RandFloat_uniDis();
                        
                        /** Random Double - Uniform distribution based on MIN to MAX parameters
                        * @param fMin - Minimum value of uniform distribution
                        * @param fMax - Maximum value of uniform distribution
                        * @return double - uniform distribution from fMin to fMax parameters
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static float RandFloat_MINMAX_uniDis(float fMin, float fMax);
                        
                        /** Random Bool - Bernoulli distribution - Mersenne Twister
                        * @param fBias - Bias of Bernoulli distribution
                        * @return uniformly distributed bool based on bias parameter
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static bool RandBool_Bernoulli_MT(float fBias);
                        
                        /** Random Integer - Zero to One Uniform distribution - Mersenne Twister
                        * @return int32 - uniform distribution from 0 to 1
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static int32 RandInt_uniDis_MT();
                        
                        /** Random Integer - MIN to MAX Uniform distribution - Mersenne Twister
                        * @param iMin - Minimum value of uniform distribution
                        * @param iMax - Maximum value of uniform distribution
                        * @return int32 - uniform distribution from iMin to iMax parameters
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static int32 RandInt_MINMAX_uniDis_MT(int32 iMin, int32 iMax);
                        
                        /** Random Float - Zero to One Uniform distribution -  Mersenne Twister
                        * @return float - uniform distribution from 0 to 1
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static float RandFloat_uniDis_MT();
                        
                        /** Random Float - Uniform distribution based on MIN to MAX parameters - Mersenne Twister
                        * @param fMin - Minimum value of uniform distribution
                        * @param fMax - Maximum value of uniform distribution
                        * @return float - uniform distribution from fMin to fMax parameters
                        */
                        UFUNCTION(BlueprintPure, Category = "VictoryBPLibrary|Random")
                        static float RandFloat_MINMAX_uniDis_MT(float fMin, float fMax);
                        .cpp
                        Code:
                        /**
                        * Contributed by: SaxonRah
                        * Better random numbers. Seeded with a random device. if the random device's entropy is 0; defaults to current time for seed.
                        * can override with seed functions;
                        */
                        //----------------------------------------------------------------------------------------------BeginRANDOM
                        std::random_device rd;        
                        unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
                        
                        
                        std::mt19937 rand_MT;
                        std::default_random_engine rand_DRE;
                        
                        
                        /** Construct a random device and set seed for engines dependent on entropy */
                        void UVictoryBPFunctionLibrary::constructRand()
                        {
                            seed = std::chrono::system_clock::now().time_since_epoch().count();
                        
                        
                            if (rd.entropy() == 0)
                            {
                                seedRand(seed);
                            }else{
                                seedRand(rd());
                            }
                        }
                        /** Set seed for Rand */
                        void UVictoryBPFunctionLibrary::seedRand(int32 _seed)
                        {
                            seed = _seed;
                        }
                        
                        
                        /** Set seed with time for Rand */
                        void UVictoryBPFunctionLibrary::seedRandWithTime()
                        {
                            seed = std::chrono::system_clock::now().time_since_epoch().count();
                        }
                        
                        
                        /** Set seed with entropy for Rand */
                        void UVictoryBPFunctionLibrary::seedRandWithEntropy()
                        {
                            seedRand(rd());
                        }
                        
                        
                        /** Random Bool - Bernoulli distribution */
                        bool UVictoryBPFunctionLibrary::RandBool_Bernoulli(float fBias)
                        {
                            std::bernoulli_distribution dis(fBias);
                            return dis(rand_DRE);
                        }
                        
                        
                        /** Random Integer - Uniform distribution */
                        int32 UVictoryBPFunctionLibrary::RandInt_uniDis()
                        {
                            std::uniform_int_distribution<int32> dis(0, 1);
                            return dis(rand_DRE);
                        }
                        /** Random Integer - Uniform distribution */
                        int32 UVictoryBPFunctionLibrary::RandInt_MINMAX_uniDis(int32 iMin, int32 iMax)
                        {
                            std::uniform_int_distribution<int32> dis(iMin, iMax);
                            return dis(rand_DRE);
                        }
                        
                        
                        /** Random Float - Zero to One Uniform distribution */
                        float UVictoryBPFunctionLibrary::RandFloat_uniDis()
                        {
                            std::uniform_real_distribution<float> dis(0, 1);
                            return dis(rand_DRE);
                        }
                        /** Random Float - MIN to MAX Uniform distribution */
                        float UVictoryBPFunctionLibrary::RandFloat_MINMAX_uniDis(float fMin, float fMax)
                        {
                            std::uniform_real_distribution<float> dis(fMin, fMax);
                            return dis(rand_DRE);
                        }
                        
                        
                        /** Random Bool - Bernoulli distribution  -  Mersenne Twister */
                        bool UVictoryBPFunctionLibrary::RandBool_Bernoulli_MT(float fBias)
                        {
                            std::bernoulli_distribution dis(fBias);
                            return dis(rand_MT);
                        }
                        
                        
                        /** Random Integer - Uniform distribution  -  Mersenne Twister */
                        int32 UVictoryBPFunctionLibrary::RandInt_uniDis_MT()
                        {
                            std::uniform_int_distribution<int32> dis(0, 1);
                            return dis(rand_MT);
                        }
                        /** Random Integer - Uniform distribution  -  Mersenne Twister */
                        int32 UVictoryBPFunctionLibrary::RandInt_MINMAX_uniDis_MT(int32 iMin, int32 iMax)
                        {
                            std::uniform_int_distribution<int32> dis(iMin, iMax);
                            return dis(rand_MT);
                        }
                        
                        
                        /** Random Float - Zero to One Uniform distribution  -  Mersenne Twister */
                        float UVictoryBPFunctionLibrary::RandFloat_uniDis_MT()
                        {
                            std::uniform_real_distribution<float> dis(0, 1);
                            return dis(rand_MT);
                        }
                        /** Random Float - MIN to MAX Uniform distribution  -  Mersenne Twister */
                        float UVictoryBPFunctionLibrary::RandFloat_MINMAX_uniDis_MT(float fMin, float fMax)
                        {
                            std::uniform_real_distribution<float> dis(fMin, fMax);
                            return dis(rand_MT);
                        }
                        I know it's not a riveting change but i notice i failed to use proper var names for the float variables. It should be all better now.
                        Youtube
                        Machine Learning C++ Plugin
                        Lindenmayer System C++ Plugin

                        Comment


                          Originally posted by ZenrokStudios View Post
                          Rama, you've definitely been inspiring to us as we play with Unreal 4!
                          Hee hee!

                          Play and fun are the goal!



                          Rama
                          100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

                          UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

                          Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

                          Comment


                            Rama Taking BP Node Requests

                            Does anyone have any BP node requests?

                            This should be simple utility stuff that could be applicable to many projects.

                            Functionality you'd eventually like to see added to the engine if possible.

                            Let me know!



                            Rama
                            100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

                            UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

                            Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

                            Comment


                              Originally posted by Rama View Post
                              Rama Taking BP Node Requests

                              Does anyone have any BP node requests?

                              This should be simple utility stuff that could be applicable to many projects.

                              Functionality you'd eventually like to see added to the engine if possible.

                              Let me know!



                              Rama
                              Hi Rama,

                              Is it possible to take the Pawn Sensing function under actors and make it where it can see 360 degrees around? Right now it seems to be locked at 90 degrees. I'm sure it makes sense for a human to not have peripheral vision going to the back of there head however maybe other creatures may have eyes on the back of there head.

                              Also,

                              Screen Brightness or Gamma. Not sure if this can be done already.
                              Last edited by Isaac Nichols; 04-11-2015, 01:58 AM.
                              Isaac Nichols
                              Game Developer & Music Producer - Threaded Pixel Studios
                              Currently working on Drones & Ruins a Sci-Fi twin-stick shooter.

                              Comment


                                How difficult would it be to add a node that can present 2d image data (aka textures) as an array of vector4s? I would imagine that functionality would be very useful for a lot of people. Just a thought. Cheers,

                                J^2

                                Comment

                                Working...
                                X