x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Dynamic hexagonal tile based level creation (Unity background)

Hey everyone! I'm from Unity game engine background (3+ years of experience in unity engine) and I'm trying to learn Unreal engine. I want to create level dynamically after receiving/reading level information (2D array). The workflow in unity: I can create one Hexagon block and make it as a prefab. (I had to write script that generates the hexagon mesh and save it as asset since there is no direct way to create hexagon in unity.) This prefab can be assigned to a public variable in C# script and through script I can instantiate the prefab as GameObjects and place them where ever I want. Sample level from Unity game engine. This is how the sample level looks in Unity game engine. I want to know the work flow regarding the same in Unreal engine. As far as I read about Unreal Unity comparison, prefab in Unity engine is almost equal to blueprint in Unreal engine. But I made the hexagon block in unreal using BSP (which is really easy just one click and done). But there is no option to make this as blueprint. It is showing that this is already an actor and there is no option to make it into blue print. :( Unreal editor. Creating hexagon. I want to know how i can make a hexagon block that can be instantiated at runtime in C++. I am very new to unreal and tutorials (shows blueprints in middle) are confusing me. So I thought of learning Unreal but making a sample level instead of watching tutorials and getting confused.

Product Version: UE 4.10
Tags:
capture.png (364.2 kB)
capture 2.png (426.0 kB)
more ▼

asked May 01 '16 at 12:15 PM in Using UE4

avatar image

plato.manchi
82 11 12 22

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I managed to do create this and for anyone who just started Unreal and looking for answer.

Step 1: Create the BSP in any shape you want. I wanted a hexagon so I created a cylinder BSP with 6 sides and applied the texture to it. In details panel (click the small arrow button at end of the details panel), click "Create static mesh" and select folder where you want to save this asset. alt text

Step 2: Create a blueprint actor class. Click "Add new" button in content browser and select "Blueprint class" and select Actor and name this actor anything. Actor can be a visible object in level or invisible script only object on which only code runs. Double click the created actor in content browser, it will open the blueprint editor. On top right, click "Add component" and select static mesh.

alt text

Step 3: In details panel, select the static mesh that you saved in previous step.

alt text Actor is ready now its time to set up the function that can spawn this actor in the world at a particular position and return the AActor pointer.

Step 4: Create a C++ actor class and I called that "LevelCreator". Add a function like this to this LevelCreator class.

 UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "SpawnFloorBlock"), Category = "FloorBlock")
 AActor* SpawnFloorBlock(FVector pPosition);

Drag and drop the level creator into the world. This will be the kind of actor that has no visual element at all but only code based actor. Right click on the LevelCreator in the C++ class and select "Create blueprintclass based on LevelCreator" and name it as "LevelCreator_BP". this will create a blueprint actor with ALevelCreator class as its parent. Double click the LevelCreator_BP to open it in blueprint editor.

Step 5: Mouse over the function panel and "override" button will appear. Click on the override and select the function "SpawnFloorBlock". It opens up in new tab.

alt text

Now use the blueprint to spawn the actor at particular position and return the actor. alt text


You can use this function in both blueprints and C++.

 AActor *floorBlock = SpawnFloorBlock(FVector(0.0f, 0.0f, 0.0f));



more ▼

answered Jul 01 '16 at 09:59 AM

avatar image

plato.manchi
82 11 12 22

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question