Download

Trying to dynamically spawn actors using data from remote file (CSV/XML/etc)

I’ll start off by saying I have no experience with UE, but I do have some experience with C++ (and a decent amount of coding experience in general). My coworker has some experience with UE, but very little coding experience. Since this problem seems to be a combination of UE’s GUI and coding, we’re stuck as we both lack understanding of the other side.

We are attempting to build a VR tour using photospheres. He’s been able to create the photospheres and apply the panoramas manually, but we have over 2500 panoramas (with more being added all the time), and doing them manually would be a nightmare (not to mention it would make the program take up a ridiculous amount of disk space). So we want to load the information from a remote server (he’s been able to load a panorama from a url, so far, but now we’re stuck).
This is the information we need to pull from the server and build the photosphere with:

The panorama (its starting rotation and the angle north).

The “hotspots” (links to other panoramas that include their angular position relative to the camera). I was thinking it would be best to spawn button actors for the hotspots, but I’m open to suggestions.

As a programmer, my thought is to build a photosphere class (not sure if that’s the right term for UE, but basically an actor template) and create an instance of said class when the user visits a photosphere. Assuming the hotspots will be actors, we would also need a class for them, and destroy/create them as we jump between panoramas.

The walls we’ve hit are how to:
Create custom actor templates from which actors can be instantiated

What format to use for the data. (I’m personally thinking XML because we have no set number of hotspots and they all have a pan, a tilt, and a destination attached to them. I think it would be tricky to send that over as a CSV and keep the comma-separated lists straight (making sure “pan1,pan2,pan3”,“tilt1,tilt2,tilt3”,“dest1,dest2,dest3” end up as 3 hotspots with the same information). We CAN do this, as we have before, but I’d like to keep this as simple as possible.

How to get that data into UE and spawn the actors?
Can anyone provide some resources like tutorials for us to look at? We’ve spent days looking through documentation and help forums and we just can’t get our foot in the door. We appreciate any help you can provide to get us started on the right track.

For the first part, I solved it by creating a generic-template UCLASS(abstract), which serves as an interface for actor templates. Then I instantiate the templates based on a CSV - they are like archetypes, e.g., Wall, Tower, Minion - which essentially hold the information for each actor-template, such as the Icon & Mesh locations, stats,etc. Then, I simply hold a pointer in each of my actor classes to the SAME archetype (search the forums for UPROPERTY instantiable or something like that, can’t quite remember and I don’t have VS here).

As for the data format, well XML is much better, agreed, but importing CSV in UE4 is rather easy, as they provide a nice, clean and pre-coded wrapper. There is a very simple XML reader as well.

Ue4 has allot of JSON functionality. Personally I’d recommend it over csv or xml, but that’s just me. JSON is used primarily to transmit data between a server and web application, as an alternative to XML. As JSON is much lighter-weight than xml.