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

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.

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).

Jinx! You owe me a Coke! :smiley:

haha zero or normal? :smiley:

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

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.