CCG Toolkit | Multiplayer Card Game Framework

Hey! So I’m messing around with the toolkit and I wanted to ask, if I wanted begin a match with a specific card already in play for both players how should I go about doing that?

Hey 3DKP!

The Game Mode would be the best place to do any initial board/ player setup. You can check out some of the card spawning abilities, such as the Clone Card ability as an example of how to go about spawning and having a card played on the board by the game.

Setup a custom function in the game mode which loops through each player, and runs something similar to below:

Thanks for the reply! I will start there. I also just want to also say thanks for creating such an awesome toolkit!

Hey,

I have been doing lots of multiplayer testing recently and I’m running into some issues. I do most of the testing on the same PC. As you can see from this screenshot, the client is referred to as -2, which seems pretty wrong to me. Also, the Player ID is coming up really high too.

Any ideas where these errors might have come from?

Wow, thats something ive never seen before. Does this issue occur on a standalone built version of your game?

The “Client/Server #” string is added by the engine when using multiply clients on the single PC, so if that is being weird there could be other inconsistencies.

Something to keep in mind is that the Player ID and Card Game Player ID are used differently. The Card Game Player ID should display like you would expect (Player 1, 2, etc), but for the Player ID this more the “instance” which has been created in the current editor(?) session. If in one game you have Player ID (like a Player State ID) 333, the next session you could see 334 and so on. If the Card Game Player ID is showing large numbers like that then your game mode may be creating more player instances then it should (Card Game Player ID is set based on the number of players entering the game), if so this is a whole other issue.

I believe some of those issues were the result of incorrect printing/debugging on my part.

I think the main problem I’m seing now is that I’m unable to get the correct CardGamePlayerState/CardGameMode references in my Widget. I’m trying to modify the Mana Bar, and I try to set the CardGamePlayerState/CardGameMode within the Widget so I can use it to manipulate the Mana Bar. I am able to get the PlayerState, but when I try to get the GameMode reference (by getting from the PlayerState), it always returns empty.

/// EDIT \\

Sorry, I realise that I’m an idiot, and the GameMode is not replicated to a client. I’m resolving it now. I now realise that I didn’t put the variables I required in the correct place. I should’ve been putting them in the CardGamePlayerState, since I needed for both players to access their own individual copies. Once I moved my variables to that blueprint and moved some other stuff around it all worked.

Hello.

How would I go about making an ability that transforms a card on board into another one?
I’m looking for something that can swap the card info without generating a whole new card, and I want it to update visuals so I can see the new card upon ability activation. I tried with the graph in the picture but the game just freezes when the ability runs. Ability String is the name of the row of the cardset data table of the card that i want to transform into, that part is already tested and working, the function ServerSetCardData is what’s making the thing freeze. Any idea? I tried using Set Card Data Struct on the Calling Card too but with no result at all.

Thank you very much for your time.

Hey there, I was wondering if it was possible to have a placement similar to hearthstone? where if you have say 2 cards on the board, you can hover between the 2 and they will move so that it can be placed there. Right now I found the configuration to have them start from middle and grow, but they keep being placed to the far right.

Thanks!

Hey ScarfaceTheDuke,

Ive played around with this to see what issue you would be hitting but I cant seem to get the freeze to occur. I did however get the card to change with a similar setup to yours (I just specified a card name instead) and it works but only in some regards. There are expected bugs when clearing old data, such as adding abilities to the existing but these can be fixed by clearing the data before adding the new.

If the game freezes then there would likely be some logs telling you why, a common one that can occur is an infinite loop. If not it would be useful to see where its stalling exactly, so throwing some prints into the ServerSetCardData function to see where its hitching would give a better indication for whats going on. Whats the current trigger for the ability? could the trigger be activated infinitely with the change?

Hey Nodixal,

This is possible but it does not come as a default setting.

In the card placement blueprint, you will need to setup an “insert card” event which takes in an index/card for where you want to place it. You can get the index by getting the card your hovering on top of when placing the card on the board, and passing that through.


[CENTER](Card Placement Blueprint)

****EDIT: **Forgot to mention the Insert Card event should be a serverside event. (Run On Server) Took the screenshot before adding this (whoops)
[/CENTER]

The tricky part here is passing through the card or index reference to the server to it knows where the card should be placed. By Default this is simply the card placement, but you will need to also pass through the card/index (if valid) to the “Add Card to Board” function when its called in the “Play Card” function in the server player controller.

[CENTER](Player Controller - Event graph)


(Player Controller - Server_PlayCard Event)


(Player Controller - Play Card Function)

(Player Controller - Event graph)
[/CENTER]

Its quite messy, but I hope it gets the idea across. I will note, that this wont animate the card positions on hover, this will only place the card between other cards on drop.

This should get the ball rolling, hope this helps.

Proto, could u give me a couple of nodes layed out to grab the CardGamePlayer whose turn is active. Trying to play different animations based on which player is active. Playing animations when either player is playing a card or has an active ability I’ve done, but getting which player is active at any specific time isn’t working for me.

Hey Canthitcrap, The card game player controller has a replicated “TurnActive” bool which you can use for whether or not the players turn is currently active. This is set via the Player turn array (Index 0 is always the active player) in the game state at the end of each turn if you are looking for another way to get the currently active player.

TurnActive.JPG

Awesome Proto, it works! Amazing support so far :).

Hello going off this question i have added the script for steam it is showing that steam is activated but when you search for a session you do not find anything even with lan unchecked.

Hey Kingkadin,

I believe I have also recently received an email and on the store page. You should have a reply in your inbox.

Hey. Quick question about the Deckbuilder. I’ve created a function in “ViewCard_Default” Blueprint which hides a number of the Widget elements (Attack / Health Overlays, as well as some of the text elements). I trigger this function in the Event graph after the “Event_Initiate Card” and “Set Card Data” function. It works correctly in game, all the elements are hidden correctly. However when I open the Deck builder none of these elements are hidden.

Is there another method I need to use?
Cheers.

So the deck builder calls and updates each of the “Library Cards”, then each library card directly calls the “Set Card Data” function in the viewcard widget.

You have two options:

  • Move the your new function call to be inside the “Set Card Data” function
  • Modify the library card to call “Event_InitiateCard” instead of “Set Card Data”

Both should fix the issue you were seeing in no time at all.

Thanks, I added the hiding logic to the “Set Card Data” function in the “ViewCard_Default” blueprint. It was being called all over the place so it made sense to add it there.

Thanks for your help as always.

hello . can i use this kit with out knowledge of programming?

Hey zrengo,

You can definitely begin using the toolkit without much programming knowledge, but some general UE4 experience will definitely help you get started. You would have access to all the blueprint code out of the box for you to break apart, customize, and learn from, plus the usual documentation and support channels to help with any questions along the way.

Hope this helps