Tumgik
iceindie · 7 years
Text
Conditional statements
Programming in Unity C# - Part 4
What’s the point of a program if it only does the same thing every time? (Actually there are good things that do only one thing, like installers, but that’s aside the point.) In order to respond to user input, or even behind the scenes logic, your code needs a way to follow branching paths, and branching paths to follow. Behold, the If statement:
if () {
}
It’s not that fancy when it’s empty, but let’s say you have a function that kills the player, Die(), and you need to activate it if the player’s health dips below 0. You would need to check every logic update, and you can use this code to do just that.
int health () = 100;
FixedUpdate () {
     if (health < 0) {
          Die ();
     }
}
For the most part, () is used to include information about a function (As in, if (something)) and {} is used to enclose a block of code that always runs together and in the same order.
0 notes
iceindie · 7 years
Text
Variables part 2
Programming in Unity C# - Part 3
When you have two or more strings that you need to attach, you can simply use the + symbol. This will put the strings together into one bigger string.
string name = Iceball;
“Hello ” + name + “, welcome to the grid.”
Notice the space after hello, it separates the two words as you would expect. Otherwise you would get: “HelloIceball, Welcome to the grid.”
Booleans are the simplest data type of all, and are the kind used in if statements. In the next part: if statements and for loops.
yes I know it’s short. Hush. :)
0 notes
iceindie · 7 years
Text
Variables part 1
Programming in Unity C# - Part 2
Sometimes you need to have a formula that works for any given number. Or you need to be able to keep track of the player’s health. In order to do this, you will need a variable of one of the data types I mentioned in the last post.
If you want to keep track of player health, integers are a good way to go. But you can’t just expect the computer to know what you’re talking about when you say “Make the players health be less now, he got damaged.”
First, you need to tell the computer what the variable is called, and what the data type is.
int health;
The semicolon is like a period for the computer, separating two commands like a real period separates ideas. You need one at the end of almost every line.
You also need to tell the computer what the variable starts at. You have two options for this, both of the following variables will work fine;
int strength = 1;
int speed;
speed = 5;
If you don’t tell the computer what the variable starts at, each data type has a default value. int = 0; float = 0f; bool = false; string = ““;
Integers and floats don’t play nicely, so you can’t add them up normally. In order to add them up, you’ll have to use a cast. Casts are a way of turning one datatype into another, but only comparable data types will work. Strings and floats, for example, can’t be cast. To cast something put the data type you want in parenthesis in front of the variable.
int strength = 5;
float attack = 10;
int damage = (int)attack + strength;
Notice that the damage variable starts with a value of 15.
To be continued, with string addition and a word on booleans.
0 notes
iceindie · 7 years
Text
So you want to learn to program?
Lesson 1: basic data types
In this series, I will offer rules and advice for aspiring game developers. And also cause I owe a friend a tutorial.
The series is targeted at C# with Unity libraries.
Float: The floating point number is your friend. It is a representation of any number, and automatically has the correct amount of data for any given number of significant figures. “Floating point” simply means that the decimal point is not in a set position, it can float around. 5.0f, 3.222f, and 100f are all floats.
Int: Like the float, you don’t have to tell the computer how many bytes to set aside for you, but the int, or integer, has one limitation that makes it useful for HP, or player level. An int must be an integer. 3i, 25, and 12i are all integers.
String: A string is anything enclosed in quotes. You can imagine it as a bunch of letters and characters stuck together to form a string. (Fun thought: Forums have threads, which are made up of posts. But posts are made of strings, so a bunch of strings makes a thread.) “Hello world”, “12345″, and “Smelly feet.” are all bad passwords strings.
Bool: A boolean is a value of either False (0) or True (not 0, usually 1). True and False are the only booleans, but if statements can also use 0 and 1.
Those four are the basic four, and are all you need to get started. Next lesson is on variables, defining them, and assigning them.
0 notes
iceindie · 7 years
Text
Death Spinners development
Part 3
Also I added a main menu, with only one button, and some pretty sloppy victory screens. Yay me!
Want to play the game? A polished version will be available to pretty much anyone who asks, I’ll upload it if I ever find my jump drive. :P
0 notes
iceindie · 7 years
Text
Death Spinners development
Part 2
I then set to work creating a system for the weapons to move around the player. They would have a rigidbody, and the velocity would be set to 5 every frame. Right after the move, the weapon would Transform.LookAt() the player it was “attached” to.
Note: If you are using the XY plane, be certain to set the worldUp variable in the LookAt() function to negative Z. Otherwise you get some weird effects.
Since the weapons worked, and the players died, all I needed to do was make them respawn! Then the game would be effectively done! I gave the player objects a respawn script, which chose a random spot in the map, and would Instastiate() a new one. They would often die immediately though, since they would often spawn right on weapons. I made a simple animation out of squares, and used animation events to delay the spawn about 2 seconds. Honestly I don’t know why that helped, since it doesn’t change any of the odds, but it did work, so I won’t question it too hard.
The game is fast paced, and difficult as all balls. Most of my friends beat me at it consistently. That’s how I know it’s good, I’m never competitively viable in the really good games.
0 notes
iceindie · 7 years
Text
Death Spinner development
Part 1
I once thought, I should make a game. (Well I thought that a lot but this time it was special.) See, this time I realized that I don’t finish projects because I always have too big of a scope. So I decided to make the smallest scope I could think of: A local battle game.
In it you were going to be a player... no. I then decided that it would be done using only assets that could be created from the Unity “Create” menu. No artwork was used in the game. That made the game even easier to develop!
I went to work creating a sprite of each shape. The players would be represented by red and blue circles. The walls represented by grey squares. The weapons would be...
I knew I’d had trouble with combat systems before... I couldn’t reasonably well have swords, the animations would be too complicated for my (at the time) limited knowledge.
I then thought, what if the weapon was just always there? And if it collides with the enemy player the the enemy dies and respawns. So I created a hexagon GameObject and programmed a collision system and tested it out, it only needed minor debugging, and a function needed to be correctly spelled...
Note: 2D rigidbodies do not respond to OnCollisionEnter(), use OnCollisionEnter2D() instead.
0 notes
iceindie · 7 years
Text
Starting a Patreon Soon
It’s in support of my video game development! So that I can work on games for a living, and so you can have games made by yours truly!
I will launch it immediately if this post reaches 15 notes, no edits to the silly description or anything. (Otherwise you’ll have to miss out on the dorkiness :P )
0 notes
iceindie · 7 years
Text
Prisoner of War rules
Players:
2-4 players recommended. Any number of players is viable though. If you have more than two players, any effects that targets your opponents battlefield will target any opponents battlefield of your choice.
Equipment:
You will need one less deck than the number of people playing. Shuffle these together for one big deck.
Objective:
Destroy your opponent by removing all of their cards from the battlefield.
How to start:
The dealer shuffles the deck and deals two stacks of five cards for each player and puts the stacks in the middle. Choose a player to go first, usually to the left of the dealer.  The players take turns picking one stack and moving it in front of them, the last player (The dealer) picks two, and sends the turns back the other way, letting each player pick their second stack. (Think of the way you place settlements in Settlers of Catan). Each player looks at their stacks, and chooses one to be their hand, and one to be their battlefield. The stacks may not be mixed together. The deck is placed in the middle (but not in the way) while the players lay out their battlefields in front of them, one line of five cards. If the battlefield has matches, leave them separate for now, you need to stack them as an action later. Choose a player to go first, usually to the left of the dealer. Play travels left (clockwise). There is a shared discard pile, but you don’t flip the top card on the draw pile into it.
Gameplay:
The game continues until there is only one player left with cards in their battlefield. Each payer takes one turn, and the passes the turn on to the next player. A turn consists of two actions, where an action is one of the following:
“Play” a card.
“Stack” matching cards.
“Cast” a card.
“Attack”
1. Put a card from your hand onto an empty slot in your battlefield or onto a matching card on your battlefield.
2. Stack two matching cards on your battlefield.
3. Discard the card of your choice, and discard a matching card on your opponents battlefield.
4. Add up the total value of the stacked cards. (Two fives is ten, three fives is fifteen.) and discard the top card of the stack. Then remove cards from your opponents battlefield whose combined values do not exceed the value you added up earlier.
Another note on the attack action. In order to use a stack as an attack, it must be charged. All your stacks become charged at the start of your turn right after you draw. If you play a card onto the stack it becomes uncharged. If you use the stack for an attack it becomes uncharged.
Competitive play:
Give each player their own deck of cards. Each player has a discard pile of their own called the prisoner pile (The namesake of the game.) There is also a shared discard pile for cards that were cast.
When you cast a card, put it in the shared discard pile, and put the matching card in your prisoner pile.
When you attack, put all the discarded cards in your prisoner pile.
At the end of a game, add up the values of each card, this becomes your points. The winner is the player with the most points. You can play any number of rounds, just be sure to make it clear how many you are going to play before hand.
0 notes
iceindie · 7 years
Text
Prisoner of War development
Part 3
I kept playing games against myself for a couple of weeks, testing out the rules and modifying them to keep the meta at bay. I wanted the spell casting to be for emergencies, but everyone kept using them as a primary way to deal damage to their opponent. In the end I let the meta create itself, instead of trying to modify it.
The biggest change to the game is this period of time was a new action, switch. You could take a card from your battlefield and a card in your hand and swap them, in order to let players play the game once there battlefield was full. (There were a lot of times when no one had any viable moves.) The battlefield maximum was increased to 5 cards, as well, to match the hand size. And the draw rule was changed from “draw one card at the start of your turn” to “draw up to 5 cards at the start of your turn.“
By this point the game was almost done, as far as games go, this one kinda just made itself. During one of my matches against myself, I kept finding the kings to be too powerful, and hoarding all the ones you could find was the best strategy. This wasn’t good, so I changed the card values, and added my first negative rules. (I prefer to write games by telling players what they can do, positive rules, than to tell them what not to do, but sometimes negative rules are necessary.)
2-10 were worth the value labeled on them.
Ace, Jack, Queen, King, and Joker were all worth 10. (A stack of two kings dealt up to 20 damage.
Aces and Jokers were not face cards or number cards.
Number cards could not remove face cards.
Face cards could only remove cards valued lower than themselves. (A king could remove any card in the game, but a queen could remove any card except a king.)
Jokers were special, as a spell they could match with and discard any other card, and if you managed to get both jokers, stack them, and attack with them, they would remove all but the two most powerful cards on the opponents deck.
I will reveal the rest of the rules in the next post!
0 notes
iceindie · 7 years
Text
Prisoner of War development
Part 2
I didn’t have to watch my brother forever, once my family took him back, I went home to develop the rules further, finding ways to improve upon them.
The available actions increased, and so the turn definition changed to “You may take two actions per turn.”
The available actions were drawing a card, playing a card from your hand to your battlefield, and Attack. An attack action was more complicated then the others, you started by choosing a stack of cards on your battlefield, adding up their total, and discarding the top card of the stack. I had yet to define card values, so they assumed the standard 2-13 values (Aces were 11). You would then take off any number of cards from your opponents battlefield, not exceeding the total of your attack.
I played this with my mom quite a bit, and the battlefield was limited to four cards by her suggestion. A new action was also added that night, spell casting, you would take a card in your hand and discard it, and then discard a matching card from your opponents battlefield. This was to allow players to deal with very powerful attacks (Like triple kings) by reducing the stack height, the attack power would go down. or you would reduce the attack power to 0 if you took off one from a pair of cards, since single cards can’t attack.
0 notes
iceindie · 7 years
Text
Prisoner of War development
Part 1
I was forced to watch my young brother. He was just learning addition and subtraction, and neither of us could find a game we could agree on. Finally I said “Let’s just make a game.” and pulled out a deck of cards. I laid out four cards in front of each of us, and began to think of mechanics. “If you have any matches, stack them up.” So my brother did, and I dealt out 5 cards to each of us for a hand. “On your turn, you can draw a card and play a card.” You would just see who got the most matches in this version. Of course I was really into Dokapon even at this time, and liked using math to determine a battles outcome (don’t ask me why I thought they were related, they were only slightly related.). So I said, “If you have a stack of cards, you can use it as an attack.” At this time, we would just get rid of the whole stack of cards, subtracting up to the same amount from the other players side. It was decided that running out of cards on the battlefield meant you lose.
0 notes
iceindie · 7 years
Text
Actually got something perfect first try.
So I go back and check it again. But it works and I have to actually start on the next part of Legendary Quest.
God, I need a new name for the project.
0 notes
iceindie · 7 years
Text
Hello? Is anyone out there?
Ah well, soon enough this blog will be full of the coolest game development tips and tricks, and progress on my current projects: HeliaBound (From which I get my icon) and Legendary Quest (It’s a working title).
For now, I’ll leave you with a list of my completed projects and current projects, in chronological order. (Yes, I’ll spare you my massive list of uncompleted and abandoned projects.)
First off, my biggest project, and by far the most time consuming, HeliaBound. It’s nowhere near finished, as it plans to be a replacement to all other tRPGs (tabletop role playing games), but it has a lot of content. I run a discord server where me, my team, and some friends play it, for testing purposes and for fun. I could go on for a whole website about this game... oh wait. I did. https://sites.google.com/view/heliabound. Just so you know, the website is just as unfinished as the game.
Second, in 2015, I created a card game with my family called “Prisoner of war.” It was a combination between matching cards and using them. Keeping a stack of cards in front of you on your “battlefield” longer than you needed would allow you to charge up another level of attack (using a third matching card) but if your opponent had the right cards, they could destroy the stack, leaving you with nothing. I’ll talk more about its rules and its development cycle later.
Third, in early 2016, I was bored and couldn’t remember the rules to solitaire. But when I realized that the perimeter of a 4x4 grid of cards, the area of the same grid, and the number of matches that can be made by matching cards by suit in groups of three were all the same number, I knew I had to do something about it. (Actually I came to that conclusion late in development, more details later) I actually never named the game, and ended up calling it Match 3 solitaire. How creative.
By early 2017, I had gotten enough practice with unity 3D to complete a project, of course the main reason I completed it was because I turned down the scope of the project until I could complete it in 48 hours. It turned into a fun little 2 player versus match, where you indirectly controlled your weapons. It’s really difficult to get good at, and almost every single one of my friends is better than me at it. :(
Finally, my favorite project of them all. Have you ever played Dokapon Kingdom? (No I didn’t make that one, nor did it come out so late as to be on the bottom of this list.) I really love that game, but it is a little dated now, and needs a successor, Atlus seems to have no intention of doing so, and the game is completely gone from their site, so I had no choice but to create my own version. Originally it was a TI calculator game (which got finished, for TI-83+, TI-84, TI-84+, and TI-84+C silver) Unfortunately one of my friends from high school decided it would be funny to delete my calculators RAM. I had moved the game to RAM to work on it (And didn’t make a group object either) so there are only a few working copies of the game remaining. It was called DokaMini at that point, but the project was given a working title (Legendary Quest) when I started recreating the calculator game on computer. Major updates from the original will include a 2D world (instead of 1D), tons of events, graphics, better equipment info, and more details about combat!
Stay tuned for info about the development cycle of each of these, and stay a follower for access to game rules and game files!
0 notes