Dev Log - Week 5: Highly Effective

Hello, everyone! For this past week of development on Dog Eat Dog, I kept working on getting cards working. While I was successful in the end, I don't think there's going to be too much to show you. To give a general overview, this week I did most of the work to build the basic underlying system that will let me build most card effects I'll ever need. So for this log I'll be going over the basics of how the cards work under the hood.

To start with, the Card object is basically exactly what you'd expect. Each card contains information on its name, cost, artwork, and an ID number. Each card also has a list of Card Effects, which is another object that I'll get to in a second. One thing to keep in mind is that a Card is only the data. When a card goes into the player's hand, it's a different object. When you play a card, it's a different object that takes that data and actually handles carrying out the effect. Now that I say that, I get the sense that I might want to change the name from Card to CardData to be more clear. But whatever.

The other important object is the CardEffect object. CardEffects work as a state machine that handle all the actual stuff that cards do. This object doesn't just handle the basic effects like "Deal 4 damage" or whatever, they also handle all of the player input, such as choosing a target, and visual effects. The only thing passed from State to State is a target object, which can be used to choose a position or a location. This is all sort of dense so I'm just going to show some examples.

First, there's the Spawn Plant card. It's got two separate effects to go through. First, the Target Position effect. This effect takes the target object and moves it to the player's mouse position until the player clicks. You can also socket any object you want into a TargetPosition effect to change what the targeting reticule looks like. Right now, mine is just some lousy programmer art with a particle effect attached to it, but when we have something nicer, we'll be able to toss it in there no problem. After you've chosen a position, there's the Spawn Object effect. It spawns an object. In this case, that's a plant. I know, who would've guessed. At present, it just creates whatever object and places it directly where the target object is, so randomizing the position would be as simple as replacing the TargetPosition effect with a different effect that chooses a location on its own.

The other card I've built right now is a simple proof-of-concept evolution card. It takes a stat (in this case, the player's speed) and adds a modifier to it. If you play with this yourself, you'll probably see that it's too much and it stacks forever. So you can make the bunny run like crazy. This will probably be changed.

Anyways, that's it. This week was a bit slow, but now that this framework is put together, adding additional cards will be fairly quick and easy. Next week, I'm planning on adding a bit more in the way of gameplay, as right now there's not much to do. So I'm making a promise here: Next week the game will have a goal. See you then!

Leave a comment

Log in with your account to leave a comment.