top of page
Search
  • Writer's pictureRob

Dev Blog 8: Cards and feedback


The sprint has been all about cards. There were a few things about the card system that I didn’t quite like. It didn’t feel slick, some of the code was pretty hacky (especially the method I used to calculate the card positions in the hand) and there were one or two visual bugs.


Scriptable objects

What sparked this big re-factor that I was about to pursue was my discovery of Scriptable Objects in Unity. Previously I created all my card data objects in code. The long term goal being to actually store this data in a JSON file and for the game to download it from a server upon booting, this would enable me to make balancing changes whenever I want without deploying a new version of the game, but I digress…


My card data object looked like this…



… and I would initialise them up in code like this…



This was all well and good but it turns out Unity has a quite useful feature to help with this kind of scenario called Scriptable Objects. So here is my card data class as a Scriptable Object…



The major difference being in the class declaration and its new parent class ScriptableObject. Now Unity will recognise this class when I compile the code and I will be able to create them in unity like so!



Then I fill in the fields and voila!



This is a much better way of doing things!


Card canvases

While I liked the old system I had for rendering and animating the cards, it did not sit right with me. First of all, each card had it’s very on canvas which to be honest was pretty bonkers when you consider you would normally have one canvas the render the entire UI! I essentially treated them more like game objects in the physical world space as opposed to an element within the UI.

The great thing about using the built in Unity features I was about to implement is that it solved a lot of problems that I’d had while managing the card rendering manually. The first of which being a fairly long running bug where sometimes the card pictures would render in the wrong order and templates from cards in the back would be drawn in front of the artwork from cards in front of them. The second was having to manually work out the card positions within the hand which involved weird code that I didn’t like all that much.


The old system....

So I solved these problems and more by using a Horizontal Layout Group which is a component within the Unity engine that will calculate and place within screen space automatically!

So I set up panels on the UI canvas to represent the player hand and the play area (see here in red and green)



When I click and drag a card from the hand panel to the play area panel, it is activated and some animation code triggered to have it snap to the centre of the screen, before making its way over to the discard pile.



To get all this to work nicely I had to make some massive changes to the Card Controller, splitting out loads of functionality into new sub components. These were all steps in the right direction as it felt more like the “Unity way of doing things” leaning more on multiple small component classes over fewer large manager classes.


There was one problem however in that there was no way to animate the cards to have them move smoothly from point to point and there is not built in system to support this kind of behaviour. To solve this, I essentially use a placeholder object on the canvas panels to tell the cards where to go on the UI and the image of the card follows it around using smoother movement that I could control. Demonstrated here (the placeholder object is shown in red)



The end result was a slicker, more stable system with fewer bugs that leaned more on Unity’s built in features rather than my own code. Well happy.


New cards!

I added five new cards this sprint! I wanted to start introducing some new mechanics such as changing the terrain on the board as well as drawing and discarding cards. So I came up with these;


Charity

Very simple card, just lets you draw two more.


Give and Take

A little more interesting, you draw three cards but then discard two. This was a bit more interesting to implement as it required some additional UI that had to come up mid-play.


Grappling Hook

I like this one. It actually pulls the enemy closer to you, however it locks them into a stunned state, forcing them to skip their next turn. Bosses and tougher enemies will probably be immune to being stunned but I think it will be a good way to handle multiple enemies if you are getting overwhelmed.



One Inch Punch

I thought this might work well with the hook, pull them in, stun them and knock them back with a powerful close range attack!



Erosion

This was the most complex of the five. Erosion converts tiles to water. Eventually I want certain cards or equipment to give you bonuses while on or near water. Right now though it works as a great way to slow the enemy down.



Card view UI

Finally I added some simple UI to let the player view what is in their draw pile, discard pile and deck. They don’t look fantastic right now but they will be very useful for the player as they try to make decisions as to whether or not to play certain cards. Or help them make more informed decisions when choosing new ones for their deck.



Player feedback

I now have a devoted following of fans! (some mates in a WhatsApp group) who test and play my game for me and give me feedback as well as report bugs they find. This has been so incredibly helpful for tracking down some issues and improving features. So I also made many small gameplay tweaks this sprint such as.


- You now always get at least one card choice at the end of a battle, even if you picked up no treasure

- Heavy Magic Missile’s targeting shows which neighbours are going to get hit buy splash damage.

- No more starting cards in chests.

- Player no longer loses movement points after playing non-movement cards.


I do believe that making constant small tweaks like this starting now and throughout the development process will make the game so much more intuitive and fun by the end. Getting good honest feedback and acting on it is very important to making a good fun game and I can’t wait to get more players trying it out.


I had one really nice moment where someone sent me an 8 minute video of their gameplay and I was just thinking how amazing it was that someone was playing and figuring out a thing that I had created! It was a pretty awesome feeling.


That’s it for another sprint. Next sprint I will be working on a new creature type and improving some of the player experience so if you are interested in trying out the build, sign up to my newsletter below or send me an email to info@doubleonestudios.co.uk


Thanks very much for reading!

94 views0 comments

Recent Posts

See All

Comentarios


ABOUT DOUBLE ONE

Hello! Thanks for visiting. Right now Double One is just a lone developer. Me. Who has thrown their lot in at work to make their own way into the world as an indie game developer. I've got an idea, some concept art, and a basic prototype of a thing I think is going to be fun. So watch this space and wish me luck!

- Rob -

  • Black Facebook Icon
  • Black Twitter Icon
  • Black Instagram Icon
bottom of page