Announcement

Collapse
No announcement yet.

Dungeon Architect

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

    Originally posted by Ali Akbar View Post
    Thank you [MENTION=22103]MSTF[/MENTION]. That is very useful. This works during runtime, however the editor gives errors since we change the package names as a workaround in that thread. So I've made two implementations, one for the editor and another for the runtime. If it is a runtime only build (e.g. standalone game) it would use the implementation mentioned in the thread. If we are in the editor, I use the editor services to clone the level files and map them to the world composition so we don't get any warnings in the editor

    This way it solves the problem in both editor and non-editor builds

    Here's the code, if anyone is interested on getting something like this done

    So I think you are saying this fixes the bug of having things get hung up and not allowing save. So in this dual case thing does that mean things like vegetation are only going to work in the editor? Also Where do things stand on Baked lighting and Vertex Painting blended materials? Will there be a binary build of this available on the site soon?
    Last edited by calmasacow; 09-25-2016, 02:35 PM.
    James Brad Barnette
    Senior Creative Artist
    3Dmotif LLC

    Comment


      Everything works, foliage, lights vertex paint etc. I'll have an update In 1 or 2 days. It also fixes the save bug
      Dungeon Architect | Prefabricator

      Discord Support

      Comment


        Click image for larger version

Name:	6905e83b89075fa9921400440e448d95.jpg
Views:	1
Size:	58.6 KB
ID:	1115877

        Thank you soooo much!
        James Brad Barnette
        Senior Creative Artist
        3Dmotif LLC

        Comment


          Hi,

          Sorry for the very long post, i hope it can be a starting point for anyone interested in using DA with c++ :-)

          My code seems to be working so here is how it looks like:


          And here's how it's done.

          First i had to tell my project there is a new plugin in town:
          Code:
          Build.cs:
          PublicDependencyModuleNames.AddRange(new string[] { "DungeonArchitectRuntime" });
          PublicIncludePaths.AddRange(new string[] { "DungeonArchitectRuntime/Public", "DungeonArchitectRuntime/Classes" });
          Then i created a class inheriting from ADungeon in which i included all the DA headers i needed.
          I also created a structure containing all the variables i want to expose, because a structure is easily replicated and saved/reloaded.

          Code:
          DADungeon.h:
          #include "DungeonThemeAsset.h"
          #include "Builders/Grid/GridDungeonBuilder.h"
          #include "Builders/Grid/GridDungeonConfig.h"
          #include "Builders/FloorPlan/FloorPlanBuilder.h"
          #include "Builders/FloorPlan/FloorPlanConfig.h"
          #include "Core/Utils/DungeonModelHelper.h"
          
          
          // Actor gameplay properties
          USTRUCT()
          struct FDAFdD{};
          
          class YAG_API ADADungeon : public ADungeon
          {
          	[...]
          	UPROPERTY(ReplicatedUsing = OnRep_FdD)
          		FDAFdD FdD;
          	UFUNCTION()
          		void OnRep_FdD();
          	[...]
          };
          I had to set its root component to movable to be able to teleport the dungeons in game:

          Code:
          ADungeon.cpp:
          ADADungeon::ADADungeon(const FObjectInitializer& ObjectInitializer)
          	: Super(ObjectInitializer)
          {
          	[...]
          	GetRootComponent()->SetMobility(EComponentMobility::Movable);
          	[...]
          }
          Don't forget to replicate the structure:
          Code:
          void ADADungeon::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
          {
          	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
          	DOREPLIFETIME(ADADungeon, FdD);
          	[...]
          }
          The core of the class is the RebuildDungeon method in which i use the code provided by Ali.
          I put it entirely here:
          Code:
          void ADADungeon::RebuildDungeon()
          {
          	// Grab a reference to the theme asset and register it with the dungeon actor
          	FString StrDATheme = "/Game/DLCDaDungeons/Themes/" + FdD.DAThemeName / FdD.DAThemeName;
          	UDungeonThemeAsset* DATheme = Cast<UDungeonThemeAsset>(StaticLoadObject(UDungeonThemeAsset::StaticClass(), nullptr, *StrDATheme));
          	if (!DATheme) return;
          
          	// set the new theme
          	Themes.Empty();
          	Themes.Add(DATheme);
          
          	// Set the builder type
          	if (FdD.DADungeonTypeEnum == DADungeonEnum::DADUNGEON_GRID)
          	{
          		BuilderClass = UGridDungeonBuilder::StaticClass();
          		CreateBuilderInstance();
          
          		// Set the dungeon configuration
          		UGridDungeonConfig* GridConfig = Cast<UGridDungeonConfig>(GetConfig());
          		if (GridConfig) {
          			GridConfig->Seed = FdD.Seed;
          			GridConfig->Instanced = true;
          			GridConfig->NumCells = FdD.NumCells;
          			GridConfig->MinCellSize = FdD.MinCellSize;
          			GridConfig->MaxCellSize = FdD.MaxCellSize;
          			GridConfig->SpanningTreeLoopProbability = FdD.SpanningTreeLoopProbability;
          			GridConfig->HeightVariationProbability = FdD.HeightVariationProbability;
          			GridConfig->MaxAllowedStairHeight = FdD.MaxAllowedStairHeight;
          		}
          	}
          
          	if (FdD.DADungeonTypeEnum == DADungeonEnum::DADUNGEON_FLOOR)
          	{
          		BuilderClass = UFloorPlanBuilder::StaticClass();
          		CreateBuilderInstance();
          
          		// Set the dungeon configuration
          		UFloorPlanConfig* PlanConfig = Cast<UFloorPlanConfig>(GetConfig());
          		if (PlanConfig) {
          			PlanConfig->Seed = FdD.Seed;
          			PlanConfig->Instanced = true;
          			PlanConfig->BuildingSize = FdD.BuildingSize;
          			PlanConfig->MinRoomSize = FdD.MinRoomSize;
          			PlanConfig->MaxRoomSize = FdD.MaxRoomSize;
          			PlanConfig->HallWidth = FdD.HallWidth;
          			PlanConfig->MinRoomChunkArea = FdD.MinRoomChunkArea;
          		}
          	}
          
          	// build the dungeon
          	BuildDungeon();
          }
          This function is called whenever the FdD structure is changed, through the OnRep function:
          Code:
          void ADADungeon::OnRep_FdD()
          {
          	[...]
          	RebuildDungeon();
          	[...]
          }
          The dungeon is spawned by the player controller in a server function:
          Code:
          void AyagPlayerController::ServerSpawnDADungeon_Implementation(const FString& NewDAThemeName)
          {
          	// player location
          	AYagPlayer* YagDefaultPawn = Cast<AYagPlayer>(DefaultPawn);
          	if (!YagDefaultPawn) return;
          
          	// spawning location
          	// ground altitude relative to the player: -1/2 capsule
          	float DeltaZToGround = -DefaultPawn->GetCapsuleComponent()->GetScaledCapsuleHalfHeight();
          	FVector DADungeonLocation = DefaultPawn->GetActorLocation() + FVector(0.f, 0.f, DeltaZToGround) + 500.f * GetActorForwardVector();
          
          	// rotation
          	FRotator DADungeonRotation = FRotator(0.f, 0.f, 0.f);
          
          	// spawn DADungeon
          	FActorSpawnParameters SpawnDADungeonParams;
          
          	ADADungeon* SpawnedDADungeon = GetWorld()->SpawnActor<ADADungeon>(ADADungeon::StaticClass(), DADungeonLocation, DADungeonRotation, SpawnDADungeonParams);
          	if (!SpawnedDADungeon) return;
          
          	// game state
          	AYagGameState* MyGameState = Cast<AYagGameState>(GetWorld()->GameState);
          	if (!MyGameState) return;
          
          	// set DADungeon type
          	FDAFdD NewFdD;
          	NewFdD.DAName = Display(TextEnum::DUNGEON) + " " + FString::FromInt(MyGameState->DADungeonArray.Num() + 1);
          	NewFdD.Seed = DungeonRandStream.GetUnsignedInt();
          	NewFdD.DAThemeName = "Default";
          
          	// This is the server function which replicates the FdD structure and triggers the call of the OnRep function on every clients
          	SpawnedDADungeon->SetFdD(NewFdD);
          
          	// add in DADungeon array
          	MyGameState->DADungeonArray.Add(SpawnedDADungeon);
          	[...]
          }
          Destroying is done by calling the ADungeon:estroyDungeon() method and then destroying the dungeon actor.

          Saving and reloading are made through the FdD structure, nothing fancy.
          When reloading, i just read the FdD, then spawn a new dungeon and assign the FdD to it.

          Hope this helps !
          Cheers
          Cedric
          Last edited by uced; 09-26-2016, 01:01 AM.

          Comment


            Originally posted by uced View Post
            Hi,

            Sorry for the very long post, i hope i can be a starting point for anyone interested in using DA with c++ :-)

            My code seems to be working so here is how it looks like:


            And here's how it's done.
            Cedric, your game is looking awesome. I really like what you did with it and thank you for posting the code
            Last edited by Ali Akbar; 09-26-2016, 12:23 AM. Reason: typo
            Dungeon Architect | Prefabricator

            Discord Support

            Comment


              A quick update on the marketplace integration for website customers, I waited for a few days for people to respond (about 45% have responded) and sent the list to Epic last week (on 20th). I'll let you know if I hear from them
              Dungeon Architect | Prefabricator

              Discord Support

              Comment


                Originally posted by Ali Akbar View Post
                Cedric, your game is looking awesome. I really like what you did with it and thank you for posting the code
                Thanks a lot Ali

                Comment


                  Version 2.1.11-beta.1
                  * Snap builder now uses world composition to build the scene. This retains all the other engine features in the modules like lightmaps, foliage, level blueprint scripts etc
                  Dungeon Architect | Prefabricator

                  Discord Support

                  Comment


                    Originally posted by Bioblaze View Post
                    Can you throw me a Example, I think i`m Doing something wrong @.@ Everything I`ve Tried, that should work for allocation of information/Actors/Meshes in the Route arent working -_-
                    [MENTION=43786]Bioblaze[/MENTION], I've have a sample soon
                    Dungeon Architect | Prefabricator

                    Discord Support

                    Comment


                      [MENTION=28980]Ali Akbar[/MENTION] Is there any way to tell the Isaac Builder to:

                      1. spawn a certain marker only once per room? (I think a selection logic would be applied, but how do I tell the engine to select only the middle cell, if my rooms are 3x3 cells?)
                      I tried also creating a new Marker Emitter live I've seen in this picture on the documentation page: http://coderespawn.github.io/dungeon...tter_eg1_1.png
                      But when I drag off the model pin, it does not return "break dungeonmodel" node. (pin color is blue, not darkblue like in your picture)

                      2. spawn a marker with 100% probability only just once per seed?

                      PS.: For the Isaac Builder, there is literally no documentation
                      Last edited by SethPDA; 09-26-2016, 01:51 PM.

                      Comment


                        Originally posted by Ali Akbar View Post
                        Version 2.1.11-beta.1
                        * Snap builder now uses world composition to build the scene. This retains all the other engine features in the modules like lightmaps, foliage, level blueprint scripts etc
                        Ok this seems to work with the exception being that you can't seem to do it with Source control active. on a non source control project it works as best as I cant tell but when you build in a project under source control. "PERFORCE 4 here" as it is building the editor starts trying to add a ton of files to the source control and then crashes. Not sure if there is a way to flag these as cache so this doesn't happen or if it has to do with the way it seem that now all of the temp files get written to a folder in the same folder as the map. Anyway it overwhelms the system and it crashes the editor every-time with source control on.

                        Is there a way to make it toss that stuff in the "Intermediate" folder or something so it isnt under the source monitored folders? or a way to flag it I guess either way

                        The only real "BUG I have noticed is in the world outliner all of the objects are getting thrown int he root of it instead of in the dungeon items folder. This makes it a nightmare to navigate.


                        Back to testing
                        James Brad Barnette
                        Senior Creative Artist
                        3Dmotif LLC

                        Comment


                          [MENTION=28980]Ali Akbar[/MENTION] Really nice plugin, exactly what I needed. I got 2.1.10 installed on 4.13(OSX), here are some questions:

                          1. When you have 2 or more dungeon actors on a level and use the paint mode, how do I choose which dungeon I'm painting on? I noticed in the videos and docs you have a dropdown to choose where to paint, I don't have such option in my editor, just the brush size and floor index.

                          2. How do I paint a room? No matter how large I paint an area it always paints corridors. Can this only be done using the platform volume? Using the platform volume method doesn't create door openings on rooms when manually paining from it, only creates door openings when procedural generated dungeon parts connect to it, If I set my number of cells to 0 and do all the creation manually I never get doors.

                          3. Is it possible to use snap doors in custom made dungeon pieces and fill the gaps with procedural generation? Say I create an intro section and a boss room in Maya, can I place them in the level and use snap doors to generate a grid based dungeon that connects the two?

                          4. Is there a roadmap for planned features?

                          Feature request:

                          Have a way to change generated marker types manually.

                          Here are some sample scenarios:

                          a. Generated dungeon is perfect, but some stairs are not desired, be able to remove those stairs and have the change persist when I regenerate the dungeon like it does when I manually add/remove cells. Basically change the stair marker for a ground marker in a case by case basis.

                          b. Be able to expand or remove door openings on a case by case basis. Basically change a door marker for a wall marker or vice versa.

                          I'm aware that I can modify the generated dungeon and remove actors and parts as a please, but when I regenerate the dungeon or manually paint anywhere those edits are lost. Say I create a dungeon graybox using basic shapes and materials much like you do in your tutorial, I edit and tweak for function, remove some stairs, make some door openings wider, etc, then I apply the template that has the final look, all my changes and edits should persist.
                          Last edited by Ratamorph; 09-29-2016, 01:00 PM.

                          Comment


                            Originally posted by Ali Akbar View Post
                            Version 2.1.11-beta.1
                            * Snap builder now uses world composition to build the scene. This retains all the other engine features in the modules like lightmaps, foliage, level blueprint scripts etc
                            Compactly crashes on build EVERY time now. even cleared the dungeon and built a new one in a blank map with only a couple rooms and a connector. crashed. tried turning all of the setting like total rooms to 10 and safety limit to 50 and still crashed.
                            James Brad Barnette
                            Senior Creative Artist
                            3Dmotif LLC

                            Comment


                              Had to roll back to 2.1.10 So it still has the saving but. so what is the properway to trigger the snap builder int he level blue print I would assume..

                              Tried This:Click image for larger version

Name:	bug_132.jpg
Views:	1
Size:	328.4 KB
ID:	1116020


                              it doesnt seem to work.
                              James Brad Barnette
                              Senior Creative Artist
                              3Dmotif LLC

                              Comment


                                Originally posted by James Barnette View Post
                                Had to roll back to 2.1.10 So it still has the saving but. so what is the properway to trigger the snap builder int he level blue print I would assume..
                                it doesnt seem to work.
                                This is how I do it:
                                Click image for larger version

Name:	dungeon1.png
Views:	1
Size:	412.2 KB
ID:	1116039

                                Comment

                                Working...
                                X