Sign in to follow this  

Use of Signals for card game

Recommended Posts

I'm currently working on my own Yu-Gi-Oh! Game (I know, there are a lot of people AND a big company working on it, but it's perfect practice for me) and I think of a "Send Signal"-System everytime a player summons a monster or activates a spell/trap card. Now the problem is how to generate such a signal handler:
[*]Shall I use a static class (all variables and methods are static) which tells each card what has been played/activated?
[*]Is <csignal> of any use for this?
[*]Shall I generate an instance of signal handler and send its reference to each Card (SignalHandler& sig_handler;)?
Would be happy for any advice from you. LG rumpfi88

Share this post

Link to post
Share on other sites
Those signals are generally used for interprocess communication. That is, if you want to send a message to another different process.

Many games will implement their own event listeners; this model is supported by most modern languages where you can register event listeners, and easily broadcast to all interested listeners.

A simple search for "games message event bus" gives a bunch of useful descriptions of how to implement them, many including source code.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this