7DFPS – DAY 2

So day 2 was not quite as awesome as day 1. I’ll do the good stuff first.

THE GOOD STUFF
My priorities for the day were to get weapons systems and items systems set and in place, and for the most part I did. I managed to work out how to do proper raycasting for any variety of bullet-based weapons, so now with just a few changes in the editor I can make a pistol into a shotgun or a machine gun, each with varying levels of accuracy/spread. I also managed to get rockets working, and explosives that do varying levels of damage to objects depending on how near the center of the explosion they are. So all in all, pretty solid. Items I didn’t do yet, but the implementation is super easy with how I’ve got the weapon class done up.

THE BAD STUFF
I discovered when testing the explosions that I had no way to actually make objects react in accordance to the explosion. Enemies would get hit by rockets and just stand there like statues, and that’s no good. To top it off, I realized I wouldn’t be able to implement rocket jumps, and I reaaaaaaaaaally want rocket jumps. So after a fair amount of digging I came to the conclusion that I’ll have to build a new interface for moving all the characters around, both the player and the enemies. And that’s pretty much where I called it a day. I’ve spent the last couple hours trying to implement a basic physics set-up, something I’ve done before pretty easily, but for some reason or another I just couldn’t get it working. I think I’m a little burnt out; getting those rockets and explosions to work was no easy feat, so after that I think I just can’t math anymore today.

So that’s where we’re at at the moment. I livestreamed most all of it again today, so you can watch what you like over on Twitch. I’m hoping with a good night’s sleep and a fresh pair of eyes I’ll be able to get that character movement fixed in the morning, and then I should be damn near finished with the hardcore code. And from then on out it’s level design and visuals/audio. Who knows, if I’m lucky I might have a playable prototype I feel’s worth sharing tomorrow night. Fingers crossed!

7DFPS – DAY 1

Well, the first day of 7DFPS has come and not quite gone, so I figure it’s time for a big ol’ update. It’s been extremely productive as first days go, and so far I think the project is showing a good bit of progress already.

THE DESIGN DOCUMENT
The first item on the agenda was to create a design doc. Shockingly, this was my first time drafting one up, but with no point of reference I think I did quite well. It started as a sort of declaration of purpose, but then went off into outlining the games aesthetics, weapons, enemies, controls, and so on. Some might think writing up a design doc for a game jam game is silly, but I think, especially for a jam as long as 7DFPS, it’s an excellent idea. It gives me something to focus on and work towards, instead of just shooting in the dark to and hoping I hit something worthwhile. I also decided early on that I’d stop adding things to it by tomorrow night, and once that time hits I won’t allow myself to add any new features; it’s a way for me to prevent feature creep. I also decided I can remove items from the doc if I decide it was a bad idea, either due to time constraints or just not being any fun. If you’d like to read through the doc, you can find it here.

ENEMY AI
So once that was drafted up I started up Unity and began working on what I believed to be the most challenging aspect of the project: the enemy AI. A first-person-shooter with no enemy AI is, art games aside, rather dull. You want something that will instigate and make the player fight back, something that’ll come after them and attack. So I started cracking away at two basic behaviors: wandering around the environment and following the player if it sees them.

The wandering behavior was relatively easy to write up. I created a variable that holds a random point in space, and the enemy slowly turns and moves towards it. While it’s moving towards it’s imaginary target, a countdown timer is ticking away. Once the countdown reaches zero, it picks a new random target and begins moving towards that. There were a couple hiccups here, the big one being for some reason or another the enemy strafed around the object as it moved in, but a quick rewrite fixed it.

Tracking the player was slightly more challenging, but fortunately I’d been playing around with this a bit before. The basic idea is if the player falls within a certain field of view, the enemy would mark it as a target and come after it or attack it. I’m sure there’s a million ways to do this, but my solution was this:

  • There’s an empty with a sphere collider on it that’s a child of the enemy. This sphere is the view distance of the enemy, and is set to Trigger mode. When an object sets off the trigger, it’s immediately checked to see if it’s tagged with “Player” or another potential target tag.
  • If it is a potential target, it then checks to see if falls within the enemy’s Field of View. This is accomplished by checking the angle of the potential target relative to the transform.forward vector of the enemy. If it the value falls within the assigned field of view, the target is seen by the enemy.
  • There is one final check, in which the enemy casts a ray directly in front of itself to see if the target is visible or not. If the target is behind a wall or other obstacle, the first thing to come back from the check will be the obstacle and not the target, and therefore the enemy cannot see the target.

With this check in place, if an enemy sees the player it simply replaces the random imaginary target it was walking towards with the location of the player. If the player walks out of range of the enemy, or runs behind a wall, the enemy walks towards the last point at which it saw the player, and then picks a new imaginary target to walk towards. This gives the player the chance to run away if necessary and hide, and gives the enemy a chance to find the player and continue pursuit.

I did a few other tweaks after this, like finding a new target if the enemy is about to walk into a wall, but this is essentially the whole system. I tried running around a room with about twelve of these guys, and it was surprisingly fun, even in the barebones state it’s in.

WEAPONS AND HEALTH
The next big puzzle piece was how to handle weapons and health. I decided to make the health system an independent component that could be assigned to any object. It has a public variable for assigning it’s health value, and three public functions:

  • A damage function, that reduces the health value
  • A damagePoint function, that returns the position where the damage occurred (this might change to the point where the weapon was fired)
  • A function that returns true if damage has occurred

The damagePoint function is exceptionally nifty, because I can use it to give the enemy a chance to “feel” damage, and react in a semi-realistic way (by turning and attacking in the direction in which it was shot). The damage function, however, is utilized by the Weapon class. Weapons in my game are essentially all the same, much like any other shooter if you stop to think about it. In my project, they boil down to these basic elements:

  • Power, or how much damage it does
  • Range, or how far it can fire
  • Firing Rate, or how frequently the gun discharges while the trigger is held
  • Whether it fires a single or multiple shots
  • Accuracy
  • Whether it fires bullets (raycast) or projectiles (instatiated objects, like rockets)

So far the code only handles single-shot weapons (like a pistol or machine gun), but other weapons shouldn’t be too difficult to implement. I’m particularly excited to add rockets for rocket jumping.

WHAT’S NEXT
Well, I think tomorrow I’m going to complete the weapon code and try to create a few different enemies based on the template I built today. Once that’s in place I’ll work on the item system, which shouldn’t be too difficult (health pickups and weapon modifiers). Finally, I’ll craft up a basic modular level kit and build a stage to test out. After that, if everything works out well from there, it’ll be level design and polished assets the rest of the week! With a bit of work on menus, UI, and all that jazz. Exciting stuff!

If you want to check out any of the stuff I worked on today, hit up my Twitch channel. You’ll find all the day’s recordings there for your viewing pleasure.

On Livestreaming my 7DFPS Week: The What and the Why

While I’ve toyed with it a bit before, this is the first time I’m going to be (as far as I’m concerned) legitimately livestreaming me working on stuff. And I think that’s kinda scary. It’s a sensation comparable to stage fright, except instead of just worrying about your performance, you’ve also got to deal with showing everything that went into crafting said performance.

Now, that’s not to say I’m going to be out on stage leading a chorus line or something, but it’s still a little nerve-wracking to think about. I haven’t completed a game in well over a year, and I’m still learning the basics of Unity. With all that in mind, the stream is probably going to be a lot of me just trying, breaking, re-trying, and doing lots of very dumb things. Which isn’t exactly something a lot of people would probably want to watch.

So why am I streaming it in the first place? Well, because I think it’ll help me focus. If there are people watching what I’m doing, I’ll be more inclined to work harder towards both focusing on what I’m working and on things I need to learn in order to accomplish whatever it is I decide to make. If it’s just me by myself, odds are good I’ll get distracted and end up spending hours just surfing Twitter and Tumblr. If there’s someone watching though, they’re probably a tad more interested in my tinkering with interactive 3D stuff than animated gifs. Plus, the more I work on something and the better I get at it, the more fun I have with it. And I think that could be fun to watch too.

I guess what I’m trying to say is that I hope you get a chance to check out my livestreamed progress for 7DFPS, and while it’s probably not going to be pretty, it should at least be kinda interesting and cool. You’ll be able to get in on the action this Saturday by hitting up my Twitch channel; no idea what time I’ll be starting, but I’d say it’s a safe bet it’ll be before noon, and it’ll run till the next Saturday, with repeat broadcasts running while I sleep (yes, I do sleep).

Watch CLD on Twitch

Getting Pumped for 7DFPS!

This is the original post from my previously separate 7DFPS blog. Moved it here because running multiple blogs seemed like a bad idea after thinking about it for a bit.

So right now I’m slowly but surely preparing for the week that is 7DFPS (Seven-Day First Person Shooter), and one thing I thought would be worth making is a blog where I can post small bits and screens and things when necessary, and do a daily log of what I worked on/learned/failed at/etc. Just sort of a central hub for everything about my game. The first post will be this, explaining the blog and 7DFPS and such, and the last will be a link (or links) to the game.

So what is 7DFPS? Well, it’s a game jam that goes from August 10th to August 17th. Entrants have seven days to create a First Person Shooter. The only rule is it’s got to be a first person game, and you have to shoot stuff. And judging from previous entries, both of those things are interpreted somewhat loosely. But I don’t think I’ll be getting¬†too¬†experimental with the gameplay. I just want to make something where you run around and shoot stuff.

So that, in a nutshell, is what this whole thing is about. I’ll try to keep the posting relatively frequent but stick to things I think are interesting or big, with at least one post a day summing up what I got done and what I need to do. Please feel free to comment away as well on anything I post on here; if you’re taking the time to read and look at the posts, I’m gonna value most anything you’ve got to say about it, good or bad. Now, let’s get ready to make some games!

First

New site, new blog, new shenanigans. I got sick of the old layout; it was a little too complicated for what I was aiming to do, and with my poor web coding skills/lack of interest in web dev it made sense to ditch the crazy php stuff and just make a simple static page. Once I get a few more games up I’ll make a separate page just for that, but for now I think the one main page works out pretty well.

In other news, next week I’m gonna be participating in 7DFPS. Took a week off from work just to crank out a bitchin’ shooter. I’ve got a couple ideas and a sort of aesthetic I want to shoot for, and if I get the prototype working in the first couple days and it’s fun enough, I’ll probably keep working on it past the end of the jam to get it more polished and presentable. In any case, I made a dedicated blog for all that, which you can check out here: 7dfps.hellocld.com¬†Actually, forget that, that was dumb idea. I’ll just post stuff here and put the “finished” game on it’s own subdomain.

Lastly, if you haven’t checked out the Buffalo Game Space yet, you should! It’s what started out as a Google Group for local devs, and is now an actual physical space. It’s still a work in progress but we’re constantly moving forward. Hit up the website for more info, and if you’re a local dev/artist/musician yourself, be sure to join the forums and introduce yourself!