Friday, March 30, 2012

Getting Ahead of Myself

Here's a teaser photo of the inventory screen I'm working on.

But, I think I am getting ahead of myself. I really think this game needs multiplayer functionality, and if I do not start incorporating it soon, I'm going to have to gut a lot of code, and I don't want that.

So, I'm going to start with a new project.  My goal is to create a server based "game" where each person connected moves a dot around on screen, and that dot is moved for everyone else. Sounds exciting? No, but I've never dealt with any multiplayer mechanics though, so I'll see what happens. Anyone want to try it out when its ready?

Edit (Additional Comments): There's a lot online about lag compensation and client side prediction.  To keep the cheating down, your game should send the server the button presses and what have you, and then have the server determine where you are, what you hit, etc. This seems like a lot of work, but I think it's only really important for competitive games, especially when you don't know who you are playing with. This keeps players from telling the server "I'm here" then teleporting elsewhere and saying "Now I'm here" without the server having any say. They can also say "Hey, my health is actually full now for no reason!" and the server, if not controlling this, just accepts it. This is bad for games like Counterstrike, or Mario Cart.

For this game, I could care less if you cheat. When you play online, you typically will only be playing with up to 4 of your friends. Everyone is working together towards the same common goal. If you cheat, you lose on the experience of the game. Your friends are less likely to play with you, unless they are cheating too. If your all cheaters, then heck, more power to you. You will be drying up the fun in the game in no time.

I do, however, intend to have the server control some things that ARE competitive in a sense. Two people who think they have picked up an item just before someone else (because of the delay over the internet) can't BOTH have the item. I also have to make sure that the person who runs the server and has the fastest speed isn't the one who is taking all the loot, leaving everyone high and dry.

Again, suggestions are welcome. At the moment, I am thinking items will be assigned to a random person in the group with a timer, after which the time is up anyone can grab the item. Coin/Treasure pickup will be instant, and will not be worth anything until the end of a level. Everyone puts the treasure they picked up into a pot (more people means more treasure chests, monsters, items, etc.) at the end of a level, and then is paid out "evenly" at the end of the level. Items acquired are for keeps and can be sold for straight cash to player.

When I say paid "evenly" this depends. Before the level starts, each player will "sign a contract" which they can set the % of money they take from all the treasure they find. This starts even for everyone.  But if you have a friend who you want to catch up to the group or doesn't have as much cash to buy some items, you can adjust your own percentage down so they can adjust yours up.  You then "sign" the contract to agree. Any percentage not accounted for (players dropped their percentages without raising any others) will go to "charity". This does nothing, and you lose out on that money. So much for charity work.

Wednesday, March 28, 2012

In The Works

Currently in the works:

Arm Animations - Unarmed and Basic Attacks
Inventory System - Screen and Handling
First Weapon - Throwing Knives (Combination of Melee attack and Long Range)

Maybe I'll leak a picture soon!

Saturday, March 24, 2012

Watch A Bean Jump

He's not much of a character yet. The arms and head will move independent to the body, so I have yet to create them.

Tuesday, March 20, 2012

Hit a wall? Go around it!

Moving the map with respect to the player wasn't too extensive a task.

I just wrapped up the collision detection between the player and the surrounding world.  There's a lot of looping and decision making code that was just piling up and piling up until I was swimming to deep in it.  The code was a mess and not working right, and it was a headache to make heads or tails of it, so I scrapped the whole thing.  I wrote out what I needed to do on paper and figured out what loops needed to control the collision detection.  After copying some of the old code, it took me just about 45 minutes to rewrite the organised code.  It's so much cleaner now.

That's what I get for starting from scratch with no plan.

Now with collisions working, I am finding that my map movement is not lined up correctly.  I've fixed it on 200% viewing scale, but 100% is still off.  I'll take a look at the drawing code for the world tonight and fix it up.  I'll also start putting together some walking animation for my "naked" player sprite.  I hope to post a video with the collision detection and sprite animation working correctly.

Thursday, March 15, 2012

Moving Slowly

I have been working on a way to make the screen (camera) follow the player and make the world seem to move instead of the player, without actually moving the world.  I've gotten things to be successful, but I only half understand why it's working correctly.  It kind of happened on accident, and one of the variables is confusing me, but I think it should work with everything else that will need to be viewed. I'll tackle that hurdle if I can't jump it later.

Next on my list is collision testing, which a lot of people online do in extremely complex ways. I don't think it needs to be that complicated, and have an idea of how I would like to do this. After that, I'll add some physics, get my un-animated 2D sprite to move and "jump", then I'll add some animation.

Saturday, March 10, 2012

Remember small steps?

Hey! Some graphics! How exciting. Randomly tiled bricks in a 10 by 10 space.  Okay, so this is a small step, but you have to take small steps before moving onto bigger items. I then made the space as wide as the screen, and worked up a chunk of code to handle auto-tiling.  It's job is to detect the edges of a texture group and change the graphic to create a smooth transition.  The above picture looks very tiled, with a definite grid. To try to cut down on the grid seen, the auto-tiling smooths out the textures below and gives edges where needed, as soon below.

It's hard to see how much auto-tiling is actually occurring, as there are only four separate brick images needed in the above screen capture. The same tile arrangement is below, but I used a different texture. Below that is the image that my auto-tile uses, cutting it up into bits and rearranging them as needed.

Auto Tile Sheet
Now I am working on the camera, maybe some of the GUI, and then I'll add a player with collision collection and controls.

Tuesday, March 6, 2012

What Are Tiles Made Of?

I'm trying to figure out how my map is going to populate the screen, holding information about the tiles, and being able to move the camera. I feel like I'm close, but not quite wrapping my head around it yet.

Remember, small steps.

I think I have a direction in which to start testing things out. Let's see where it goes.

As for sprites, check out the title! I'm not sure how crazy I am about it (Edit: Better now, the little guy was not to scale with the bricks). Right now the pixels are blown up to about 200%. If I want to keep things crisp, it will all be smaller, requiring better artist skills, which I do not have. I'm also not too thrilled with my little guy I have made. I'm thinking the game will have to animate the legs, each arm, body, and head all separately to allow for all the combinations of clothes, item use arm movements, and general looking movement. I have an idea how to address this too. I can't really rotate things, otherwise the large pixel feel will look worse with rotated pixel objects.

Anyway, time to code, unless Ash calls me to play Payday: The Heist. Robbing banks is addicting.