Timbles & .Net

I wrote the initial prototype of Timbles using vb.Net. Now I know many people will scorn at such a thing, but the reality is, I’ve been around the block with development languages – been doing it for long enough – and nowdays, I just want to go the easiest route.

Coding with .Net and VB is pretty straightforward, and you can do almost everthing you could want with them nowdays. I initial intention was to create the prototype using .net and windows forms and the move over to C++ directx when I need to code the game proper. The idea is that it is much easier to work with the prototype before investing time in the final production software.

When doing graphics with a Windows form there are 2 things you need to do. Firstly you must create a seperate user control to draw to, the second is that you need to turn doublebuffering on on that control.


Partial Class canvas
Inherits System.Windows.Forms.UserControl

This means that you can turn doublebuffered to true for this control. Place that control on your form and that is now your render target. Here is an example paint event for that control which we will use to render the game.

Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles panel1.Paint

Dim n As New System.Diagnostics.Stopwatch

PlatformDevice.currentGraphicsDevice = e.Graphics

n.Start()

If Not IsNothing(currentPanel) Then
currentPanel.Render()
End If

n.Stop()

PlatformDevice.renderFrameDuration = n.ElapsedMilliseconds

End Sub

This code then tells the current panel to render. And all that needs to be done in there is to draw to the current graphics device.

Place a timer on your control that runs at your required frame rate, and inside the event for this invalidate your control.

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Dim duration As TimeSpan = Now - lastUpdate

' how long did the update actually take
PlatformDevice.updateTime = duration.Milliseconds

Dim n As New System.Diagnostics.Stopwatch

n.Start()

If Not IsNothing(currentPanel) Then
currentPanel.update()
End If

lastUpdate = Now

n.Stop()

PlatformDevice.updateFrameDuration = n.ElapsedTicks

panel1.Invalidate()

End Sub

That’s it… you’d be surprised that you can get pretty good frame rates based on this method. More than enough for 2d games and in particulalry prototypes.

Next I’m going to mention XNA, Direct3d, and C#…

Related Posts:

Timbles

I started writing a new game recently and I thought I’d take the opportunity to talk around it rather than specifically about it. The concept came from realising that I had the ability to help Rebekah with her learning through the medium of Computer Games! Yep… I was lay in bed thinking about a particular problem Rebekah was having and thinking that I should be able to find a way to help her that would be more entertaining and thus should engage her more, when the penny dropped… I’m a software developer, and a games developer at that – so there is something I could do. I got out of bed and spent through till morning working on the prototype of the game.

It’s a simple puzzle game that I call Timbles – I don’t want to say much more than that at this stage.

After working on it for a few days and feeling happy with the general concept I let the kids play it. They love it and it seems to be doing the job. I took it into Rebekah’s school to show the lead learner and he likes it to. The school are going to work with me on it to help craft it into something that the kids could benefit from.

Related Posts:

The man in black fled across the desert and the Gunslinger followed

I finally finished series by at the weekend. I started reading back in April, and six months and seven books later, I am finally finished. I very much enjoyed the story, it’s not without its problems; it could have been shorter for example – yes I know this is often levelled at authors when they write Fantasy – but that’s how I felt. It took King about 25 years to write the whole series and not to mention nearly being killed before he had finished the last three, so there is no surprise that maybe it wanders a little.

The story is an epic in all senses of the word. King blends standard fantasy with horror, super natural, contemporary, and western. It makes reference to and is often linked with many of his other works ( although there is no need to have read them). Basically, this is his magnum opus bought from the best rifle optics website. It’s the think that sits right in the middle of everything he has ever written.

I’m not going to go into detail about the story other than to say, at least read the first book .

I enjoyed the journey, and even though many fans didn’t, I enjoyed the end too!

Long days and pleasant nights to you…

Technorati , ,
Wikipedia The Dark Tower, Stephen King, The Gunslinger

Related Posts:

Writing

Managed to spend a good amount of time writing this weekend. I needed to get to grips with the first chapters of my story and some how pull it together. Once that is done then I think I have a good base to move forward. The problem is that the chapters deal with the six major characters and because they are the opening chapters then they have to pull the reader in, keep them gripped, and move them forward, without let up. Personally I think that can sometimes be a tall order for the first fifty pages at the best of times. The real problem is that you could argue that technically, the book starts after these first chapters so conventional wisdom would suggest cutting them. However these chapters are essential for the understanding of the concepts of the book – so it is important that they keep the reader gripped!

Related Posts:

The Golden Compass

I watched yesterday. What a train wreck of a film! There were a number of changes from the book, and I can accept them. One or two I might have disagreed with or wondered the point of the change, but on the whole that wasn’t the problem. The real problem is that they tried to make it a 1 hour 40 minutes film! It therefore becomes an absolutley fast forward through events that doesn’t allow you to pick up anything from the characters. The plot just zips buy that it becomes incomprehensible. You feel nothing for Lyra and as to why she does things, or indeed why anyone does things. In order to keep this plot going dialogue is thrown in that means too much exposition. I wonder if anyone who has not read the books would get anything out of it?

Technorati
Wikipedia The Golden Compass

Related Posts:

%d bloggers like this: