 |
|
 |
Hello Ivan,
Can you please let me know how to make this code run without 3D card?
I keep getting error on line number 119 of Form1.cs
device = new Device(0, DeviceType.Hardware, this , CreateFlags.HardwareVertexProcessing | CreateFlags.PureDevice , pres);
I know a minor change here should make it work. Can you please let me know.
Regards
Nhilesh Baua
|
|
|
|
 |
|
 |
change
device = new Device(0, DeviceType.Hardware, this , CreateFlags.HardwareVertexProcessing | CreateFlags.PureDevice , pres);
to
device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, pres); // Put everything into the device
|
|
|
|
 |
|
 |
Hi Ivan, this is very nice, it gave me some ideas, thanks for such an awsome example of 3d game written in c#.
I want to make some suggesstions, when u minimize the window while playing the game, device automaticly gets lost thus device.Present() call returns as an invalid call, maybe you can add a boolean to determine whether the device still exist before the game tries the render itself.
thanks +5
|
|
|
|
 |
|
 |
If you press a button to make your snake go in the opposite direction you die. I think that it should just ignore such a silly command
|
|
|
|
 |
|
 |
It seems that PureDevice is not supported on my machine. I had to comment that out to avoid an InvalidCall exception when creating the Device instance. Can this be queried from the system and set appropriately?
I didn't seem to have any trouble with IOExceptions AFTER I installed the DirectX 9.0c SDK.
I would like to see the number of players be more easily modified. It is tough to play this to learn DirectX by myself and it didn't seem clear what changes were necessary to make this a single or triple player game.
Thanks.
|
|
|
|
 |
|
 |
I tried a few things and the only option that worked was CreateFlags.SoftwareVertexProcessing. HardwareVertexProcessing also causes an InvalidCall exception on my machine.
|
|
|
|
 |
|
 |
To prevent these InvalidCall exceptions, the possibilities of the machine can be queried using the DirectX.Manager class.
CreateFlags flags = CreateFlags.SoftwareVertexProcessing;
Caps caps = Manager.GetDeviceCaps(0, DeviceType.Hardware);
if (caps.DeviceCaps.SupportsHardwareTransformAndLight)
flags = CreateFlags.HardwareVertexProcessing;
if (caps.DeviceCaps.SupportsPureDevice)
flags |= CreateFlags.PureDevice;
device = new Device(0, DeviceType.Hardware, this, flags, pres);
To make the game a SinglePlayer game isn't hard. All you've to do is make the players array's length 1. And comment out the creation of the second player.
To add a third player would take more time because then you should add a third startpoint to every level.
|
|
|
|
 |
|
 |
I also had this error when creating a device, but the following solved my problem
pres.BackBufferWidth = Screen.PrimaryScreen.Bounds.Width; //1280;
pres.BackBufferHeight = Screen.PrimaryScreen.Bounds.Height; //1024;
Hope this helps
Nejat
|
|
|
|
 |
|
 |
Thanks, that makes the sourcecode work on my machine.
Question for the author: I can't quite catch the reason for the following code:
public void SetUsed(int x , int y)
{
x = x/2;
y = y/2;
....
}
and than when calling this method, multiply the direction *2:
...level.SetUsed((int)old.X + 2*Xdir,(int)old.Z + 2*Ydir);
(2*Xdir) and (2*Ydir), why is it setup this way? Is it needed to 'round down'in the setused array and is that a good reasons to multiply parameters (just asking, I don't know).
|
|
|
|
 |
|
 |
When I run Snake3D.exe, I get a System.IO.FileNotFoundException. Please advise.
Chris Sells
http://www.sellsbrothers.com/
|
|
|
|
 |
|
 |
With my first executable upload I forgot the textures .
Try downloading the file again.
Thomas
|
|
|
|
 |
|
 |
I downloaded the demo project again, extracted the zip to a folder, then ran bin\release\snake3d.exe and still get FileNotFoundException. What am I doing wrong?
Chris Sells
http://www.sellsbrothers.com/
|
|
|
|
 |
|
 |
To be honest: I don't have a clue.
If you've the DirectX SDK and a compiler you could try compiling the source.
The executable only loads 4 bmp's, these should be in the folder you extracted to.
If you have DirectX 9.0c (SDK or not) and the .NET framework ( SDK or not) it should work.
Maybe there are more with the same problem, I'll ask.
Thomas
|
|
|
|
 |
|
 |
One of the obstacles is called tex5.bmp -- and this isn't present in your distribution.
I've just copied one of the other files to tex5.bmp and it seems to work.
|
|
|
|
 |
|
 |
Thanks. I really should've noticed that.
|
|
|
|
 |
|
 |
It stills throws the IO.FileNotFoundException ,even when I create the "tex5.bmp" file.
I haven't installed the DirectX SDK , and probably it will work after the SDK installation , but any game should run without the SDK involved in building it , if it doesn't I would like to know why as to avoid building a game that doesn't run without the SDK !
So if you can tell me why your game doesn't run I would appreciate it very much !
Florin Bejinaru
|
|
|
|
 |
|
 |
I've got the same problem. When I run a test program with the .NET 1.1 assemblies it works fine, only when I use the 2.0 assembly, it gives the exception. This is my code that gets the exception thrown:
public void InitializeDevice()
{
PresentParameters presentParams = new PresentParameters();
presentParams.IsWindowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
device = new Device(0, DeviceType.Hardware, this.Handle, CreateFlags.SoftwareVertexProcessing, presentParams);
}
|
|
|
|
 |