Sorry duders. Previous upload puzzles were pretty much straight up broken. I didn't have the time to play through them all and figure out which ones to fix so I basically didn't but I just coded a Picross solver that allowed me to quickly test and fix the puzzles so that they're all in working order. It also allowed me to properly implement the numbers on the sides so that they accurately represent whether or not you can figure out some spaces in a line or not using logic.
Here's the new link for anyone that's still interested =)
Hey duders! I fell deep into a Picross hole and I got to thinking "Man, this game is so damn simple that I could prolly write one up in no time!". And once that seed was planted, there was no escape -_-;;
After working on mouse selection on my main programming project for roughly 2 days straight, I needed a short break and this is what I came up with. I'd say start to finish it was about 4 hours and I'm pretty happy with how it turned out.
Added some more puzzles and the XNA 4.0 Redistributable into the install folder for ppl who don't have it installed yet.
If you have a previous version, you must uninstall before installing the new one!
left click = clear or unclear a block.
middle click = place a question mark for marking fun.
right click = assign an X.
The real beauty of this program is that the puzzles are set by way of feeding it a .png file. It'll read the file and then generate the correct size puzzle. So to add a new puzzle, I just need to drop in another black and white image for the placement of the pieces and a color image for the one that appears on the right side. Since I've got a whole collection of pixel art, when I have a little time I'll build out a front end so that players can select different puzzles. Also. . . sound. and music. And like, an ending. -_-;;
The last update I made was with inventory windows and since then I've been churnin away but haven't been properly updating. Since I'm also not really keeping good track of my progress aside from these blogs, I'm a bit lost as to what I've changed exactly since the last update so I'll just cover the things I can remember off the top of my head and on the video.
Minor Level Edit Stuff
Just a couple functionality improvements allowing common settings to be changed with the keyboard instead of the mouse. Stuff like moving things around before/after installing them and flipping things w/out mousing the options on the right. I think I'll also add in flipping of the floor tiles and possibly group together tiles that have more than one side for easy level editing as well. That's sorta low on my list of things to do currently tho -_-;;
Continued Work on the Inventory Windows
I've reworked the way windows work in that they will now all stay opaque until something off window is selected. Window focus is also no longer dependent only on where the mouse cursor hovers as instant switching between the various windows was a bit disorienting. Again, it's the small things that really seem to matter once the broad strokes are in and it never fails to surprise me how goddamn minute the details you have to pay attention to are. Also, after years of using windows, there are little things that if wrong, will bug the hell out of you and sometimes you won't really even know why.
I've also made some changes to disallow the in game mouse cursor from leaving the game screen area to prevent movement of windows off screen which make them irrecoverable. I've also put in some methods that prevent windows from being created off screen so if you do somehow move a window fully off screen, closing and reopening them will bring them back into focus. Also, when you have a window in focus, if the item that the window belongs to is on screen anywhere, it will be highlighted so that the player can keep track of which window belongs to which item visually. This highlighting also occurs with world objects when you inspect their contents.
The way the player interacts with the world is now with a wheel of sorts. If you've ever played the Sims, then you should know how this thing functions. Every interactable object will have a set of options that the player can choose from that will appear in a circle. When an object is being interacted with, it will be highlighted to indicate that the action wheel belongs to that item/world object. These actions are set by the items and run checks against the player to determine what is available. So for instance, if you're at a door, depending on whether you're on the inside or outside, your available options will change. The game will also take into account what items you currently have equipped and adjust accordingly. In the video, when the player equips a lock pick, the option to pick a locked door becomes available. It's still somewhat clunky and I'll keep workin on it but for now, it serves its function so I can worry about the aesthetics of it later =P
I've revamped a lot of what's going on behind the scenes with mouse selection. The biggest change is that you can once again select walls. Later on when I add better inspect options/windows it'll be more apparent why this is necessary. I do currently have some issues with mouse click vision and click movement when it comes to the movement being based on moving towards whatever item is selected. I'll prolly have to pull that out into its own thing to make it work naturally rather than getting all mixed up in areas where there are multiple doors and lots of objects all around. I could force the player to use the keyboard for movements, but I'd rather give them the option to use the mouse. Maybe once I get in pathfinding and allow the player to "move to" a specific location rather than take it step by step, it'll make the problem moot.
There's a bunch of other things I've done that I can't really show since it's engine stuff. I've reimplemented the culling to try and reduce the draw batch sizes as when I profiled, it looked like the draw calls on everything in game was really eating up resources. It's still a bit rough but its functional for now. I've also decided to stop trying to completely lock down a system before moving onto the next. I think I work better and more efficiently when I do broad implementations and then refine them over time with everything else. I've made a ton of changes to a lot of classes that just made everything run more smoothly and make more sense. Also, I've been using Interfaces a lot more than I had previously and it's really helping out a lot.
I'm gonna try to build up the player's inventory more so that I can get a feel for how scavenging and looting really feels. The two slots you see now are basically hands which can hold any type of item but I've already got things in place that will specify what type of item can be slotted into the player's physical inventory. Currently, it's two shoulders (bags, slings, holsters), waist (belts and equipment type stuff), back (back pack) and slots for clothing top, bottom and shoes. I'll have to design hud elements before being able to use em but I think I'm going to just do a quick and dirty one to get it working and then make it look pretty later on. Following that, I'll start working on the crafting system that allows the player to combine and build various items and world objects. I've got a couple sketches of what I think should work, but I'm not sure it'll work for everything yet so I'm going to have to do a little more research before I really start coding that stuff in.
Truth time. As crazy into the gaming culture as I am, nobody else around me is. That being the case, the Giant Bomb crew and this community here is my primary outlet for all things gaming. Nobody gets references to things like Itagaki and his damn shades, how crazy it is that one of the Bioware doctors is on a global beer quest or that Reggie's body is ready but I love that shit. You know who else loves that shit? You guys and gals and even more so, the bomb crew.
Watching quick looks and listening to bombcasts over the years, I've grown close to these guys and have a sort of one-way friendship with them all (as many of us do). They don't know me, but I feel like I know them. . . which sounds super weird to write. If you take into account the various side projects I've done where they were the focus, you'd think I was some sorta creepy stalker. . . Hell, I've even sent them a care package once from Korea and it was opened on a mailbag and that they got some measure of enjoyment was eerily life affirming.
I fucking miss Ryan Davis. It's goddamn crazy. I didn't realize how huge an impact he had on my life until now and it's freaking insane. Even though I only knew him through a very tiny window, he was such an amazing person that it was all he needed to impact me in a huge way. I can only imagine what those who were actually close to him must be feeling. I hope that his family and friends can find some comfort in knowing that we, all of us out on the other side of the window, intimately understand how amazing this gentleman was, and how huge a loss it is for him to be gone.
I've been working on building a game for quite some time now and have been periodically posting blog updates on my progress. This one is specifically about inventory. The first half is about my thought process and how I decided to use the system I'm using and the second half is about building the actual system into my game.
Inventory In Games
I've spent on and off quite a bit of time determining what type of inventory I wanted to use in my game. This all came to head this last week and half as I began building out the inventory systems in earnest. Here's the thought process I went through to determine what type of system I wanted to build and use.
Games that throw any sort of inventory management out the window fall into this category. This system is most prevalent in RPGs and single player games that are loot and equipment driven and more common in games that have you controlling a party of characters. Games that strive for some amount of realism, while still allowing the player to loot usually apply an arbitrary weight limit based on the player's strength punished by encumbrance. I considered it briefly but decided that if I were to make this concession, the game would be drastically different in play than the one I envisioned. This type of inventory is by no means a bad thing and I actually would have it no other way in the majority of games I play but it has a time and a place. Neither of which is my game -_-;;
Slot inventory is the type that is found in most multiplayer loot driven games. This includes Diablo type games and most MMORPGs. The basics are that you have a limited number of spots, but each spot is of an infinite size and can hold any size item. While this system does effectively limit the amount of inventory space a player has, I don't like the idea that a large item would take up the same amount of space as a middle sized item. Or more importantly, that small items may take up as much space as a medium/large sized item. You can commonly stack a number of smaller items into a single slot, but the problem is still there in that when the slot has only one small item, it takes up as much space as when the slot holds 10 of the same item. Something about that just rubs me the wrong way. I feel like this type of inventory serves a lot of gameplay purposes but they don't fit what I'm looking for.
This lead me to consider a type of inventory that was made famous (at least in my mind) by the grand daddy of realistic strategy games, X-Com. This is basically a slot system where larger items take up more slots and must be manipulated to fit along with other items that are in your inventory. This system alleviates some of the size discrepancy problems I have with the basic slot inventory system, but it's more of a band-aid than a real fix. In most games that use this style of inventory, items are picked up individually and placed into the single set of slots the player has as inventory. Since placing objects into the environment will play a large role along with various objects having various amounts of space, that would mean that I'd have to set up specifically sized boxes for every container in the game. A bit much for me alone -_-;;
Volume Based Inventory
Excluding these other routes lead me to the system I've decided to use which is a volume based inventory. What this boils down to is that every carry-able item in the game will have a volume as well as a weight and every container a volume capacity. This means that the space taken up by objects will always be the proper amount of space. This would allow for containers themselves to be stored within other containers properly. For instance, if a bag's capacity is 10 and its volume is 2 and it is stuffed with 5 volume worth of items, its volume is now 7 and can fit within another bag that has a volume of 7 or more. The weight of the items being carried would be the total of all items involved. As far as I know, I've never seen this type of system before and am wondering if there's some crazy flaw with it that I just haven't thought of yet. If you can point one out, go ahead and let me know =)
Building the Interface
So, now that I know what I want, I need to build it. The first thing I needed to determine was what type of item display I wanted. The easiest way would be to have a fully text based system where the inventory would be displayed in a text list format. . . but damn that's boring -_-;; Every game I've ever played where I spent any time with inventory in an engaging way had visually represented items and equipment and I think it important that I do the same. Especially in a game where the things you decide to carry (and leave behind) will be critical. So I'm going the way of the most common type of visual inventory which is slot based. I have no need for a tetris like arrangement since the capacity will be controlled by volume and since the space available will not be represented by the number of slots, the number of slots in every container needs to be infinite (or at least, as many as is needed). Now begins the coding and arting to put into play the systems I need.
What goes into an inventory display?
When you dig into actually building a window, you begin to realize that there are a ton of little pieces that make up even the simplest of windows. Apart from working within the engine of my game, I had to separate all the little bits of functionality that I wanted and put it all together from scratch. Here's a list of the initial things I wanted possible with this window.
Scaling, virtually infinite number of item slots.
Re-sizing of the window.
Move the window around the screen.
Collapse the window into a smaller footprint while being able to display pertinent info.
Scaling of the size of the window to a larger and smaller size.
Sorting by name, volume and weight.
Scrolling up and down.
And the resulting window.
I accomplished most of my goals but the way the player interacted with the window was troublesome and some of the functionality was hidden from the player.
In the second pass, I tried to make it more obvious that the player could collapse the window and change the scale by adding more iconography. Now the player can still double click the title bar to collapse the window, but there is an additional minimize/maximize button where most windows users would expect it to be. Also, collapsing the window could now be accomplished simply by resizing the window to collapse instead of needing to use the button. I also added a Volume percentage to the status bar on bottom along with a weight reading. The volume is shown as a percentage since the volume figures themselves may potentially be pretty large. It's also somewhat transparent now.
Now with those features in place, I added the window scroll bar to the right. Whilst building this out, I discovered way more about scroll bars than I thought I'd need and learned some things that are obvious now that I know them. For instance, the bar itself represents the vertical window you are looking at while the length of the track represents the total vertical space that it is possible to view. So that's why when you increase the size of a window, the bar grows with it and visa versa.
At this point, it became necessary to build tool tips. Partly to show the functionality of buttons when hovered over but mostly to display information about the items within the inventory.I changed some of the visual styling of the inventory and set it up so that if you hit minimize, it saves the state of the window (rows and columns) prior to the resize to open back up to the same state it was in previously. It's this level of detail you have to get into when building anything because if you don't put it in, the game won't know what to do =P
Beware of Thursday Night Throwdown music on this one -_-;; oops.
I added an increase in transparency when the window is not the current focus. Since this video I added a timer to allow a grace period for when the cursor is not on the inventory window before the fading starts. I'm considering having the window keep focus until the player clicks elsewhere but I'll decide on that once the game is up and fully running to see how that'd effect the flow of gameplay. I've also implemented item rearrangement and the scrolling to work when the player is holding an item over either the title or status bars or above/below the scroll bar to allow the player to navigate the inventory window without the use of left click.
Conclusion for now
So this is where I'm currently at. Figured this'd be a good point to take a breather and put together a blog post about it =P I've still got plenty of edits to make including the stacking of small items and some level of color coding in the actual inventory window that may indicate the individual item's state. As always, please feel free to comment and criticize =) I welcome any thoughts on how I can improve things or change things for the better. I'm also open to any sort of discussion on inventory since it's been on the forefront of my mind as of late.
I fell into an audio hole a few years back where all of a sudden, the sound coming out of my PC became important enough to me that I went and splurged on a nice dedicated sound card for my PC + a nice pair of cans to listen to them through. I also really love surround sound, and while I've got a setup for my TV, I didn't have anything for my PC but the virtualized surround stuff which has never really worked for me. That being the case, I recently studied up on and bought a pair of Surround Headphones that don't just virtualize the surround sound but instead has a bunch of separate drivers in each ear cup pumping out the sound. Figured I'd do a little write up in case anyone was interested in my thoughts =P
These are the pieces of hardware that I currently have hooked up to my PC and that I will be going over in brief detail.
I don't understand a lot of the jargon that goes into sound quality and whatnot, but I did my research and boiled it down to two cards. I don't remember what the other one was, but this one won out even though it was pretty damn pricey for straight up audio. As soon as I plugged it in, there was a noticeable jump in the quality of the sound coming out of even my default speakers. Though, not a $200 jump -_-;; Still, the hardware came along with a really robust piece of software to control the audio and over the years, I think it was a worthwhile purchase. Especially if I was going to be using better quality speaker components. Supposedly the virtual surround sound that this card puts out is really good, but for whatever reason, those features have never been compatible with my ears. The back of the card has a red/white component output, a fat jack headphone and mic output/input and a single optical out. While it was more than sufficient for the hook ups I was going to use at the time of purchase, not having the standard PC 6 jack sound outputs bit me in the ass once I get the Razer Tiamat since that thing only plugs into multiple jacks instead of a single optical to power its surround.
The audio quality jump you get with this sound card is only significant if you're using high quality speakers/headphones. If you're not upgrading both, I'd recommend you go with the speakers/headphones but if you've got a nice pair, then the card is worth considering.
Astro Gaming Wireless MixAmp 5.8
These were produced mostly for Console gaming but I picked them up to have a wireless solution to the optical out on my soundcard. They also provide the simulated surround that's all the rage but again, doesn't work for me. The wireless on the other hand is really nice. There is very little static (not noticeable unless there is zero other sound and even then, low) and the battery life is very good. I typically need to charge it only once a week or so. The main draw of this unit though was that they work with any pair of headphones you plug into them and aren't limited to a single headset that's paired with the broadcasting end. The dual benefit of using these is that I can also carry the receiver to the couch when I play PC games on the TV. In these situations, having a volume knob right next to me is also very useful. Unfortunately, this model has been discontinued and the ones you can find seem to be going for higher than the original MSRP.
If you want wireless sound, these are a great purchase. The static is very low, latency unnoticeable (cept for maybe sound based timing games) and most importantly, they work with ANY pair of headphones. A major plus since most wireless headsets tend to try to bring the price of the overall package down by using less than awesome headset components.
Grado SR 225i Headphones
Those incredibly weird, oldschool looking pair of headphones on the right are the cleanest sounding headphones I've ever used. After lurking around on a bunch of audiophile boards, I settled on picking up a pair of these as they were always talked about with high regard. They are basically the best sound you'll get for your buck prior to jumping into things that are $300+ and while I was very interested in nice sound, I'm not completely insane! The sound produced by these are a jump above every other pair of headphones I've ever used. They are open in the back which means that I can still be aware of my surroundings but also means that the sound pumping into my ears will also bleed out so if you want isolation and to not bother anyone nearby with your games/music then these are prolly not for you. Another factor you'd have to take into account is that the bass on these are nice, but definitely not booming. I feel like they're at the correct levels, but some people just love feeling a deep rumble and this doesn't provide that. Pretty much, these offer a very clean and clinical sound so if that's what you're looking for, look no further. They do have a few faults though. I'd say my ears started to feel a bit sore after having these on for around 5+ hours and the cable is super thick (which I suppose might be a good thing) so you won't be wearing these around the house and especially not out for a jog.
These are freaking fantastic. Unless you're someone who highly values THUMPIN' BASS, these will not do you wrong. Everything just sounds accurate and I'd guess you can't get better sound for this price.
Sennheiser Momentum Over-Ear
As much as I love my Grados, I ended up needing a pair of headphones that are closed so that I can listen to my music and whatnot without bothering everyone around me. Also, due to the bleeding sound it was impossible to use those in any sort of public setting without bothering the hell out of everyone around me. I went on the hunt for a nice pair of over-ear headphones that were light weight and also worked with my iPhone and I came upon these. The closed back really gives the sound a different feel from Grados. The sound is very nice and warm with a thicker bass than the Grados but it doesn't sound aggressively bassy. It blocks out sound from the outside world and does a solid job at keeping sounds from bleeding out as well. I also dig how they look so that's a bonus. They're comfortable to wear for extended periods of listening and work very well with iOS devices. They also come with two separate cables, one with and one without the 3 button iOS dongle so if you're not using them on an iPod or iPhone you won't be carrying the extra weight.
They are a bit expensive being right at the $300 mark but they really sound amazing. Compared to the other headphones I listened to while shopping around, these just sounded the most right. I really appreciate how light they are as well though they don't fold over for easy transport.
Razer Tiamat Elite 7.1
So, finally tired of not having surround sound on my PC, I started digging into non simulated surround sound in a headset and decided to try these things out. Now, before I start to tell you about these, I have to explain that my super sound card doesn't support the type of connections this headset requires. That being the case, I'm currently using them plugged into my RealTec HD Onboard sound -_-;;
The first thing I noticed when I put these on, were how goddamn comfortable they were on my head. I've gone through a number of PC headsets over the years and compared to my previous experiences, this felt like jumping into a nice, soft leather couch. My somewhat large ears were incredibly comfortable inside the cups and the padding on my head also felt great. I have yet to experience any discomfort or pain from wearing these, which is a good sign. Another cool little thing is that the mic actually can be pushed into the earpiece in its entirety. I'm fine with headsets where you can angle them vertically but having them entirely out of the way when not in use is nice since they can never get caught on anything and I don't have to see it in my periphery vision. The little control dial is also sleek and easy to use.
Now, onto the most important thing about this thing. The goddamn surround sound. It works, and it works well. I've got a 5.1 set up for my TV and while it's not THAT good, I can easily tell when a sound is behind, to the side or in front of me, which is amazing for a comfortable headset. Years ago, I had another pair of real surround headsets that were put out by a company called Tritton that were equally excellent except that they were heavy as hell and would actually cause my neck to hurt after a few hours. There isn't much else to say about the surround other than it works so moving on.
The sound quality on these are somewhat disappointing. Compared to the Grado, there is an instantly noticeable drop in audio quality. That is a bit of an unfair compassion to make though considering that the Grados cost more and only have to power two drivers instead of the 10 drivers that are packed into the Razor's. And I'm not saying that the sound quality is BAD by any means. Movies and games sound fine, just not great. The bass in these headphones are also much thumpier (legit term) than the Grado which is sorta what you want for gaming. Also, I have to point out that when I plug them into my dedicated sound card, they sound better (though still not in the same league as the grado) so the onboard sound card is also partly to blame.
These do what they advertise in that you get actual surround sound in a headset. It has nice features, is super comfy and in my opinion, looks pretty damn cool. That being said, the sound quality is average which is actually an impressive feat if you consider that there are 10 drivers packed in. If simulated surround works for you, I'd stick with a headset that produces better sound but if you're like me, these'll get the job done admirably.
S4i and HF3
These two I'm putting in here as a side thing for anyone with an iPhone or an iPod. Both these headsets are made specifically for an iOS device and have the appropriate controller with volume up, down and middle click buttons + a mic. They are both in-ear which is the only way to have great sound for headphones IMO.
I'll start with the S4i. These were my first pair of non stock iOS headphones and they were really awesome. The bass was deep and sound quality very good. The controls are located at the point where the two sides combine into one. The location is perfectly fine and was only bothersome when I was at the gym as they're right where the barbell comes down on my chest so I'd have to move them up over by my shoulder. For the price, pretty freaking awesome though they're not the best -_-;;
Now here are the best goddamn earphones I've ever used, iOS or not. These are like the headphone equivalent of the Grados. The bass isn't as deep and instead they just sound accurate. The sound at every other range is incredibly crisp and you can hear every individual instrument as if they are separate instruments instead of just part of a larger sound. It's hard to explain but if you hear them, you'll understand. One of the nubs that you can use are these foamy tips that you squish then stick into your earhole at which point, they expand back out forming a tight seal. I have sort of strange shaped ear holes so I always had a bit of sound leakage nomatter what size nubs I used to use but these foamy tips lock in all the sound perfectly. These are the pair I recommend to my friends (the ones willing to drop some pretty hefty cast) when they ask what headphones I recommend.
I fully endorse both pairs. The Klipsch ones are perfectly fine and sound better than the stock iOS white buds and come at a relatively cheap price while the Etymotics deliver better sound that most full size headphones I've tried. They're a tad bit expensive but I've seen sales where they've dropped to right around $100 and they also carry slightly cheaper models though I've never listened to them so I can't say whether or not I like em =P
If anyone has anything else to add or other headphones/headsets/soundcards they like, please add em! =)
Boiled down real short and sweet, the lighting engine.
Light and it's importance
For the type of game I'm making, exploration and indoor environments will play a huge role. When indoors, something that most games don't seem to really get right is lighting (and doors right =P). More specifically, natural lighting. Almost every game I've played, when you're indoors, you seem to always be able to see. I understand that not being able to see would really make most games stupid and unfun but try going into a room with no windows and turning off the lights. . . there is ZERO effing light =P So say you're in a situation where electricity is no longer around, and you're rummaging through a house, light management is going to be something that you want to pay attention to.
This video should show off a little better what I'm talking about. At the end, I'm simulating a bit of what it'd be like to explore by switching everything to undiscovered. Thinking about it, I should prolly have done a second walk through during night time to show the difference since things are really bright during the daytime =P I'll annotate it to clarify a few things when I can.
Natural light specifically
Flashlights and other portable light sources will play an equally important role, but the focus of this update is natural light. I'm no lightologist, but I've been doing some research into how light from the sun and outdoors enters into an area and I think I've got a reasonable grasp on it. The most important thing (I feel) about sunlight is that is scatters everywhere and so it comes in through an opening in all directions. Once it's inside, it also bounces around in all directions allowing it to light around corners and such. There's a word for the type of light that is, but I forget it at the moment -_-;; I wanted to build an engine that takes into account the way that natural light disperses through an area and I think I've gotten fairly close to what I want.
Improvements left to make
The first and foremost is the day night cycle. I've already got one, but specifically, I want the light to enter at different intensities depending on where the sun is located at a specific time of day. So, for instance, during the first half of the day, windows that are facing east should get more light than windows that are facing west, and then swap after mid day. I've got the hooks in place so hopefully I'll be able to knock that out in a couple days. I also need the light to travel up and down to different floor levels. So say a window on the second floor can light down a staircase and into the first floor. That's gonna be a bit more difficult, but I don't think it'll be too hard. Lastly, the dispersion of light is a bit rough, and I'd like to smooth it out a bit more. I'll have to tweak some of the numbers but I think I should be able to get that too.
I'll post up another blog once I get something more worth showing done. I don't think I've put up an update that's specifically about the changes I've made to the way player vision works so maybe next week or so I'll put up something having to do with that. The short version is that the player can now look up and down, and will need to do so to look at things above or below. Please feel free to leave comments, ask questions or just tell me how shitty everything is =D
Thanks to @nonused , Brad's got a few different hit sounds now and also a shout during selection.
You can get the new version here. Version 1.21 Download. Remember that you need to uninstall the previous version before this one will install.
I'm still in the market for a jumping, landing and firing weapon noise as well as a catchy selection thing or any other interesting sounds that Ryan may have made. I'll normalize the volumes of the sound effects once they're all in.
Also considering making Brad's explosions deflect bullets. Either that or be destructible.
Hey duders, a while back I did a game jam and made a stupid little MegaMan X GiantBomb crossover game. I did a poll afterwards to determine which Bombadeer I should create next. It was Vinny -_-;;
Now, from time to time when I have the time, I've been building him out. I've actually got a couple ridiculous twists to his fight, but they're a bit complicated so they're gonna take a while to actually implement the way I want it to work. . .
In the meanwhile, just last night, I had this stupid thought about what a Safety Brad boss fight should be like. . . and I just whipped something up real quick. He doesn't have his own level, and most importantly, I'm missing sound bytes. So I'm callin out to the duder community.
How can you help!?
If anyone could go through some old podcasts/quicklooks/breaking brads and rip out some wav files of Brad cursing or any other bytes that would be appropriately funny for his jumping, landing, dying sound effects and send them my way, it'd be a huge help. I'll go ahead and throw em in and put up some credit for you somewhere. That's it!
So anyway, here's a link to a version of the game that has Brad soundlessly implemented. Knock yourselves out =)
A point in polygon check is exactly what it sounds like. It's a check to determine whether or not a point lies inside or outside of a given polygon on a 2D plane. These types of checks are fairly common in video games and especially so when dealing with rectangles and circles. A very easy example would be your mouse cursor over any type of interface. Your mouse pointer has a coordinate, and that coordinate is typically being checked against a bunch of polygons (though usually in interfaces they're just rectangles and circles. . . more on that later) to determine whether the cursor should change shape and what should happen when any buttons are depressed.
What up with Rectangles and Circles?
Checking a point against a rectangle or a circle is super easy peasy. For a circle, all you need is the center point of the circle and its radius. You check if the distance between the center point and the point you're checking is greater than the radius of the circle and if it is, not inside. Otherwise. Inside. Done. For a rectangle it's also pretty damn easy in that you just check if the point is within the left and right sides (x) and also within the top and bottom (y) of the rectangle and you're done.
Once you have to start checking against irregular shapes, things get a bit more complicated but not to worry because there's plenty of resourcesonline. The type of check that would work best for your needs depends highly on your specific needs. A small list of the types of things that could determine which methods might work best for you include things such as:
1. Which is more important, speed or accuracy.
2. Whether you're working with floating point numbers or integers.
3. If all your polygons are concave.
4. Whether your polygons have holes in them.
5. The number of polygons you need to check against.
6. The number of points you need to check.
7. Whether or not you will be breaking your complex polygons down into triangles.
There are plenty more factors which should determine what methods you use in your game/program.
Popular methods include
Hmm. . . I was going to write up a bunch of methods, but really. . . it's mostly just math. In most cases involving non-convex, complicated polygons, you'll probably use some form of ray-casting to determine whether your point is inside or not. That's a method where the point in question has a line drawn through it and the number of borders in the polygon is counted to determine whether it is inside (odd) or outside (even) the polygon. There are some issues with this method with the largest being floating point precision issues.
Floating point what now?
This can get super technical and you can find endless reading material on it just by searching Google for "floating point precision".
The super watered down, I don't give a shit about math version is that programming uses different types of containers for numbers. The higher the accuracy of a number you want, the larger the container needs to be. A bit can be a 1 or a 0. A byte can be between 0 through 255. An int can hold -32,768 ~ 32,768 etc. For the calculations that are required when working with decimals and fractions (which we are for point in poly tests with non-rectangular shapes) you use floats and floats are squirrely bastards. They can hold up to 7 digits with a decimal point within somewhere which gives you a pretty damn good range but when you go over that (as you generally do when working with crazy fractions), the numbers can sorta shift around. So, when you do some math one time, you may get 1.234567 but you do the exact same problem later and you could end up with 1.234568 or 1.234566 or seemingly any damn random number filling that last spot that floats can't go beyond. So even though it's a small as all hell error, that tiny amount could mean the difference between a point being in a polygon and not. Soooo. . . if you need to be uber accurate, it could cause issues.
Why. . . Why all this?
I originally just wanted to post about some progress I made today with my game. I had spent around 2 and a half to 3 months working on the vision portion of my game engine to accurately simulate line of sight in a 2D isometric world and after trying a bunch of things, I found that the best way to do it would be to create polygons for in world objects/walls/floors/etc and then test points to see whether things are seen or not against those polygons. Now, the way I'm doing it is different from other 2D games with line of sight in that I didn't just want horizontal line of sight, but vertical as well because it's isometric with multiple vertical floors. Anyway, basically I went from this
During a vision check, it would take almost half a second to finish because I was running over 3 million point in poly checks against 6,539 polygons. I set up the test to take place in manufactured situation that the player probably wouldn't encounter but they might and I'd rather the game not chug if they do. When I first plugged in the debug methods to check exactly how many times it was running the point in poly check, and more importantly, how many of them were hits rather than misses, I was pretty shocked. Less than 0.01% of the checks were returning as hits meaning that 99.99% of the checks were fails. . . I had already set up the method to cull out any polygons that they were nowhere near but I had to do more. What I ended up doing was increasing the fidelity of the array that was populated by the polygons which increased the number of polygons added to arrays from 11,116 to 92,322 but the trade off was close to 3 million point in poly checks. Also, the time it takes to run the method dropped by around 85%. So barring any memory issues, I think I'm on the right track =)
Oh, and the new hit count is around 21% which isn't bad at all in my opinion. I'm fairly decent at FPS games and my hit rate is rarely that high. I mean, because that's what I should be comparing it to right? -_-;;.
So yea, that's it
My quick status update of "Totally reduced the amount of time it takes to run a function today" into this mess. So I'll pretty much end this blog with a big ol "Fuck floating point precision errors!"