Showing posts with label xna. Show all posts
Showing posts with label xna. Show all posts

Thursday, September 28, 2006

XNA Shmup Update

More progress as of late on the xna based shmup concept. All of the gameplay mentioned in the previous post has been implemented. Some of it is not quite 'fun' yet. The attack pod makes things entirely too one-sided and most of the weapons need to be tweaked.

Before ragging on the game any more I've gotten a bunch of neat things working. There's a few big things that currently don't exist in the XNA beta that will bite you as soon as you start to scratch the surface of the framework:
  • No support for model loading or animation
  • No support for fonts or UI
So I was pretty much okay with both of these not being there in the beta and just waiting for them to show up in a final version. Well the first thing I stumbled upon was the ZiggyWare XNA font generator and associated rendering code. This was super easy to throw into the code, it took me less than an hour to get the fonts support into the scene graph.

I then spent another hour and wrote a very small but usable UI/menuing system. When the debug camera is not enabled the left trigger brings up the menu. You use the DPAD to navigate the menu (A button also opens submenus). Certain items can have 'tweakables' attached to them which can be either a float, vector3 or vector4 value type. The tweakable fields (3 or 4 for vectors) can be selected using the shoulder buttons. The right analog stick adjusts the value in the field and an update event is sent to an attach IEventTarget object. I use eventing all over the engine already for animations, game logic etc. The one tweakable I have now for example is the LightDir tweakable which is wired to an UpdateLightDirection event on the scene. In the first picture you can see the specular highlights on the water (please excuse cheazy really bad shader code). You can tweak the lighting with the controller to get the desired effect.


So then that brings me to the issue of the model loading, which I was also content to let be and just use the standard cubes. I remembered that I had some old 3DS loader code laying around and porting C++ to C# is pretty darn easy IMO so I spent a few hours and ported the 3ds code. There were a few wierd things to work out in the translation but the C++ code was written with some nice abstractions so it went very smootly.

So now I've got some free 3ds models from the web running around in the engine with some more interesting lighting and it's actually looking a little bit more decent at this point. The next two shots are just of a free 3ds model I found that is composed of about 16 mesh chunks and has custom basic materials (no textures). To handle the materials I created a MeshMaterialGroup object that accepts the material with face indexes from the loader and resolves the faces into prim indexes. When you call Mesh.SubmitPrimitives() it looks to see if it has any material groups and if so it submits them in order instead of sumbitting the entire prim batch for the whole mesh.

Close ups of 3ds model:

Saturday, September 23, 2006

XNA Shmup

So for anyone who cares and hasn't heard me rant about what I wanted to do with the XNA stuff I'll just explain it now. Ryan inspired me to go in the direction of a shmup, I have wanted to do one for a long time but this new framework seems ideally suited to a game like this. There isn't any particular art style or theme set atm so I'm just laying out some really basic shmup gameplay elements that are pretty much 'required' to have a respectable game. One of the key ideas though is to completely leverage the 360 controller. I want to have a very natural action mapping to the controller that makes sense and gives you more control than simply shoot and move.

A few concepts that I am borrowing for the GD are:
  • Roll defense from starfox
  • Polarized attack for the enemies ala ikaruga (radiant silvergun), the difference here is that ground targets must be bombed, squigies must be railed with mass driver weapons and conventially shielded enemies require beam weapons.
  • All weapons are effective against all enemies but certain weaons are much more effective. This technique is vital to survival.
  • Ability to equip a small pod that can has limited controlled and it's own set of upgrades.
  • Clip/reload system for mass drivers/bombs, energy system for beam weapons. Ammo is plentiful but must actually be collected and you cannot hold the fire button the whole time.


    Here's a screenshot debugging one of the triggers for a mob spawn and the new bullet system:



    Again, not very impressive looking (it looks better in action) but I'll just layout a few of the things that are working now.

  • Follow camera
  • Scene trigger system that can fire proximity events
  • Mob controller with spawn/death management (hooked to trigger system)
  • Mob action scripting pcodes with time driven events (Fire, Rotate, Change properties etc)
  • Random terrain generator

I'm not trying to do a fully polished game currently. Just something that starts up allows you to play through a random level with increasing difficulty and records your high score. I will probably implement a few different types of weapons as well.

I don't know if I want to finish it all in one shot.. I have to get back to some other stuff.. really ;)

Friday, September 22, 2006

XNA: Yes I'm a bit addicted now

This stuff is really nice. I'm actually a bit addicted to the whole thing. I finally got some shader issues sorted out. I have a few very basic shaders right now, one that renders color coded normals for debugging purposes and one that does a single directional light and diffuse shading. I picked up a good shader book and a new 20" LCD yesterday when I was hanging out with Mike. Here's a spinning cube inside a procedural landscape.

Thursday, September 21, 2006

XNA rainbow mesh



Well it's certainly not much to look at. I haven't put too much time into getting things pretty yet but I have ported a bunch of game engine concepts from rampart already. I've got a simple scene system with multiple vertex/pixel shader support and runtime switching between shaders. An animation system is hooked up to the avatar with event callbacks. Multiplayer support with actions wired into avatar. Debug mode with flying camera and ability to control scene rendering parameters (pictured wireframe mode). Oh and sound effect events.

The shader in the screenshot is the simple ffshader.fx that is shown as an example in the XNA docs. I have another shader that I put together off the template in NVIDIA's FX Composer. You can toggle between the two and there is a dynamic effect binding system that binds scene/object parameters automatically for the selected effect.

And yes the rainbow terrain mesh is super fruity!

The XNA docs overall are very good but they don't go very deep. I had to dig a bit deeper to discover how to handle the effect files more generic than in the examples which simply loaded a vertex shader function.

Essentially what I have is an scene effect object per .fx file. They derive from an abstract class with the following members:

OnEffectLoaded() -- called after the effect is loaded to get handles to the various parameters.

BindSceneParameters() -- called once per scene render to bind global scene parameters.

BindSceneObjectParameters() -- called once per scene object to bind local object parameters.

This is handy for switching effects on the fly.

I'll post some more XNA shader stuff later.