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"

How do I avoid creating hundreds of references in the level blueprint to the same type of object in the scene each with its own stats/states?

Hello everyone,

What you see below is a Go Board that is a blueprint, the white circles are sphere colliders called Go Points and they are another blueprint. I'll have another blueprint for the stones the player uses.

The problem I am having is that I need each Go Point to call a function in the level blueprint that will act as the game manager but how do I do that without creating 361 references in the level blueprint?

The game manager will control whose turn it is, valid & illegal moves, scoring, etc. I already know how to create a reference to the Go Points in the scene in the level blueprint, however I do not want to create 361 references to each Go Point. That would seem like sloppy design.

My question to the community is:

  1. Is there perhaps another way to handle game management for scoring, valid & illegal moves, and such? Am I going about this the wrong way?

  2. How do I avoid creating so many references to objects in the scene to be used in the level blueprint?

I'd prefer just one reference to all individual Go Points instead of hundreds. I thought of making all Go Points a single blueprint but I would need each Go Point to have its own state. If it's not possible to have a single blueprint with individual objects that have their own states I'll need another possible solution.

Dear reader, can you shine some light on this problem?

Thank you, Sfoxx28

alt text

Product Version: UE 4.18
Tags:
more ▼

asked Dec 23 '17 at 01:28 AM in Blueprint Scripting

avatar image

Sfoxx28
5 1 4

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

If you manage it all correctly, that many references is fine. I'd have a 'board' actor. I'd reference it thru the game mode. I haven't worked much with level blueprints yet but I think the game will be more flexible if you use the game mode as the 'global' object. So the board actor has a list of all the squares. For the square actors, on BeginPlay, get the game mode, cast it, and save the board to a local reference. If you really need to save the memory then make a function that gets the game mode, casts it, and returns the board reference.

more ▼

answered Dec 23 '17 at 01:51 AM

avatar image

Jin_VE
4.3k 31 77 40

avatar image Sfoxx28 Dec 24 '17 at 12:23 AM

Thanks again Jin, this helped me get on the right track! I'm now using the Game Mode in my scene.

avatar image Jin_VE Dec 24 '17 at 06:00 AM

I'm glad. I should warn you tho: if you get into online multiplayer then there are complications, one of which is the fact that the game mode only exists on the server. Keeping data synced up and calling functions across the network are a bit more involved. But it all works out once you understand it.

(comments are locked)
10|2000 characters needed characters left

Hey there, you could create your own GameMode class for that, and it's always acessible by any actor (you just need to cast to your custom Game Mode class to be able to access to the custom functionality).

more ▼

answered Dec 23 '17 at 01:47 AM

avatar image

xlar8or
5.9k 157 127 302

avatar image Jin_VE Dec 23 '17 at 01:52 AM

Jinx! You owe me a Coke! :D

avatar image xlar8or Dec 23 '17 at 11:03 AM

haha zero or normal? :D

(comments are locked)
10|2000 characters needed characters left
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