No longer updated: new and updated blog (including old content) at http://roy-t.nl

Archive for http://roy-t.nl, please update your bookmarks

Archive for October, 2008

Standard 1x1x1 textured fbx cube for testing in XNA

Posted by Roy Triesscheijn on Wednesday 29 October, 2008

I often hear people asking for a standard cube or model to test in XNA, well here it is. You can download the fbx model and tga texture from the rapidshare link. It’s a standard cube with dimensions 1x1x1 made in Blender, it is UV-textured, and exported using the modified .fbx export script for XNA, it works perfectly in my code and imports without errors so it should be alright.

rapidshare link

Btw if it’s not online anymore, leave a message here or try downloading it directly from the apache server running at my computer ( here ) (that link only works if my computer is on).

Advertisements

Posted in XNA | Tagged: , , , , | 4 Comments »

Translating fun and 3RRODeritus

Posted by Roy Triesscheijn on Saturday 25 October, 2008

A few weeks ago Novaleaf software was looking for translators to localize Biology Battle (remember it being featured at my blog, you can still download the pc pre-release demo!).

I’m going to do the Dutch translations for the game, proud me working on my first professional game project. (ok ok I just have to email them a wordfile with the translations, but who cares, I’m going to be in the credits

Crazy Smile
On another note: I was going to have some quality time with my girlfriend this weekend, and we where going to play Guitar Hero 2, and that would have been allot of fun.

However last evening my Xbox360 died, nice 3RROD and trying to eat the Guitar Hero 2 cd which I borrowed from a friend. Damn!

Here’s a handy link for if you got your CD stuck in your bricked 360.

Force eject a disc stuck in your Xbox360

(Gosh I hope my next Xbox360 will survive for more than 3 months. (The first one actually survived two owners from release day till 3 months ago)).

Posted in Blog | Tagged: , , , | Leave a Comment »

First XNA Demos comming out: Novaleaf Biology Battle

Posted by Roy Triesscheijn on Saturday 18 October, 2008

The first XNA Community Game demo’s are comming out already, not yet on Xbox Live, but there are already pc demo versions available for some games.

Biology Battle is a unique take on the classic space shooter genre. Take control of a medical nanobot during it’s mission inside of a target cell.

Avoid the cell’s defenses, and survive long enough to complete your mission. And then? Well, lets just say it gets a bit nastier.

And I have to say it’s addicting already, until the real version comes out on Xbox Live, you can check out the PC demo, you can even play it with an Xbox controller, but if you don’t have one, don’t panic, the keyboard+mouse controls are just fine.

You can find the demo fo Novaleaf Biology Battle here.

Biology Battle 4-player rampage

Posted in XNA | Tagged: , , , , | Leave a Comment »

Curious

Posted by Roy Triesscheijn on Friday 17 October, 2008

Today I find myself kind of curious what everyone is using XNA for these days. Not everyone is trying to make games for it and in that earn money. Allot of people want to have fun, or use it for techdemo’s or academics.

It might be a bit futile on my blog, since I dont get allot of people around here but:

If you think something else, don’t hesitate to leave a comment!

Posted in XNA | Tagged: , , | Leave a Comment »

Windows Tip: tileing multiple windows

Posted by Roy Triesscheijn on Wednesday 15 October, 2008

I’m still amazed how many people dont know this little trick, but it makes your life allot easier when you are working with 2 or more documents on one screen. (For some goodness when using a dualmonitor setup, Nvidia users can use nView for free, other people should have a look at ultramon)

For example if your working with 2 config files, a reference file and your own file, you want to see them both at the same time. Open both files in your favourite editor, say notepad. Now go to the taskbar and select both instances while holding the ctlr key now press the rightmousebutton and select one of the options (Tileing, cascade, minimize all etc..)

The context menu

And here you are 2 windows perfectly aligned next to each other (this also works for more windws, and different apps mixed togheter).

And yes, I know its a small thing but if you didn’t knew it yet it’s sure handy!

Posted in Windows | Tagged: , , | Leave a Comment »

Small blog updates

Posted by Roy Triesscheijn on Monday 13 October, 2008

As you might have noticed the blog looks totally different!? I changed the template for a more readable one that stretches better over broad monitors so code doesn’t have those iritating scrollbars so often. I aslo improves the readability and handines of my blog by fixing categories (some items where uncategorized) and makeing lasts posts more visible to the user. (It’s now on top of the left menu).

Hope this makes your reading experience more enjoyable, unfortunate thought that I now don’t have a header :(.

Warm greetings.

-Roy

Posted in Blog | Tagged: | Leave a Comment »

XNA 3.0 and Winforms, the easy way

Posted by Roy Triesscheijn on Thursday 9 October, 2008

There are many tutorials on XNA and Winforms, however none of them seem very easy, but after reading a post from ‘madman’ on Ziggyware.com and fiddleing around it seems very easy  to do, easier than the creators example.

In short we adjust the game1.cs to draw to a picturebox instead of drawing to the window that is created for it. The code is very easy to understand (as it’s only 10lines of code) and performs superb, without the use of ugly timers and all that stuff.

Firstoff create a new XNA3.0 Windows  project in  Visual Studio 2008 (Express) (this code will probably work just fine in XNA2.0/Visual Studio 2005 (Express))

Add a Form to it the usual way, and drag a picturebox to it. Call the picturebox pctSurface.

Then go into the code view of your  form and write the following code:


public IntPtr getDrawSurface()
{
    return pctSurface.Handle;
}

This code will give us the Handle to the picturebox which we will later use to draw our game to.

Now open up game1.cs add the variable ‘private IntPtr drawSurface;’ and change the constructor to look like this:


public Game1(IntPtr drawSurface)
{
              graphics = new GraphicsDeviceManager(this);
              Content.RootDirectory = "Content";
              this.drawSurface = drawSurface;
              graphics.PreparingDeviceSettings +=
              new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
              System.Windows.Forms.Control.FromHandle((this.Window.Handle)).VisibleChanged +=
              new EventHandler(Game1_VisibleChanged);            
}

And add these 2 eventhandlers

        /// <summary>
        /// Event capturing the construction of a draw surface and makes sure this gets redirected to
        /// a predesignated drawsurface marked by pointer drawSurface
        /// </summary>
        ///
<param name="sender"></param>
        ///
<param name="e"></param>
        void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
                e.GraphicsDeviceInformation.PresentationParameters.DeviceWindowHandle =
                drawSurface;
        }

        /// <summary>
        /// Occurs when the original gamewindows' visibility changes and makes sure it stays invisible
        /// </summary>
        ///
<param name="sender"></param>
        ///
<param name="e"></param>
        private void Game1_VisibleChanged(object sender, EventArgs e)
        {
                if (System.Windows.Forms.Control.FromHandle((this.Window.Handle)).Visible == true)
                    System.Windows.Forms.Control.FromHandle((this.Window.Handle)).Visible = false;
        }
 

Now we are almost done, change program.cs’ static void main to this:


static void Main(string[] args)
{
              formMain form = new formMain();
              form.Show();
              Game1 game = new Game1(form.getDrawSurface());
              game.Run();            
}

Now to make sure your application really exits when closing your form add the code

Application.Exit();

to your button and windowclosed eventhandler!

Thats it, run the code and you’ll see your wonderfull Form with a blue square where you’ve located your pictureBox! Now you can change your game1.cs as normal, use your contentmanager and content project as normal, and use windowsforms for an excellent  userinterface for your editor.

Note: this will not work on the Xbox360 since it doesn’t have WinForms
Note2: you might see a window for a few ms when starting your app. This is the old window that used to be drawn to, unfortunately I haven’t figured out how to get rid of it completely, but the eventhandler will hide it the first time it shows.

The sourcode can be downloaded here: sourcecode.
in the example I also created a spriteBatch and spriteFont to show you can really draw!

XNA3.0 In Winforms in action, notice the pictureBox borderstyle3d effect
(notice the picturebox’ borderstyle settings affecting the rendering, here it adds a nice 3D border)

Update: since I couldn’t believe the XNA devs being less smart than I am, I asked around at the creators forums and landed in a discussion between, Shawn Hargreaves, theZman and myself. According to Shawn this sollution might work properly but its not tested and he says that there might be border cases where this sollution will stop working (drawsurface may invalidate etc..) The creators example is guaranteed to work 100%, however in my eyes it still a bit bulky and hard to understand, that code may be necessairy to let everything work properly, even on strange hardware configurations etc. Also the input logic in the update loop might not work properly. I myself haven’t encountered any of these problems yet but it’s a thing to keep in mind.

My advice: creating an editor just for yourself, or anyway just for devs, you can safely use this sample. If your going to make code that has to ship to other users, you might want to reconsider.

You could also look at this topic: Shawn Hargreaves in the Creators forums

kick it on GameDevKicks.com

Posted in XNA | Tagged: , , , , , , , | 51 Comments »

2D collision response for XNA (fourtwo games)

Posted by Roy Triesscheijn on Friday 3 October, 2008

Today we had a very nice chat on efnet irc #XNA. Be sure to join us fore a while. There allot of creative and intelligent spirits hanging around there. After a while the topic became collision detection and how to solve it.

Both Uhfgood and kelthar had good ideas on how to solve it, and Kelthar had already written working code and a tutorial for good 2D collision detecion and response. Afterall if your objects keeps bounceing into your wall and only gets placed at it’s last position you’re nowhere.

So if your about to make a 2D collision response engine for your XNA game, or are interested in XNA, be sure to check out his tutorial here.

Image and video hosting by TinyPic
kelthar’s resolution to 2D collision

Posted in General Gamedesign | Tagged: , , | Leave a Comment »

Advanced State System: Concept and Base (FocusedGames.com)

Posted by Roy Triesscheijn on Thursday 2 October, 2008

Today I came acros a great article on Game State Management on FocusedGames.com, you can find it here.

It explains a topic I always seem to have troubles with, and it tells you how to get rid of those nasty Enumarations (or worse: ints) that tell you in which state you are.

I beleive a whole series of articles on ATS (advanced state systems) is comming up, so be sure to keep an eye on FocusedGames.com

Posted in General Gamedesign | Tagged: , , , , | Leave a Comment »