Asides being a bit sick (thank you for passing the fever, girlfriend) in this stupid country where our summer days are filled with gray rainy clouds for 4 years in a row, last week’s programming was mainly focused on.... excited already? Real-time Global Illumination? Monster Inverse Kinematic animations? Superfast path-finding algorithms? Particle Accelerators?... Better, I programmed how to pick up an object! An old fashioned chipcard-key, to be exact. Spectacular. But don't think this was a five minute job, no no. If you programmed games, or red this blog before, you know that seemingly simple things often Have a whole lot more going on under the hood.
But wait a minute, didn't the "Minecraft" guy in the first T22 demo already pick up an hourglass or something? Yep, but don't forget pretty much the entire game-logic code has been replaced with state-machines and custom modules per object in the meanwhile. So, that code became obsolete, and ever since we didn't pick up flashlights or hourglasses again. But since Demo3 shall show some actual gameplay again, and collecting items is one of those basal game-mechanics... Mario picks up mushrooms, Doom Spacemarine grabs ammunition, Guybrush Threepwood collects all kind of crazy stuff, even damn Pacman already collected orbs. Or something. So, about time to fix this feature again. Including a real inventory screen, though we still need someone to draw the UI for that. Maybe our drawer Pablo knows a girl, but we'll have to wait till she finished her holidays and answers. Making this UI is pretty important though, because I program nothing without having good-to-look-at materials to work with. I'm not talking about that girl, I mean it requires textures, 3D objects, maps, sound or screen menu's to trigger my programming sparkles. Working with temporary “dummies” is like making a cardboard Gameboy for yourself as you can’t effort a real one.
Yet, the ugly "Pick-up" symbol is a dummy so far. Waiting to get it replaced with something good.
Picking up an object sounds like a pretty simple feature to program, and well, it is. But it's not just about "picking up X". It's about interaction with other (living) entities in the game-world in general. A keycard can be "picked up", a lever can be "pulled", an interesting thing can be "examined", a toilet can be "flushed", a guy can be "talked" to, or "smacked in the face" if it was a badguy. Just think about all the available actions you often see popping up in the screen in nowadays screens. These are “context-sensitive”. Stand near a door, and your player gets the ability to open it. The available action depends on:
- Where does the player stand? Where is he looking at?Questions, questions. And a billion different answers. In other words, "Picking up" is just one of the many interactions the player could have with an item. And how about the way it happens? Doom Spacemarine picked up ammo and chainsaws automatically with his toes when walking over. Guybrush Threepwood had to click an item, then click an action like "look" or "eat". And the (lazy & easy) modern way is to show a button symbol + available action when standing in the right position. Anyhow, there are many ways to interact, especially in a puzzle-like game as T22 where things shouldn’t always be too easy.
- Is the player able to interact right now (depends on state/pose)?
- What kind of actions does the target-item offer? A brick probably offers different possibilities than a sexdoll or Enigma computer.
- Is the player allowed to perform action X? Does he have the keys / abilities, or triggered another event?
But instead of programming each possible action on its own, a more universal system should be programmed. And that's what I did. As explained a few times before, each object in the engine uses a DLL module that "controls" it. Physics, AI, sounds, how it responses on collisions, bullets, et cetera. And so a couple of interaction functions were added as well. Basically, it works like this:
Notice that this is the "normal way". Special objects may require different handling to get interfaced with, or automatically trigger something when approaching it (stepping on a landmine for example). Also notice that not each and every object requires its own specially coded DLL. Most "decorative" or "junk" objects use the same DLL. All doors or all key-like objects could share a single DLL as well, and so on. Each entity in the game has a list of custom properties that can be used to give some parameters. In case of “picking up”, we could tell the id-name of an item, it’s quantity, if it should be removed when being picked up, et cetera.
The last step in the figure is the actual event(s) happening when the operator(player) performs a certain action on item X. Of course, the actual actions again depend on whatever was programmed in that item DLL. It can vary from picking up something to deleting all files in the c:\windows\ folder. And sure, it doesn't have to stop there. There is a constant "ping-pong" between the operator(you or other guys with A.I.) and useable items, being hold together by the engine. For now, this Chipcard just disappears and adds itself to the player inventory. And from there on you should be able to examine it, and, maybe use it. On a door. Or... use your imagination. But we're not that far yet. Let's hope someone can draw a nice inventory first.
I needddddd thisss gameee! fucking epic, congratulations from spain!
ReplyDeleteof course, i want to make a horror gameplay in my channel when the game are in "open beta" or released. Sorry my english, and, congratulations, should be epic :)
Dani_kezu@hotmail.com - Personal hotmail.
gameplays4kers - Youtube channel.
If picking up that chipcard in the picture above is epic enough for a game, then you have a game. Otherwise you'll have to wait a bit longer I'm afraid :) Seriously, we're still far away from a finished & playable product. But muchas gracias for the kind words!
ReplyDelete