Announcement

Collapse
No announcement yet.

Dungeon Architect

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

    Hi guys! started using DA on a small indie project with a few friends. Really impressed by it so far and looking forward to doing more projects with it.

    As far as custom selectors - we're really curious about trying to get some more variety on levels..

    I haven't messed with blueprint spawners much but somethings we are looking for would be things like:

    Corners - convex or concave corners.
    Cells that are not 1x1. So maybe being able to get room center and creating a cell that is a 2x2.
    Also something to mix the snapping system with the grid builder. Not sure how feasible it is - but it would be nice to use the grid system and randomly be able to pull in a level like the snap system as a volume. Not sure if that makes sense.

    Oh credit where it's due - project using DA of course, Fantasy Dungeon Kit, Skeleton Character Pack, and Gametextures.com
    Click image for larger version

Name:	ikPwjHK.jpg
Views:	1
Size:	588.3 KB
ID:	1116856
    Click image for larger version

Name:	Qwy40sV.jpg
Views:	1
Size:	429.1 KB
ID:	1116857
    Click image for larger version

Name:	UHs7jD7.jpg
Views:	1
Size:	700.6 KB
ID:	1116858

    Sorry no info page yet - just the KS https://www.kickstarter.com/projects...token=6f6eb4c9
    Last edited by arvinmoses; 10-18-2016, 01:03 PM.

    Comment


      Originally posted by Ali Akbar View Post
      Cedric, the emitter BP can see your variables from code. You need to add a reference to your C++ actor that drives this variable and read it from there

      Here's an example where from the BP, I'm grabbing the distance (random value between 1-6) from C++

      C++ code that drives the distance variable:
      AMyDungeonController.h
      Code:
      #pragma once
      #include "AMyDungeonController.generated.h"
      
      UCLASS(Blueprintable)
      class AMyDungeonController : public AActor
      {
      	GENERATED_BODY()
      
      public:
      
      	UFUNCTION(BlueprintCallable, BlueprintPure, Category = MyDungeonController)
      	int32 GetMountainDistance();
      
      };
      AMyDungeonController.cpp
      Code:
      #include "DA413X.h"	// pch
      #include "AMyDungeonController.h"
      
      int32 AMyDungeonController::GetMountainDistance()
      {
      	return FMath::RandRange(1, 6);
      }

      Add a variable in the emitter BP that takes a references to your controller code and make it public

      Grab the distance from your C++ code

      Finally, set the reference of your C++ code in the marker emitter when you register it in the Dungeon actor. (The assumption is that you have it somewhere placed in the level, which you probably do)

      Clicking build now randomly generates rocks that are 1-6 layers deep
      Hey Ali !

      Thanks for your answers !

      Problem 1 (instancing ultimate rock pack): as i said in a previous post, don't waste your time on this (unless you need to understand what happened), i solved it experimentally by modifying the collisions. I didn't understand anything but the problem is solved for me :-)

      Problem 2 (accessing c++ variable from BP): your assumption is the core of the problem :-)

      Unfortunately i spawn the dungeons at runtime so no, i don't have them placed in the level, it's the problem. I need a way to set the DungeonCppCode variable at runtime !

      If i had the hand on the code, i would probably declare a public (visibleanywhere, blueprintreadonly) pointer/ref to the ADungeon in the emitters and set it as "this" when adding the emitter to the dungeon.

      Your DungeonMarkerEmitter.h code would become something like:

      Code:
      class DUNGEONARCHITECTRUNTIME_API UDungeonMarkerEmitter : public UObject
      {
      	[...]
      
      	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Dungeon)
      	AActor* ParentDungeon;
      
      	[...]
      }
      And when adding the emitter in my dungeon class (inheriting from ADungeon), my own code would become:

      Code:
      // emitter
      FString StrEmptySpaceDAEmitter = "Class'/Game/DLCDaDungeons/EmptySpaceThemes/Rules/MarkerEmitter/BPM_EmptySpaceEmitter.BPM_EmptySpaceEmitter_C'";
      UClass* UClassEmitter = LoadObject<UClass>(NULL, *StrEmptySpaceDAEmitter);
      
      // create an object from this BP class
      UDungeonMarkerEmitter* DAEmptySpaceEmitter = NewObject<UDungeonMarkerEmitter>(this, UClassEmitter);
      
      // if ok, use it
      if (DAEmptySpaceEmitter)
      {
      	MarkerEmitters.Add(DAEmptySpaceEmitter);
      	DAEmptySpaceEmitter->ParentDungeon = this; // YEEHAAA !!!
      }
      That would be a way to expose the owner dungeon in the emitters BP, then i would just grab it, cast it to my own inheriting class and become king of the world.

      But i don't have the hand on your code^^ and maybe there is a simpler way to do this from BP without modifying the code (couldn't reach the owner ADungeon from the emitter BP though, hence the post here^^)

      Cheers
      Cedric

      Comment


        Originally posted by Ali Akbar View Post
        [MENTION=18451]RedSaturnSix[/MENTION] I'll add detailed video tutorials soon. In the mean time, the snap builder section in the user guide has info to get you started
        Thanks Ali!

        Comment


          Awesome plugin, really enjoying it so far.

          I'm having some problems using this in a multiplayer game. Simply adding it to the level doesn't seem to work, I suspect because it's generating the meshes at runtime and replication isn't being accounted for. I end up getting spammed with error messages when my client player hits a collision on the dungeon. I get "LogNetPackageMap:Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: PathName: HierarchicalInstancedStaticMeshComponent_1237, ObjOuter: NULL" spammed across my server log.

          Main question: What are we supposed to do to make replication work?

          Comment


            Originally posted by DrinkThisPotion View Post
            Hey fellow DA enthusiasts - does anyone want to share notes on what we've learned? I've gone through all the videos and done quite a bit of experimentation on my own. I have some learned some pretty neat tricks, but I'm also up against what seem to be some limitations. I plan to make some tutorial videos on some of the finer points I've learned. I'll share those here when I finish them.

            Has anyone gone advanced with building your own marker emitters? I built one to emit in the center of rooms which is working very well. However I'm very interested in going deeper as it seems the possibilities are powerful.

            Specifically, when getting the bounds of rooms and corridors, does anyone understand that model very well? I'd love to chat.

            If anyone's interested, here's a blueprint marker emitter I made for the center of the room. It is based on one of the DA author's demo emitters with few a very minor tweaks. [ATTACH=CONFIG]114150[/ATTACH]
            Hello,

            Great idea !

            It would be nice to share some useful emitters.

            So here's one.

            I have modified Ali's AdjacentCellEmitter to allow some walls (and wall separators) in the empty space:

            Click image for larger version

Name:	EmptySpaceNoWalls.jpg
Views:	1
Size:	112.8 KB
ID:	1116887Click image for larger version

Name:	EmptySpaceWalls.jpg
Views:	1
Size:	131.5 KB
ID:	1116888

            Here it is in action:



            The function i have added is a bit too long to simply share screenshots, so you can download the asset here.

            In case the link would die some day, i show the whole function screen by screen slowly at the end of the video, so you can remake it by pausing and copying the video.

            This emitter seems to work but it's not optimized nor complete (see video), so if anyone comes up with a more efficient or more complete way to do it, please don't forget to share :-)
            Cheers !
            Cedric

            Comment


              [QUOTE=Ali Akbar;611041][MENTION=834]demonseedgfx[/MENTION], [MENTION=26180]MiDri[/MENTION] suggestion is a nice workaround. Here's another approach that lets you rotate your dungeon at runtime by attaching all the dungeon objects to a root actor:
              1. Generate your dungeon
              2. Grab all your generated dungeon actors and attach them to some root actor (which you will rotate around the orbit)
              3. Rotate the root actor to rotate your dungeon


              Amazing Service there. That looks like the perfect setup. Thanks

              Comment


                [MENTION=14151]uced[/MENTION], You can access your blueprint variables from C++ (link)


                Alternatively, you can code up your marker emitter within C++ itself, if you don't want C++ to blueprint communications.

                You would derive from UDungeonMarkerEmitter

                MyDungeonEmitter.h
                Code:
                class UMyDungeonEmitter : public UDungeonMarkerEmitter
                {
                	GENERATED_BODY()
                public:
                     virtual void EmitMarkers_Implementation(UDungeonBuilder* Builder, UDungeonModel* Model, UDungeonConfig* Config, UDungeonQuery* Query) override;
                
                };

                MyDungeonEmitter.cpp
                Code:
                #include "DA413X.h"	// pch
                #include "MyDungeonEmitter.h"
                
                void UMyDungeonEmitter::EmitMarkers_Implementation(UDungeonBuilder* Builder, UDungeonModel* Model, UDungeonConfig* Config, UDungeonQuery* Query)
                {
                   // your logic here
                   // Emit markers like this
                   
                	FTransform transform;
                	Builder->EmitMarker("MyMarkerName", transform);
                }
                This way your code class is statically types and you can reference and set the variables of this class from your code while adding the emitter to the dungeon actor


                Code:
                // create an object from this BP class
                UMyDungeonEmitter* DAEmptySpaceEmitter = NewObject<UMyDungeonEmitter>(this);
                
                // if ok, use it
                if (DAEmptySpaceEmitter)
                {
                	MarkerEmitters.Add(DAEmptySpaceEmitter);
                	DAEmptySpaceEmitter->MyAttribute = MyValue; // directly reference and set anything you like here
                }
                Last edited by Ali Akbar; 10-19-2016, 10:45 AM. Reason: typo
                Dungeon Architect | Prefabricator

                Comment


                  Originally posted by DrinkThisPotion View Post
                  Is there documentation anywhere on the dungeon model and dungeon layout? A diagram showing how the XY grid works and how the rectangular bounds are formed and stored would be very helpful.
                  The cell locations start from the corner. They are saved in logical grid coordinates and later multiplied with the Grid Size (specified in the config) to get the world coordinates


                  Last edited by Ali Akbar; 10-19-2016, 11:20 AM. Reason: link
                  Dungeon Architect | Prefabricator

                  Comment


                    Originally posted by Ali Akbar View Post
                    The cell locations start from the corner. They are saved in logical grid coordinates and later multiplied with the Grid Size (specified in the config) to get the world coordinates


                    This is super helpful!!!! Thank you Ali!!!

                    Comment


                      Originally posted by uced View Post
                      Hello,

                      Great idea !

                      It would be nice to share some useful emitters.

                      So here's one.

                      I have modified Ali's AdjacentCellEmitter to allow some walls (and wall separators) in the empty space:

                      Here it is in action:



                      The function i have added is a bit too long to simply share screenshots, so you can download the asset here.

                      In case the link would die some day, i show the whole function screen by screen slowly at the end of the video, so you can remake it by pausing and copying the video.

                      This emitter seems to work but it's not optimized nor complete (see video), so if anyone comes up with a more efficient or more complete way to do it, please don't forget to share :-)
                      Cheers !
                      Cedric
                      Wow, thanks for sharing - this is really cool and useful. I have been using Ali's EmptySpace emitters and your emitters would appear to be a very useful addition for many theme types. Looks like you have built some really nice themes too!!

                      Comment


                        Originally posted by dave_sullivan View Post
                        Awesome plugin, really enjoying it so far.

                        I'm having some problems using this in a multiplayer game. Simply adding it to the level doesn't seem to work, I suspect because it's generating the meshes at runtime and replication isn't being accounted for. I end up getting spammed with error messages when my client player hits a collision on the dungeon. I get "LogNetPackageMap:Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: PathName: HierarchicalInstancedStaticMeshComponent_1237, ObjOuter: NULL" spammed across my server log.

                        Main question: What are we supposed to do to make replication work?
                        [MENTION=157536]dave_sullivan[/MENTION] You can create a DungeonEventListener blueprint and override the OnPostDungeonBuild event. In that event grab all the actors spawned in the dungeon and set the replicate parameter. I'll provide a BP example tomorrow.
                        Dungeon Architect | Prefabricator

                        Comment


                          Originally posted by uced View Post
                          Hello,

                          Great idea !

                          It would be nice to share some useful emitters.

                          So here's one.

                          I have modified Ali's AdjacentCellEmitter to allow some walls (and wall separators) in the empty space:

                          [ATTACH=CONFIG]114375[/ATTACH][ATTACH=CONFIG]114376[/ATTACH]

                          Here it is in action:



                          The function i have added is a bit too long to simply share screenshots, so you can download the asset here.

                          In case the link would die some day, i show the whole function screen by screen slowly at the end of the video, so you can remake it by pausing and copying the video.

                          This emitter seems to work but it's not optimized nor complete (see video), so if anyone comes up with a more efficient or more complete way to do it, please don't forget to share :-)
                          Cheers !
                          Cedric
                          Looking really nice Cedric. Thanks for sharing
                          Dungeon Architect | Prefabricator

                          Comment


                            Originally posted by Ali Akbar View Post
                            [MENTION=157536]dave_sullivan[/MENTION] You can create a DungeonEventListener blueprint and override the OnPostDungeonBuild event. In that event grab all the actors spawned in the dungeon and set the replicate parameter. I'll provide a BP example tomorrow.
                            I just replicate the seed and call the build dungeon function on the client OnRep seed. That way I don't have to replicate the individual actors.

                            Comment


                              Originally posted by Ali Akbar View Post
                              [MENTION=14151]uced[/MENTION], You can access your blueprint variables from C++ (link)


                              Alternatively, you can code up your marker emitter within C++ itself, if you don't want C++ to blueprint communications.

                              You would derive from UDungeonMarkerEmitter

                              MyDungeonEmitter.h
                              Code:
                              class UMyDungeonEmitter : public UDungeonMarkerEmitter
                              {
                              	GENERATED_BODY()
                              public:
                                   virtual void EmitMarkers_Implementation(UDungeonBuilder* Builder, UDungeonModel* Model, UDungeonConfig* Config, UDungeonQuery* Query) override;
                              
                              };

                              MyDungeonEmitter.cpp
                              Code:
                              #include "DA413X.h"	// pch
                              #include "MyDungeonEmitter.h"
                              
                              void UMyDungeonEmitter::EmitMarkers_Implementation(UDungeonBuilder* Builder, UDungeonModel* Model, UDungeonConfig* Config, UDungeonQuery* Query)
                              {
                                 // your logic here
                                 // Emit markers like this
                                 
                              	FTransform transform;
                              	Builder->EmitMarker("MyMarkerName", transform);
                              }
                              This way your code class is statically types and you can reference and set the variables of this class from your code while adding the emitter to the dungeon actor


                              Code:
                              // create an object from this BP class
                              UMyDungeonEmitter* DAEmptySpaceEmitter = NewObject<UMyDungeonEmitter>(this);
                              
                              // if ok, use it
                              if (DAEmptySpaceEmitter)
                              {
                              	MarkerEmitters.Add(DAEmptySpaceEmitter);
                              	DAEmptySpaceEmitter->MyAttribute = MyValue; // directly reference and set anything you like here
                              }
                              As always, a spot on answer, it works super well !

                              Thanks again for you patience and first class help :-)

                              Cedric

                              Click image for larger version

Name:	FillingDistance.jpg
Views:	1
Size:	279.2 KB
ID:	1116904

                              Comment


                                Originally posted by DrinkThisPotion View Post
                                Wow, thanks for sharing - this is really cool and useful. I have been using Ali's EmptySpace emitters and your emitters would appear to be a very useful addition for many theme types. Looks like you have built some really nice themes too!!
                                Thanks^^

                                I corrected a bug i found in my function.

                                I was emitting many times (as much as the distance covered ! Ouch !!) the same walls. I couldn't see it while walls were 90° oriented (as they covered each other perfectly) but the horrible truth appeared when setting a random orientation !

                                So i added an array of vectors to check if anything has already been emitted at a location.

                                The array is cleared in the event graph and here is the correction in the function:

                                Click image for larger version

Name:	EmptySpaceWallsEmitterCorrection.jpg
Views:	1
Size:	194.7 KB
ID:	1116911

                                The corrected asset has been reuploaded :-)

                                Cheers
                                Cedric

                                Comment

                                Working...
                                X