# Visual Basic > Games and Graphics Programming > Game Demos >  Access of Speed 2 - Race Game

## Mikle

I offer you a 3D race game in VB6 using dx_vb. Source code included.
Need the support of at least 2_0 shaders:
http://mikle.ucoz.com/load/0-0-0-8-20

----------


## Nightwalker83

Cool! Although, trying to move the car doesn't do anything when running the application. What are the keys to play the game?

Edit:

Just noticed the controls are listed in the "Read Me" file although, that doesn't solve the problem of the car not moving when I press the arrow keys, etc.

If I change from "Automatic" to "Automatic for beginners" the car moves.  :Smilie:

----------


## Mikle

In the manual and normal automatic transmission after starting the car is in neutral, to move forward (or backward), you must press <A> (or <Z>).

----------


## Autistic

Nice game. But Handling is not that great. 


> The cars are not moving, They are gliding

----------


## ahmedkhairy

cool I like it.. :0

----------


## MetallicArt

this is... awesome!!
i didn'T know you could do things like that in VB!
well... how much of it is actually done using the ACTUAL native VB codes and how much is.. kind of external coding?

could you do real reflections too? i think the ones i saw were environment mapping, right?

----------


## Mikle

dx_vb.dll is not written in VB6 - this is DirectX9 port for VB6. The rest of the code in VB6.
 How are realistic reflections, can be found here, in post #14, article:
http://www.vbforums.com/showthread.p...&daysprune=365

----------


## jedifuk

i have to say this really amazing...way beyond i know what VB 6.0 capable of

----------


## DracullSoft

I agree its quite impressive. Congrets!
@jedifuk: VB6 is perfect capable for games. The trick is to get access to the graphics and sound card effectively. This can be done using OpenGL (using a game engine or even a typelib) or DirectX  again using a Bridge like Mikle's dx_vb.dll and the vb6 codes he is sharing or you can use a game engine like ice2d. Developing games with VB6 is actually quite fun and easy if you have a game engine or bridge library. One of the strongest features in VB6 is edit and continue debugging. I often end up coding maybe 20% of the game within debug session - its sick i know!, but very effective. With ice2d game engine you can also make games with edit and continue debugging in vb.net or c#.net if you prefer.

----------


## jedifuk

@dracullsoft, thank you, actually i built some games using DX7 and VB6 awhile ago, 
but after i saw this, i just can't believe so many potential VB6 still hold.
thank you

----------


## Mikle

*jedifuk*
Thank you!
Here is another near my game ([VB6] 64k game "Hello, Win!"), it is more revealing in terms of features VB6.

----------


## port12345

Pleasant computer game. Nonetheless Handling just isn't of which excellent.

----------


## bytegame

Hi mikle.

Very nice implementation in VB6.
Just a question. How do I change car models and create different tracks ?
What editor you used to create/edit .mesh files ?

Thanks.

----------


## Mikle

Hi bytegame.
For the conversion of the model, I used their utility:
https://yadi.sk/d/S9Myegg9bS662
This is not a universal tool, I changed in the code coefficients and options, here:


```
  ' Scale Model Size and Rotate
  For n = 0 To MeshVertCount - 1
    Vert(n).Pos.X = Vert(n).Pos.X * -0.0007
    Vert(n).Pos.Y = Vert(n).Pos.Y * 0.0007
    Vert(n).Pos.Z = Vert(n).Pos.Z * -0.0007
    Vert(n).Norm.X = -Vert(n).Norm.X
    Vert(n).Norm.Z = -Vert(n).Norm.Z
  Next n

  For n = 0 To MeshVertCount - 1
    If MinX > Vert(n).Pos.X Then MinX = Vert(n).Pos.X
    If MaxX < Vert(n).Pos.X Then MaxX = Vert(n).Pos.X
    If MinY > Vert(n).Pos.Y Then MinY = Vert(n).Pos.Y
    If MaxY < Vert(n).Pos.Y Then MaxY = Vert(n).Pos.Y
    If MinZ > Vert(n).Pos.Z Then MinZ = Vert(n).Pos.Z
    If MaxZ < Vert(n).Pos.Z Then MaxZ = Vert(n).Pos.Z
  Next n

  ' Center Model Coord
  For n = 0 To MeshVertCount - 1
    Vert(n).Pos.X = Vert(n).Pos.X - (MaxX + MinX) * 0.5
    Vert(n).Pos.Y = Vert(n).Pos.Y - (MaxY + MinY) * 0.5
    Vert(n).Pos.Z = Vert(n).Pos.Z - (MaxZ + MinZ) * 0.5
  Next n
```

The View button toggles the display modes. In Single mode only seen subset marked by the cursor (dotted line), Poly mode displays all marked subset.
When clicking the Save button marked subset stored in the .mesh file.

To create a landscape I used their utility, and is also not universal. If I find this utility - I will publish.

----------


## Fatina

> I offer you a 3D race game in VB6 using dx_vb. Source code included.
> Need the support of at least 2_0 shaders:
> http://mikle.ucoz.com/load/0-0-0-8-20



*THIS PROJECT IS FIRE, A TRUE NFS IN SOURCE CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! O MY GOD !*

 :Thumb: 


https://www.facebook.com/MicrosoftVB

----------


## DracullSoft

Hi Mikle, 

Just wanted to say your code is now famous on planet source code submitted by some Rais dude. 
http://planet-source-code.com/vb/scr...75548&lngWId=1

Go claim it under your own name and you might win the month Coding contest.

----------


## Mikle

DracullSoft, thank you!

----------


## bytegame

Hi Mikle,

Thanks for your reply and sorry for this delayed post.
I am happy to announce that I have added Kinect sensor support to your game. Now the game can be played using arm gestures. The gesture module is also written in VB6, although the data from the Kinect is acquired via Visual C++ UDP program. But the results are really beautiful. The code will be made available in a few days from my new site www.posesnap3d.com where your game is featured. 

You can also watch the related video at http://www.posesnap3d.com/media.htm

I have given appropriate credits to you on the homepage as well as in the download section. Please let me know if I need to add/edit something.

I also request you to register at http://www.posesnap3d.com/forum/ 
I have made special category in the forum for Visual Basic so that you can share your VB6 project links which will inspire other developers to write decent code. 

Please share this with your friends if possible.

Regards.

----------


## Mikle

> Please let me know if I need to add/edit something.


I have no complaints.

Your site www.posesnap3d.com is unavailable.

----------


## TTn

I'm sorry to bring up an old thread, but this code base is still pretty cool.  I tried the mesh converter, but I cannot load the AOS car into the FPS Be Quits.
I hooked up your FPS with XInput gamepad support and API timers, it works very well on Windows 10.

Can you explain how to create a cube and convert it to a ".mesh" model file for insertion into these games?
Thanks!

----------


## Mikle

In these two games, the model vertex format is different. AoS2 doesn't have texture coordinates, but Be Quits does.
AoS2:


```
Private Type vFormat
  Pos As D3DVECTOR
  Normal As D3DVECTOR
End Type
```

BeQuits:


```
Private Type vFormat
  Pos As D3DVECTOR
  Normal As D3DVECTOR
  tu As Single
  tv As Single
End Type
```

There are two ways to fix this: either convert the model loading code to add new texture coordinates, or convert the models themselves.
I long ago wrote on the dx8 Converter to convert the files .x in .mesh. You can use it: https://yadi.sk/d/S9Myegg9bS662
Files .x I make from .3ds using the conv3ds utility.

----------


## TTn

> In these two games, the model vertex format is different. AoS2 doesn't have texture coordinates, but Be Quits does.
> AoS2:
> 
> 
> ```
> Private Type vFormat
>   Pos As D3DVECTOR
>   Normal As D3DVECTOR
> End Type
> ...


Ah, thank you.  You've got talents.  I will post my code for XInput support, when I complete the project.

----------


## TTn

I wasn't able to get any 3ds assets from online to convert correctly.  They always show as an irregular shape.  Perhaps the values of tu, tv have to be specific to the older file format?
I purchased some older versions of Turbocad (8-9.2) hoping they will work with 3ds files.  What version of 3D studio (1-4) worked for you?

I made a small class for xinput gamepad support to be used with BeQuits.  For my own project, I re-wrote the game modules as classes so that events can be exposed outward with parameters.  The engine is more re-usable out of the box, allowing the developer to write code in response to an object's event.  I was finally able to achieve 0 CPU use at 60+ FPS.  This is possible!

Xinput class attached:

----------


## Mikle

Here is a Converter with my edits for using the texture. Run first Conv.bat, then start the project, mark subset #0 and click "save". The resulting .mesh model works in BeQuits with a texture.
https://yadi.sk/d/tmvwiPmAsHPcaw

Or give me some .3ds model with a texture that you couldn't convert.

----------


## TTn

Ah, ok I must be doing it wrong.   I am new.  I tried placing the bunny.mesh and bunny.jpg in the expected directory and replaced the source code lines as:



```
 Set Mesh(0) = New cMesh
  Mesh(0).Init App.Path & "\data\Models\bunny.mesh", 1, Vec3(0, 0, 0)
  Set Tex(0) = CreateTextureFromFileEx(Dev, App.Path & "\data\Models\bunny.jpg", 0, 0, 0, D3DUSAGE_NONE, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_FILTER_BOX, D3DX_FILTER_LINEAR, 0)
```

I thought I would see a bunny instead of a medkit, but nothing shows here.
Thank you for your time.

----------


## TTn

It works now.  I moved the project from the download folder and put it into documents.  The OS must of been blocking the image and some functionality, because I could only see an outline of the rabbit before the move.  Thank you for the support!

----------


## Mikle

I was glad to help.
You should also note that in the game, the Shader is written so that the alpha channel of the texture is interpreted as a specular map. If you use JPG textures, the models will Shine completely, it is better to convert them to PNG and mark the places where you need to Shine in the alpha channel. This is how it is done in weapon models.

----------


## pascalvaldez

Which software is used in the making of a game?

----------


## Mikle

> Which software is used in the making of a game?


Only vb6 and my port dx9 for vb6.

----------


## DevilWarez

both good and bad project, good after not being able to develop and change it and what good is open source

----------


## Dleese

Not per say on topic, anyone doing anything for games in vb.net?

----------


## Shaggy Hiker

Define a game. I'm using MonoGame to do graphics for a project that is technically not a game, but uses a game-like interface, so it kind of counts, depending on how you define a game.

----------


## Jacob Roman

Me personally made Flappy Bird on VB.Net. Got thousands of downloads. C++ and Android Studio are my goto places for games now. And for good reason.

----------

