My brain makes things explode.
Posts tagged Games
ZuneHD – Virtual D-Pad Component for XNA 3.1
May 16th
Just finished working on a pretty basic virtual d-pad for the Zune HD/XNA Framework 3.1. It’s really rough around the edges, and certainly isn’t optimized, but it works.
Download
Source
DPadHD.dll (Managed Library)
Description
A simple, kind of messy virtual d-pad for your ZuneHD games. You can feel free to add it to your games, with or without crediting me, just don’t distribute the D-Pad or modifications of it without at least giving word that it came from me. It’ll need a fair bit of optimization and editing before it’s ready for any game that you wish to distribute, however.
Features
Position can be configured
Works similarly to the default XNA input systems
Built as an XNA DrawableGameComponent
Usage Sample
dPadManager = new Segfault.DPadHD.DPadManager(this); dPadManager.Landscape = true; this.Components.Add(dPadManager);
Creating the system is easy. First, you create it as you would any other component. You can set whether or not you want to use it in Landscape mode (which merely rotates the inputs counter-clockwise – I assume a “back-button-to-the-right” landscape view) by setting a simple boolean value, and then you add the D-Pad Manager to the components list. It will update automatically, just as the XNA input managers do by default.
Its position can be set on screen with the following code:
dPadManager.Position = new Vector2(50.0f, 12.0f);
And finally, the state of the D-Pad’s four cardinal direction buttons can be checked by retrieving the current game state:
if (this.dPadManager.GetState().IsButtonDown(Segfault.DPadHD.DPadButton.Up)) pos.X += (gameTime.ElapsedGameTime.Milliseconds); if (this.dPadManager.GetState().IsButtonDown(Segfault.DPadHD.DPadButton.Down)) pos.X -= (gameTime.ElapsedGameTime.Milliseconds); if(this.dPadManager.GetState().IsButtonDown(Segfault.DPadHD.DPadButton.Left)) pos.Y -= (gameTime.ElapsedGameTime.Milliseconds); if (this.dPadManager.GetState().IsButtonDown(Segfault.DPadHD.DPadButton.Right)) pos.Y += (gameTime.ElapsedGameTime.Milliseconds);
Enjoy. :D
C++/D3D Pong Maintenance: The Game Loop/Frame Delta
Mar 25th
Tutorial Description
While running the game/engine that we’ve been developing throughout this tutorial series, you may have noticed that the engine kind of runs… like crap. So, before moving onto the next tutorial in the series (the code for which is completed), which will cover keyboard and mouse input, I feel that it’s somewhat important to fix this. It’s just going to be some small updates to CGameEngine.cpp, so it won’t be hard.
Code Listing 1: CGameEngine.cpp -> CGameEngine::CGameEengine(void)
First, we’re going to correct an error with our game timer, which we never actually created an instance of in code – causing the GetRunTime feature to fail due to a member variable not being initialized (CGameTimer::_start). Replace the constructor for CGameEngine with the following, in CGameEngine.cpp
CGameEngine::CGameEngine(void)
: _windowHandle(NULL), _windowTitle(L"D3DPong"),
_screenWidth(640), _screenHeight(480), _colorDepth(32),
_gameRunning(true), _gameTimer(new CGameTimer())
{
}
Code Listing 2: CGameEngine.cpp -> CGameEngine::Update(void)
Our new Update method is much smaller than it was before. We’re still using fast-as-possible rendering and updating, so this isn’t going to fix the minor graphics tearing that you’ve no doubt noticed before this, but it is going to make things run a little better.
void CGameEngine::Update(void)
{
float delta = this->_gameTimer->GetRunTime();
GameUpdate(delta);
this->_gameTimer->Reset();
this->BeginRender();
GameRender(delta);
this->EndRender();
}
Nicer, cleaner, shorter. This was caused by a bit of an inconsistency and laziness on my part, but things should run a bit smoother now. In the next tutorial, we’re going to be adding input, and will put the beginning pieces of our game into effect. I’ll cover enabling VSync at a later point, because I’m too lazy to deal with it right now. It’ll probably be in another “Maintenance” mini-tutorial.
Expect Tutorial 4 soon!
Torque Game Builder/Box2D Integration
Feb 20th
I’ve been looking at Box2D a lot recently, mostly because Torque 2D (Torque Game Builder’s replacement) is going to be using it. It’s a damn good, and powerful, two-dimensional physics engine -- it’s what powered Crayon Physics, and several similar physics-oriented games. Box2D is a pretty beautiful thing, from what I’ve looked at, and it’s been ported to a lot of systems. Recently, I found a Torque Game Builder integration for it, and figured I’d look into it. Currently, it’s integrated into the Torque Game Builder editor, and still allows for the use of the standard TGB physics (you cannot have both Box2D and TGB physics on the same object, however). The system comes in the form of a class that needs to be set on the Scene itself, and behaviors that you add to objects. The system uses the object’s convex collision polygon, as well.
Video
Screenshots of the Pyramid Test
Stacked Pyramid
Tumbling Pyramid
TGB/Box2D Integration Links
Torque Game Builder 1.7.4
Box2D implementation
Aliens vs Predator
Feb 18th
Well, Aliens vs Predator was finally released two days ago, and I hadn’t noticed. Started downloading it the night it was released, rather than the day. Anyway, started playing it last night, and this morning, and I’m loving the game. The demo wasn’t all that great, I’ll admit, but that’s mostly because Free-For-All in the AVP setting is pointless. To really enjoy the game, you need a Team Free-For-All, with each team being one of the three races in-game (Xenomorph, Predator, or Human). Although I have to say, playing as a Human/Marine in the multi-player game modes is very masochistic. Think about it – as a human, you lack the badassery of the Predators, which includes vision modes specifically designed to help hunt humans and Xenomorphs (believe me, in the dark multi-player levels, Xenomorphs are hard as fuck to spot, harder yet to kill, and don’t even think about catching one if they decide to sprint away), you lack the cloaking, so you’re easy as hell to spot, no matter where you are (again, the Predators can spot all humans with one visor mode, and the Xenomorphs (aliens, for anybody who hasn’t figured that out yet) can track you by “scent” – which, in gameplay terms, is an outline showing where you are. Unlike the Predator’s visors, though, Xenomorphs can see you even through walls), and if you aren’t with a group of friends – well, count yourself among the dead. Because that’s really the only opportune time to kill either of the opposing races – if they start to take out one of your buddies.
Playing as the Xenomorphs, in multi-player especially, but single-player as well, can get disorienting fast. You see, Xenomorphs can run on walls, and can jump from one wall to another. And they’re fucking fast. If I, as a Xenomorph, get injured and need a quick escape, I hold my sprint key and just fucking run. There’s no way that either a Predator or a Human will be able to catch up to me – especially if I’m switching between walls, ceilings, and floor, and jumping from surface to surface. But, as I said, this has the disadvantage of being severely disorienting, however incredibly bad-ass it may be.
Playing as the Predators is amazingly fun, especially in the multi-player games. While you can be seen by humans when your cloak is engaged, they’re usually twitchy as hell and won’t spot you well in the shadows. Xenomorphs still have their scent-tracking thing, and will spot you just as well as they’d spot a human, but you’ve got auto-tracking, shoulder-mounted badassery in the form of a laser gun that is fast enough to track them, provided they don’t jump behind a wall or into a vent. You’ve also got proximity mines, and a few other useful tools, and no player will be too happy when, out of nowhere, in spite of their vigilance, they’re blasted from behind by a laser cannon from a creature they can barely play. But hey, if they’re masochistic enough to play as humans in multi-player, that’s their own damn fault. Who wants to play a pathetic human when you can play incredibly-advanced alien hunters (I guess that human’s aren’t the toughest prey anymore) or incredibly-deadly alien beasts, anyway?
In short, if you have the chance to buy it, whether it’s for PC (where I play), XBOX 360, or some other platform, I highly recommend it. If you do get it on PC, don’t be a puss – buy it over Steam, not at a store, and hit me up for a game.
Need to stop being lazy.
Feb 16th
Well, I’ve come to the conclusion that I need to stop being lazy and get some work done on the OS X port of Waxy’s Sushi Party. So, for the next couple of nights, I am going to start working my ass off to get an early prototype ready.
This means a lot of playing the game, taking notes, and fucking around with Torque Game Builder for me, and nightly development blog entries for the whole.. two or three of you who read my blog. Yeah, so, enjoy. >.>

