Saturday, October 1, 2011

Pathfinding

I am surprised that I haven't written here in a while.

Here's a quick summary:
  • I got things stable enough to hand the game over to a couple people to try out. It seemed to do okay - there are still some major bugs, but I knew that going in. I mainly just wanted to see if they thought it was interesting.
  • They did find some fun bugs though. For example, currently you are able to pick up the car and carry it around with you throughout the house. Talk about impressive!
  • Once I handed it off to my players, I immediately went to work on trap #2 - the dog! During the game, the dog will wake up at some point and need to use the restroom. If you don't take care of it in time, the dog will wake up your parents. The issue that I ran into was getting the dog to walk to a specific room; aka Pathfinding. I spent a lot of time working on this problem, but I couldn't seem to get it to work the way i wanted. So, i cheated and hard coded a path for the dog to take.
  • While this solution worked, it wasn't the "right" way to do it. This solution meant that I would have to hard code every path I wanted an NPC to walk to get to a specific destination. And, if i were to add or change a room, I would have to go and fix all the hard coded paths. This did not sound like fun.
  • Therefore, I decided to re-tackle this problem. To make things easier, I cloned my code, ripped out all the stuff that didn't apply to NPCs and moving and started work from there. After several hours of work this evening, I am happy to say that I got it all figured out. It seems to run beautifully.
In summary, sorry for not updating more, but work is being done. :D


Saturday, September 10, 2011

Long day

I worked a lot today.

Rewrote a lot of code AND got light to travel through doorways. I know, pretty awesome right?

More re-writes

So, the current "game" that I am working on takes place in a suburban home. When I last posted, I had figured out how I was going to create the doors and allow the player to interact with them. This morning, I implemented it all.

Now that a part of a room can be interacted with, I need to be able to relay the current state of the door back to the user. This means that I need to constantly update the room's description to include which doors are open or closed. However, before doing so, I think it's best if i finish the lighting functions first, since this too will effect a rooms description. What the player will see when its pitch black is vastly different than when the player is in a brightly lit room.

So I have also added in the ability to toggle light switches on and off. However, doing so doesn't actually accomplish anything yet.

Before moving on, I think I have to rewrite more code. It seems that this is a common practice lately. I believe that I want to change the way a room object is constructed, somewhat drastically. This will impact movement as well, so that will also need to be rewritten.

Also, I should comment my code. Sometimes it takes me a couple reads to figure out what a section is doing and I wrote the damn thing.

Also also, I am thinking of adding debug/dev tools into the code that can be toggled on and off.

In summary, there's a lot of work to be done before anything new gets finished. Arg.


Monday, September 5, 2011

Updates

Over the past few weeks, I have managed to get my C# code on par with where my C++ code was before the switch. With most of the bugs worked out, I came up with a neat game idea.

Before I began working on this game, I thought that I had most of the code that I would need already done. The player could move around, open doors, interact with objects etc. However, I was mistaken. While, yes, all of these things are true, those functions/methods weren't doing exactly what I needed them to do. Therefore, I am building upon existing code to make it more powerful.

For example, most of this weekend was spent on doors. The old maze/fighting application only had one door and only required a bit of extra code to handle it. This new game has at least nine doors. In order to make my code streamline, I had to throw out the little extra code I used for one door and write a block of code that could be used for an infinite amount.

For a while, if you opened Door A in Room 1 and walked through it to Room 2, that same Door A would be closed in Room 2 despite it still being open in Room 1. But that has since been fixed.

I have no idea of a timeline for this little project. But hopefully I'll continue to plug away at it.

-Dash27

Sunday, August 21, 2011

Moving Right Along

Progress has been made.

It turns out a lot of my code is reusable - except for small things here and there. I've gotten the point where I can navigate a grid of rooms and have walls that block passage. Unfortunately, you are blind at this point and can't see any exits. You find exits only by trial and error.

PAX is this weekend and I get a new computer on TUESDAY, so I probably won't code much after MONDAY. But, maybe i'll find some time somewhere.

-Dash

Saturday, August 20, 2011

Switching Languages

It has been a while since I last posted, and before today, a while since I coded.

I spent a week preparing for D&D and I knew that it would never get done if I allowed myself to get swallowed up in the next phase of coding. I was at the point where it was going to get fun and challenging.

However, I am still not at that point. I have been convinced by several trusted folks that I should switch from C++ to C#. So I ordered a few books online and waited until they arrived. It was pointless for me to code in C++ since I was going to be throwing it all away anyway.

I did, though, spend some time jotting down ideas for what to do next - at least once I get my C# code to the point of my C++ code.

Anyway, I started C# today and basically have a "Hello World" running with a couple of if statements thrown in. So, that's cool. I'll probably work on it throughout the weekend.

Monday, August 1, 2011

Bug Fixes

I had some of my friends play the game and they found a couple bugs that I have since fixed.

The latest version includes the following fixes:
  • The message "You aren't wielding a SWORD!" will now display when you attempt to attack with the sword when it IS NOT in your inventory instead of displaying when it IS in your inventory.
  • When used, the KEY will now correctly open the North door instead of the non-existent South Door.
  • When you are reduced to 0 hit points, the game will immediately end, instead of after your next action.
  • NPCs who are dead should no longer try to attack you.

Saturday, July 30, 2011

Combat!

It's sunny outside today, so naturally I spent most of the day in doors. :D

Combat now works. At least, the player is able to attack NPCs. The NPCs can't attack back yet. But, when they die, they can drop loot, which is pretty cool.

The command for attacking follows this example "Attack NPC with ITEM". It took me a while to figure out how to separate all the words into different variables, but a couple find methods and trim functions later and it was working.

I then rewrote it all to make combat more NPC friendly. As I said, NPCs can't yet attack back, but when I get to that, I should be able to reuse a good chunk of code.

-Dash27

Thursday, July 28, 2011

Doors and Dogs

I added a couple new features over the past few days.

There is now a locked door that requires a key to open. Additionally there is a stray dog that wanders the map. You can't interact with the dog yet, but hopefully soon.

But if you call for him, he'll tell you where he is....

Monday, July 25, 2011

Inventory Works!

Yes!

My genius idea worked! I am now able to pick up an item, move to another location, drop it and move back to the original location without having the item magically respawn.

In order to do so, I had to re-write most of my code, but that's how the cookie crumbles.

The big change I made was to create the rooms during the declaration of variables. Before I was only using an instance of a room when moving. That meant that every time the player left the room, any changes made to the room would be erased and when the player re-entered, the room would look as good as new. (This is why if i took an item, left the room and returned, the item would re-appear.)

In making this change to the rooms, it borked my Moving code, so I had to fix all that. Then finally, i was able to write the Item code.

Phew. That was a good night's work.

-Dash27

Friday, July 22, 2011

Inventory Issues

As I believe I said before, I was on vacation for a week in sunny California. One day when I wasn't relaxing on the beach, I worked a bit on being able to pick up and drop items in Battle 3. I emailed the following update to a friend:

"Ok, so I got Battle3 to where you can pick up an item from a room and the item is removed from the room and added to your inventory. However, if you leave and come back, the room repopulates the item.

Also, if you drop the item in another room, it vanishes.

So, in summary room inventory is broken. "

I continued to work on the problem a little bit, but kept running into issues. [My problem centers around two classes needing to access data and functions from each other. I'm sure it's possible, I just don't know how.]

Anywho, on the way to work this morning, I think I came up with a new way to handle Inventory that is waaaay less complicated than what I was attempting to do. Yay for Zen moments in traffic.

-Dash27

Wednesday, July 6, 2011

Not much done today

I had a busy day today, so I didn't get much done. You now automatically "look" when entering a new room and I began to comment my code so I would remember what it did later. That's all for now.

-Dash27

Tuesday, July 5, 2011

aMAZEing!

Yes, it's a horrible pun.

But now I have walls and have built a maze. A few hours well spent.

Note to self:
  • Comment your code!!!

Gettin' Started

Heya-

Don't know what this is or what it will be.

This past Saturday, I picked up "Beginning C++: Through Game Programming, Third Edition." I've taken a Java course and a .Net class before and am learning some code at work, so I thought I'd try to create something.

During my .Net class at BCC, I made a game called Battle2! It wasn't that fun, but was silly and functional. Now I'm working on something else. Right now I'm thinking of it as Battle3, but it could turn into something completely different.

Anywho, after a couple of hours of work I did this weekend, Battle3 consists of walking around a grid and looking around. Each co-ordinate on the grid represents a room. If you get to 0,0 on the grid, the game ends. There aren't any walls or whatnot yet, so it isn't very challenging.

Here are my current development goals:

Movement:
  • Add walls to the grid.
  • Add a description to each room.
Inventory:
  • Add ability to pick up and carry items.
  • Add ability to drop items in rooms.
That's all for now!

-Dash27