Don't slowdown game when clicking card and always show CAST button

Hi guys,

I love that you can click your and the enemy cards at any time now.
But when you click one of your own cards, to cast, and click it to early, there is no cast button.
This is because you can’t cast yet, but the button also doesn’t appear when you are able to use it.
Solution: Always show the cast button with your own cards, and just have it disabled while you can’t use it and then enable it as soon as you can use it.

Also, don’t slowdown the game in the background while a card is being shown.

If the above two are to much work, I’d like an option to disable showing cards while the game is not “idle” (aka, it’s not your turn). That way I won’t be able to click the card to early, and slowdown my whole game in the process.
But I prefer the actual fix above this :slight_smile:

Many thanks in advance.

3 Likes

While the cast button sounds like an easy fix, from a code perspective that isn’t always the case. Let me 'splain…

Imagine 3 things: The Engine (which handles what happens), the UI (which handles normal game display), and the Card (which draws the troop card on screen and with/without cast button). When you click a troop during opponent turn the UI asks Engine “Can this troop cast?”. The Engine responds “No!”, so the UI tells the Card to display of screen with no cast button. A short time later the Engine wraps up the AI turn, however Card has no clue anything has changed, it just knows what it was told when UI commanded it to show on screen. But if you close the Card and click again, when UI asks Engine if it can cast it says “Yes”, so it tells Card to display with cast button and life goes on.

The Engine can’t talk to Card, just answers UI questions. And UI can’t talk to Card, just tell it when to display and how. Card can talk to UI, but only does so when you close it or click cast. Adding an extra communication channel isn’t trivial; you’d either need the Engine able to tell the Card of the change (which adds another way for things to screw up later), the UI to talk to the Card after it is displayed (ditto), or for Card to ping the UI every second to ask “cast yet??” (which adds complexity and potentially slows it down)

TLDR: It is likely more trouble than it is worth from a good coding standard perspective :slight_smile:

2 Likes

Pretty sure Unity is event based though, so all the code would have to do is send out a “player’s turn” event, which the card screen can catch to enable the button.

But I know where you’re coming from, hence, option 2 :slight_smile:

Oh, and even if it didn’t use events, then all the engine had to do is check if a player card is visible when it enters idle (player’s turn) mode, and when it does, tell it to enable the button.

See, now you got me thinking code again… I’m supposed to be having weekend now :slight_smile:

1 Like

My work here is done!

insert evil laugh here

2 Likes

This would save me so many clicks, lol. Can we have this please? Thank you! :blush:

1 Like

what if adding a button for casting? i.e. when spell is ready right clicking fire the spell.
when playing on pc it’s really annoying that back and forth…