I hope everyone is having a wonderful holiday season. I sure am. Corndog and I wish the best for our viewers and hope for peace in these troubled times. I know we could use some.

You may not believe me, but the project is still alive and moving along. Our posting and working schedule has been terribly afflicted by finals season, but we have recently made incredible progress and should (Finally) be able to post some videos of early gameplay by the end of next month. These videos will hopefully showcase some of the features we hope to include in the final version of the game.

Also starting with the new year we will start writing segments about the game. Such as gameplay, story, weapons, things I'm sure you want to know as opposed to all this programming stuff. There will still be programming stuff, but it will be spaced apart for out more non-technical audiences.

With the recent victory over camera control we have been busy at work implementing the texture tiling and sprite animation controls which will be needed once we get some actual textures. My task is now to implement the Lidgren Networking Library which I have been studying for some time, while Corndog polishes up the character movement.

Anyways more on this game development stuff later, there are cookies that need to be taken care of.
Hello! GM Riscvul here. Normally Corndog would be the one to post on the Farseer Development effort, but he delegated the effort to me. This week's post on Farseer Physics has to do with the debugviewer. For the longest time we could not get our physics world to match up with our pixels world. This made our physics objects be in completely different places than our graphics. This made it almost impossible to debug effectively.

Following the last post we posted the following debugview code

172 //If you want to see debug info on top then place this function before other spritebatch calls

173 debugView.RenderDebugData(ref proj, ref view);


This used an identity matrix for the viewport and a projection matrix that looked like so

147 Matrix proj = Matrix.CreateOrthographic(50 * AspectRatio, 50, 0, 1);


This was all well and good except for... IT WASN'T MATCHING UP!!!
Alot of foul language was heard from Corndog as he tried desperately to match them to no avail. However having taken a few graphics classes I had a better idea of what I was looking at and dug in. The following answer is adapted from some kind soul's code posted on a forum. I cannot find the forum entry again and therefore I am failing to give proper credit. The code was adapted to suit our specific program.

141 Viewport Vport = GraphicsDevice.Viewport;

142 GraphicsDevice.Clear(Color.CornflowerBlue);

143

144 //Creates screen projection for debug mode that sets the height of the physics world to variable

145 // ScreenHeightInPhysicsWorld.

146 // This height is in meters

147 Matrix proj = Matrix.CreateOrthographic(ScreenHeightInPhysicsWorld * graphics.GraphicsDevice.Viewport.AspectRatio, ScreenHeightInPhysicsWorld, 0, 1);

148

149 // Viewport should either be identity matrix or camera transformation

150 Matrix view = _camera.get_transformation(GraphicsDevice);

151

152 // This transform matrix is passed into spritebatch to convert pixel sizes into meters

153 // This means physics world coordinates are the same as spritebatch coordinates

154 // Use locations and sizes of physics bodies for coordinates

155 Matrix transform = view * Matrix.CreateScale(Vport.Height / ScreenHeightInPhysicsWorld)

156 * Matrix.CreateScale(1,-1,1)

157 * Matrix.CreateTranslation(Vport.Width * .5f, Vport.Height * .5f, 0f);

158

159 //Be sure to pass in transform into any spritebatch you want to conform to the physics world!

160 //

161 // One other note! JigLibX which farseer is based off of uses a reversed Y scale. This means you need

162 // to reverse any textures you use or they will be culled by spritebatch! It might be possible to fix

163 // this by changing the scale matrix above, but edit at your own risk.

164 spriteBatch.Begin(SpriteBlendMode.AlphaBlend,SpriteSortMode.BackToFront,SaveStateMode.SaveState,transform);

165

166

167 //map.Draw(spriteBatch, graphics);

168 player.Draw(spriteBatch, graphics);

169

170

171

172 //If you want to see debug info on top then place this function before other spritebatch calls

173 debugView.RenderDebugData(ref proj, ref view);


The Code above contains many comments which should help explain it, but for simplicity I will break it down farther. The view variable represents a viewport matrix. This will be your camera transform. We are using a camera2D class which provides the transform.

Next the proj variable represents a projection matrix. Since we are making a 2D game our projection will be orthographic. The purpose of an orthographic matrix is to make a scene fit on any screen by scaling and transforming the image to fit the current resolution. Our orthographic projection's goal is to make a standard height and width for the physics coordinates and spritebatch coordinates. Since XNA's graphicDevice stores the aspect ratio, or ratio of width to height, we will use this to set standard sizes for our world.

You might have noticed references to a variable called screenHeightInPhysicsWorld. Farseer uses meters to measure coordinates and sizes of its fixtures, so we want to use meters as well. This variable is how tall the portion of the world viewable on the screen is in meters. In this case it is 50. However feel free to change this to whatever you want.

Now our screen size is standardized and our camera is set up... but things still don't match up!! Well that is where the transform matrix comes in. Spritebatch can accept a matrix called a transform. We want to pass it a transform that will convert pixels to meters. This is much more complex. In fact it means little to anyone who doesn't have a background in graphics. In short this matrix converts pixel coordinates used in your spritebatch calls to meter coordinates used by farseer.

One final note, the transform flips coordinates to match Farseer's reversed Y scale. This means textures will by default be applied upside down and culled by the graphicsDevice. You need to flip textures on the Y axis in order to keep them visible. This is accomplished by something similar to the following.

175 Vector2 scale = new Vector2((circleFixture.Shape.Radius * 2) / (squareTexture.Width), -(circleFixture.Shape.Radius * 2) / (squareTexture.Width));


This scale vector is passed into spritebatch when drawing a texture. For spritebatch position information use the fixture position and spritebatch will draw the texture exactly where the physics object is.

Alright You should now have debug mode matching up with your spritebatch calls now. Have fun with physics!
Hey GM Riscvul here. I thought I would post a little status update for the readers of this blog. Its been a tough few weeks with schoolwork and I have been struggling to find the time to work on the game. As such Corndog and I are a little behind on our development goals. However recently several great steps were made.

GM Riscvul
  • Has finally managed to implement saving and loading
  • Strangely enough loading came before saving
  • Several minor bugfixes to menu screens
  • Profile Creation complete
  • Albeit few profile features implemented
  • After fixing a few other bugs, will begin work on networking
Corndog
  • Finally has unlocked the secrets of how to control debugmode in farseer
  • Almost completed camera control (just needs to split mouse and avatar controls apart)
  • Halfway through skinning the physics objects
In other news we have recently picked up another programmer and an artist. We will introduce them when we know they are committed. With Thanksgiving break coming up I am hoping to get in some quality programming time. Hopefully the turkey doesn't incapacitate me! I hope we have some video to show you soon.
GM Riscvul here! Another week another post! Before I dive into the topic for today, lets give a brief update on progress...

GM Riscvul: Buried in vicious homework assigned by his Algorithms and Complexity Class, recently has dived into documentation for the Lidgren Networking Library in order to implement LAN gaming and the networking screens.

Corndog: Too embarrassed about the lack of sprites to show off his rapidly developing character objects. Currently implementing camera movement.

Now on to Game State Management. This has been my department since the beginning of the project. State management is not unique to games as it is based off the idea of a state machine which has existed from the beginning of computer engineering. I will spare the wordy definition and call a state machine a collection of states with a starting state and at least one final state. Each state itself is related functionality which loops unless a transition occurs.

Okay so that was boring, now lets apply this to games. A game is easily defined as a state machine or collection of states. What states you ask? Well lets look at the average game... When the game starts we see a start screen waiting for us to push start to continue. Once we push start we move into a menu where it waits for us to select an option. From the menu we move into the game and play around for a bit. We push pause and transition into the pause menu. The pause menu waits for us to push buttons and so on... Each one of those screens is a separate state which loops and waits for specific inputs to transition to a new screen (state). A key aspect in game design is managing these states and making them play nice with each other. The picture below known as a flow chart illustrates relationships between game states.

How is this done in Gunslingers? Well I started out with some help. The XNA site has downloadable code for game state management. This provides a great starting point as it is easily expanded to contain more screens and functionality.

Three classes make up the management in this code: InputState, GameScreen, and ScreenManager. InputState handles all cross-screen input or input required to access other screens and trigger transitions (i.e. the escape key). GameScreen provides an inheritable bunch of essential functions for any screen in the game. ScreenManager does the hard work. It shifts screens around, triggers transitions, closes screens that should no longer be up, and in short helps the programmer out alot. Any new screens you wish to add simply need to inherit from GameScreen and be added to the ScreenManager's screenList.

Adding functionality is also easy. Editing ScreenManager allows one to change tranistions and timing. Editing InputState allows you to add new cross-screen inputs. I implemented mouse movement and picking as well as a console command.

Another nice thing about the GameStateManagement code is it gives you a menuScreen class that makes it easy to build menus. Simply inherit from MenuScreen instead of GameScreen and add menuEntries to the screen. InputState takes care of menu navigation.

Once the network screens are ready I will present a video tour of the menu system to give a visual idea of how state management works. Anyways so much more networking and homework to tackle.
I know, I know. you have been saying: "Corndog! whats the deal?! I already know how to set up the debug view for Farseer, thats not what my problem was. I would just like a straight forward guide to how to make it do stuff!!"
Well, maby thats not what you were thinking of. but I sure was...anyway.

Well here you go, the moment you have been waiting for. this is where the fun begins. the how and why of the Farseer Physics Engine.

The How:

After you have succeeded at getting it all set up. now the question is what code to use to get stuff to start bouncing around the screen?

to start off you need to make a physics body. or as the most recent version of Farseer calls it: a "fixture."
in the loadContent method of your XNA game add the following line (or something like it.)

rectangleFixture = FixtureFactory.CreateRectangle(world, 4, 4 , 1, new Vector2(0, 0));

This will create a physics fixture in the shape of a "rectangle." actually this one will be a square because we have set the height and width to: '4'
The First parameter if the CreateRectangle Method takes a "world" object that is created as a private member variable of the game class. (for more info on this see the previous post labeled "Physics engine woes part 2.")

The next to parameters are the width and height, (in that order.) You should be aware that in the new version of Farseer the values are in the metric system. this means that our previously determined size is 4 meters by 4 meters. Why the Farseer programmers decided to do this is beyond me. If you figure that out please let me know. because I thought pixels were a much better convention.

Next is the mass of the fixture. this will affect how the object behaves in the world based on the forces applied to it. currently it is set to '1' as far what values to use in your game, you will have to mess around with the values until you see the behavior you are looking for.

the last parameter is a Vector2 that contains the


Well that was a mouth full. NEXT!!

to make this more interesting we will need to set a few more variables on this fixture to make it more interesting. add the following lines (or ones like them.)

rectangleFixture.Body.BodyType = BodyType.Dynamic;
rectangleFixture.Friction = 2.0f;
rectangleFixture.Restitution = 0;

The common types of body are Dynamic and Static. A static Body will not move from where it is placed. (that Vector2 from earlier.)
If its Dynamic then it will be affected by gravity and any other forces you see fit to subject it to.

Friction should be kind of obvious but in case someone missed that day of science class because you were out on the town with your pet chinchilla...*cough*
Friction determins how "slippy" the surface is when it comes in contact with other surfaces.

Restitution is, simply, how bouncy it is.


And thats how to create a physics Fixture.

here after you can make it do things by applying various forces such as linear velocity, angular velocity, etc. if you need to know the how to on those I suggest you look at the farseer Documentation but mostly just use visual studios auto complete function. that is honestly the way that I figured out most of what I know about Farseer.

Happy coding.

CornDog
Well, we're back. and this time we have friends...not really. but anyway...*Cough*
and on with the useful info.

Today's post is a continuation of last weeks post...*cough!*...and it will be about how to implement the "Debug View" in your Farseer enabled XNA game.

First you need to copy the Debug View XNA folder into the main folder for your project. This can be found as part of the "Hello World" download from the farseer website. Be sure you are using Farseer 3.0 or better.

In your project right click on the title of your project in the solution explorer. select "Add" > Add an Existing Project. Navigate to where your copy of the Debug View is located and select the DebugView 3.0 XNA.csproj file. this will add the Debug data to your project. you will then need to add the following to your code:


public class Game1 : Microsoft.Xna.Framework.Game
{
private World world = new World(new Vector2(0, -60));
private DebugViewXNA debugView;

public Game1()
{
debugView = new DebugViewXNA(world);
}

protected override void LoadContent()
{
DebugViewXNA.LoadContent(graphics.GraphicsDevice, Content);
}

protected override void Draw(GameTime gameTime)
{
debugView.RenderDebugData(ref proj, ref view);
}
}
}

In the above code the lines you will need to add are listed in the methods they must be placed in. this is of course based on using the default XNA game setup.
one thing to mention is that the line:

private World world = new World(new Vector2(0, -60));

Is listed Because the farseer World variable is needed for the "DebugViewXNA(world);" call. you would need the world line even if you do not use the Debug View.

And if you do that you should then see all kinds of pretty shapes were all your Farseer Fixtures are.

I hope this helped. Next time I will go over some of the basics of how to use the Farseer Physics engine in your XNA game. until then, have fun tweaking.

CornDog
As you may have seen, from a previous post, We have decided to use the Farseer Physics engine for handling the physics in Gunslingers.
When we started the programing for this project we split up the first tasks between Riscvul and Myself (CornDog). Riscvul was assigned, among other things, the set up of the menu system and the state machine. I was assigned the job of figuring out how to do the character movement and animation. as well as physical interaction with the world. as this was the case I found it needful to learn how to use our chosen API's. and the first step: Setting it up to work with the current version of our test game.

There seems to be a funny trend in the world of physics engines. A SERIOUS lack of good documentation. or at the very least UP-TO-DATE documentation. As I was digging through forum posts and Blog entries to try and peace together how exactly to go about implementing Farseer, I was surprised to find that most references to what I was looking for left some very large holes in my understanding. So after spending several days searching I finally found something that helped me get it working.

So I post this information here in hopes that it will help some poor programmer who finds himself in my position.

I finally found the answer here: http://www.flatredball.com/frb/docs/index.php?title=FlatRedBallXna:Tutorials:Farseer

The code listed there is a bit out of date. when Farseer was updated to version 3.0 they changed how some of the basic things were done. A summery of the instructions are found below:

Farseer can be found at the following address:

http://www.codeplex.com/FarseerPhysics

Perform the following steps to prepare using Farseer:

  • Click on the "Downloads" link on the page posted above.
  • Select the appropriate library. For this sample, I clicked on the "Farseer Physics 2.0.1 XNA" link.
  • Download the .zip file somewhere on your computer.
  • Unzip the newly-downloaded zip file.

The unzipped file contains the necessary .cs files as well as the project file which you can add to your game's solution.

Assuming you have an already-created project that links to FlatRedBall, perform the following steps to add Farseer:

  • Right click on the solution name in the Solution Explorer
  • Select Add->Existing Project...
  • Navigate to the location where you unzipped the Farseer zip file.
  • Select the project file (FarseerPhysics.csproj) and click the "Open" button.
  • Right-click the "References" folder under your game project.
  • Select "Add Reference..."
  • Select the "Projects" tab.
  • Select "FarseerPhysics" and click the "OK" button.

Rebuild to make sure that everything is set up correctly.


I am not including the Code in this post because I myself am still getting acquainted with the changes that have been made in the 3.0 update. but it seems like they have made things a fair bit simpler to use. I intend to post some code samples in Part 3 but for now this will get Farseer set up in Visual Studio.

What is in store for Part 2 you ask? well, I will awe you all with my knowledge of how to set up the Farseer Debug View which allows you to see all the physics bodies and the data produced by their interactions.

"But CornDog, When will you post this delicious bit of information?!" you say. my answer? just as soon As I know how to do it myself.


CornDog


PS. Some of you may be wondering what was up with the funny names mentioned earlier in the post. We have decided to use our gaming handles instead of our names on here. This is mostly to protect our identity but also so that we don't need to live in constant fear of being mobbed by hordes of our fans. :P


Well again the post has been delayed. Sadly my computer died recently and I have had to RMA the components TWICE! Thankfully EVGA is pretty good about soothing frayed nerves. It should be back to normal mid next-week.

However some progress updates:
  • Basic physics though Farseer have been implemented. So objects finally collide correctly.
  • Mouse interaction with the menu system now works correctly.
  • Load delays from component initialization have been dealt with.
Next Steps:
  • Fully functioning character physics object
  • Profile saving and auto save features
  • Option Screen
Stay tuned for more updates. Also after these next steps we hope to be able to post video clips of alpha game footage. As always suggestions are welcome through our email novaboxproductions@gmail.com
We apologize for the lack of a post last week, the writer... ahem I was sick and really didn't feel like doing anything but finding replacement tissue boxes. So here is the overdue post.

When starting a game project the first thing a developer has to do is pick the programming language they will use. Many times this decision is influenced by what helpful libraries or pre-built code is available for a language. For us C# combined with Microsoft's XNA libraries seemed the best choice.

XNA's features for game creators are nearly limitless, and help speed along nearly every part of the programming process. Here are a few of the features provided by this helpful tool.

  • XBOX, ZUNE, PC gaming compatibility
  • Integration with Windows Live Gaming
  • Network tools
  • Sound Bank Creation and Cue driven audio programming
  • Resource Compiling and optimizing
  • Install packaging
  • Helpful Forums with many other Indie Game developers
  • Save files and Live profile integration
We aim to take advantage of this free tool to speed along our development process and allow us to bring this game to players faster, with greater stability. Hopefully this library will also allow us to join PC and XBOX players together reaching a greater audience of gamers!

Well I have menus to program, I'll see you next week.

You just have to find the right one. For the world of Gunslingers to be how we intend it needs to have a physics engine. Now we have two options we could build one ourselves , or we could use an ‘off the shelf’ one. Well why go through the trouble of building one yourself when and ‘off the shelf’ one will do fine, So to simulate the physics in Gunslingers we will be using the Farseer Physics engine. The extent of its integration into the world has yet to be determined, but for now its is going to be used for

  • Character movement
  • Collision detection
  • Particle Physics

We will be endeavoring to use it as efficiently as possible to leverage what we need out of the

Farseer Physics engine. We will be using it’s tools to properly simulate the world of Gunslingers.
Below is a video that demonstrates some of the features of Farseer.



In todays news, Novabox studios gets a purpose for its existence. Seriously, we would like to announce the commencement of our first project, a game called Gunslingers.

To begin our introduction here is the specs and target system requirements.

Gunslingers
  • Platforms - Games for Windows, XBOX 360
  • Rating - Teen(This is the target, No official rating yet)
  • System Requirements - Windows XP, .NET 3.5, and Direct X 9
Description

Gunslingers is a Side-Scrolling 3rd-person shooter with intuitive control schemes and over the top gunslinging action. A tribute to the thrilling gunfights and gunwielders of Eastern and Western film and fiction, Gunslingers allows you to take control of a skilled gunslinger and fight to protect the world or prove your skill.

Story

As terrorism grows in popularity so does its threats. Now a group claims to have an American nuclear warhead and plans to use it against the nation of Japan. Fearing political fallout as the least of their problems, America sends in the troops to secure the rumored warhead and prevent a disaster. However more than one group has its eyes on the warhead.

Key Features
  • Intuitive Controls - Short and simple control scheme makes it easy for you to pick up the game in a moment. The built-in stunt system allows players to make their way across the map without worrying about timing jumps or catching ledges, simply push the stunt button and the game does the work for you.
  • Full Avatar Customization - Create your own Gunslinger with a variety of clothes and accessories to make your multi-player persona unique. Don't like our options? Upload your own textures to create an incredibly personal and unique appearance.
  • Environment Interaction - Let the environment fight for you! Many objects can be used to create effects, explosions, hiding places and more!
We are excited about this project and hope to hear feedback and comments. We want to build a game that's fun and meets the needs of the online community. Hope to hear from you soon!


Welcome ladies and Gents to Here!
where is here you ask? well, I will tell you. however, do not hold me responsible.

NovaBox Productions was started about a year ago by two crazies who think they can make games.
Since its conception, the world has remained blissfully ignorant of their existence...until now.
Here is were you will find anything interesting they happen to place up for your viewing. (related to Game production of course)
Proceed with caution.