2 Replies - 1114 Views - Last Post: 28 September 2009 - 01:01 PM Rate Topic: -----

#1 Crazydave1990   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 28-September 09

Complete and Utter N00B!

Post icon  Posted 28 September 2009 - 11:04 AM

Ok guys, I'm a complete and utter noob when it comes to the topic of games design. I've made some simple VB programs, I'm familiar with VB, VBScript, Crystal and SQL...

So, I'm gunna try and translate my knowledge of games development, so hopefully, one of you (or more) can help me out and progress down a field in which I show great interest...

Ok, so, I understand that Computer Games run on engines, what I don't understand is, how do these engines work... can anyone explain this please? I just can't understand how the animations are ran by code =/ I know it sounds noobish, but yeah =/

Also, can anyone point me out on where a good place to start would be?

please and thanks,


Is This A Good Question/Topic? 0
  • +

Replies To: Complete and Utter N00B!

#2 modi123_1   User is online

  • Suitor #2
  • member icon

Reputation: 14045
  • View blog
  • Posts: 56,201
  • Joined: 12-June 08

Re: Complete and Utter N00B!

Posted 28 September 2009 - 11:58 AM

It depends - do you want to write your own everything from the ground up or use some crappy drag and drop "game maker"?

I would advocate C#.NET (very similar to VB.NET) and the XNA game studios from Microsoft.

game engine walk through in XNA

Was This Post Helpful? 0
  • +
  • -

#3 SixOfEleven   User is offline

  • Planeswalker
  • member icon

Reputation: 1055
  • View blog
  • Posts: 6,643
  • Joined: 18-October 08

Re: Complete and Utter N00B!

Posted 28 September 2009 - 01:01 PM

A basic would flow something like this:

Initialize graphics device
Load in game assets
while (game not over)
	Update Game Objects
	Render Game Objects
	preform timing
end while
Unload game assets

That is pretty simplistic but that is how a basic game would run. The heart of the game takes place inside of the loop. You could think of each iteration through the loop as a frame of the game. This is where the game engine comes to life. The game engine will process each frame of the game. The game engine is responsible for updating all active objects in the game, rendering them to the screen and preforming timing operations. Again, a little simplistic but it is the general idea.

I will talk about the process of creating a simple 2d space shooter.

In each frame you would update all of the objects in the game. Objects that you would have to keep track of would be the player's ship. The player's bullets/missiles/laser beams/what ever. (I will refer to them as bullets from now on.) The enemies in the game and the enemies' bullets.

You would check for input from the player and move the ship accordingly and make sure that the ship doesn't go off the screen. If the player has fired their weapon you would add a bullet to the list of active bullets. You would also keep track of any bullets/missiles/laser beams/what ever the player uses. You would also keep track of all of the enemies in the game their positions and if they have fired a bullet that round. If an enemy bullet was fired add it to the list of enemy bullets. Once you have updated all of the objects you would check for collisions and if any objects should be removed from the game. This part of the game can be the trickiest to handle.

Once you have updated all of the objects in the game it is time to jump to the Rendering part. In the rendering part you draw all of the game objects that are active and on the screen.

Now comes the timing part. This part is critical to the game. If you developed the game on a slower computer and didn't do any sort of timing when the game was run on a faster computer it would run too fast. The same is true in reverse. If you didn't do any timing on the faster computer it would drag really slowly on a slower computer. In this step you try and get a reasonable frame rate per second. I've seen games that run between 20 frames per second and 80 frames per second. XNA tries to have a frame rate of 60 frames per second. Anywhere in there would be a fairly reasonable frame rate.

You said that you use VB.NET. I can not stress this part enough. Do not use the timer control to control your game loop. Learn how to make a game loop.

This is not tested but this is what a game loop in VB.NET would look like:

Public Class Form1
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

	End Sub

	Private Sub GameLoop()
		Dim startingTick As Long
		Dim currentTick As Long
		While Me.Created
			startingTick = Environment.TickCount
			currentTick = Environment.TickCount
			While currentTick - startingTick < 25
				currentTick = Environment.TickCount
			End While
		End While
	End Sub

	Private Sub UpdateObjects()
		' You would update your objects here
	End Sub

	Private Sub RenderObjects()
		' You would render your objects here
	End Sub
End Class

Was This Post Helpful? 1

Page 1 of 1