How would I make a Single Player server's options carry over into other widgets?

Hi! I don’t know if this was answered already elsewhere. So if it is, just let me know.

I’ve been making decent progress on my FPS project so far, but I’ve hit a snag. I’ve made a Single Player menu screen containing several check boxes for what factions I want to be available in the match. What I am stumped on is I don’t know how to make it so the check boxes being checked/unchecked in the SinglePlayerMenu widget causes the respective faction choice buttons to be pressable in the Faction_Selection widget (not a child of SinglePlayerMenu). Screencaps of how to do this would help immensely.

Also if possible I would ideally like to make it so a minimum of two factions are selectable, and the ability to make factions so they can be assigned teams. If this isn’t possible, it’s not the end of the world.


1 Like

If you didn’t use data tables for the creation of the widgets on the singleplayer and faction selection screens, I highly recommend it. They are absolutely game changing for stuff like this. Remember the DRY principle when coding.

The quick and dirty is to store the selected options on single player menu in the start match button using a blueprint interface. In faction selection create variables for each of the factions and set them to public and expose them on spawn, now when you create the widget from start match you can plug those values straight in.

I would rather use the game instance to store the variable information, here’s a resource https://www.youtube.com/watch?v=HpLeyIszAUU

If you didn’t use data tables for the creation of the widgets on the singleplayer and faction selection screens, I highly recommend it. They are absolutely game changing for stuff like this. Remember the DRY principle when coding.

I’ll confess, I didn’t know how to do that. I’ve been messing around with UE4 for about 4 years now, but really don’t know the ins and outs too well, so sometimes I need advice. Which row structure would be best for this context? It seems there aren’t many people out there who tried to do what I’m doing.

The quick and dirty is to store the selected options on single player menu in the start match button using a blueprint interface. In faction selection create variables for each of the factions and set them to public and expose them on spawn, now when you create the widget from start match you can plug those values straight in.

If there’s a right way to do this, I’ll go with whatever that is to try and avoid starting costly bad habits.

I would rather use the game instance to store the variable information, here’s a resource https://www.youtube.com/watch?v=HpLeyIszAUU

I watched the video and put in the variables from your second image but in the Game Instance instead of the SinglePlayerFaction widget. Would creating the correct Data Table make it so the faction relevant variables carry over?

1 Like

Make sure you set the game instance you create as active in the project :slight_smile:

Moving the selected variables is done separately from data tables to be clear, I just bring it up because it will make you a 10x better programmer and save you SO much headache in the future. The past 2 years for me, programming is 100% DRY DRY DRY. 99.99% of the time you repeat yourself there is a better method. It would also allow you to design your menu’s much much much faster. For example, after you’ve created a data table you place the same widget as many times as you want (up to 100 without modification I believe) then select the row from the data table to create the widget with that information. (as in the video below)

Data tables are generated from data structures. The structure defines the row structure the data table will use. Here you can store a color, a name, an integer, and a world reference together. I made this example to show you the versatility of the data structure. In one grouping of information, you can store information to create a widget, set the spawn location of a player using that faction, define the color of a widget, store the text displayed on a widget (name), and store an integer that could reference a grouping of allowed unit types for the player to select from.

This is an excellent video that demonstrates how to break data structures and access variables from them.

Also use this resource to help in storing the variables in the game instance. Make sure to use the (pure) get game instance function when you need a reference to send the BPI message :slight_smile:

https://www.youtube.com/watch?v=wGmlKbllPcw

1 Like

Sorry for the late reply, was following the video as it helped me a lot making my class selection widget. Except instead of copying what the guy on YouTube did, I made it so there are buttons you press and the widget on the right contains a preview image and a description of each class. When hovering over the buttons, the image and text appears and disappears when the mouse ceases to hover over the button.


And thank you for being kind and patient with me so far! (Reddit users should give that a try) I truly appreciate it even if sometimes I don’t vocalize it. I feel like I’ve almost got the hang of this engine, but it’s the little individual roadblocks of not knowing how to do very specific things that hold me back from completing a game I want.

But for making factions that would essentially be a collection of classes or tags am I doing it correctly so far?



Yes everything looks good to me so far :slight_smile:

I usually cram everything I need into one data table so I only have to pass one around, but I don’t hate splitting it up. It’s not what I would do, but I think it’s perfectly valid.

I’m not super familiar with tags, what I do in ue5 doesn’t involve them ever but from what I do know, looks good!

TBH I don’t really know what I’m doing as far as the data tables and structures go. I don’t know if it’s possible to put all the classes and factions in one data table, or whether or not that’s the correct way to go. Without knowing quite how to implement factions without a clear guideline, I’m kind of doing it trial and error attempting to apply what I know about making character classes and hoping that knowlegde carries over. :man_shrugging:t3:

1 Like