Jump to content

  • Log In with Google      Sign In   
  • Create Account

[.net] C# OpenGL BSP engine code


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
16 replies to this topic

#1 DaWanderer   Members   -  Reputation: 538

Like
0Likes
Like

Posted 04 March 2006 - 01:22 PM

RipTorn has graciously hosted my code for a C# OpenGL BSP engine. You can download it from here. The game is a simple FPS that loads Quake 3 BSP files (probably not 100% correctly...). Only 2 weapons available (numeric keys 1 & 2) ;) The GameServer.msi installer will install the server program that will host a game session so multiple players can connect and fight against each other. There are a few different game types including a simple deathmatch mode, an item collecting contest, and a "marked man" mode where you have to be the marked man at the end of the round to win (you get marked by shooting the current marked man). This was my final project for my game programming class. I hope other will find the code useful in some way.

Sponsor:

#2 Smit   Members   -  Reputation: 310

Like
0Likes
Like

Posted 04 March 2006 - 01:43 PM

That is pretty nice. I noticed you couldn't jump if you were on a slope though.

The code is interesting too, thanks alot for sharing :)

EDIT: Its seems like the GameSetup and ServerSetup Projects are missing.

#3 DaWanderer   Members   -  Reputation: 538

Like
0Likes
Like

Posted 04 March 2006 - 06:26 PM

Quote:
Original post by Smit
Its seems like the GameSetup and ServerSetup Projects are missing.


Yeah, I had to cut out some of the files to make in under 10MB so I could send the file through GMail. I still have all the files, though.

There's also a cool bug that I found. Go to the giant columns outside (up the stairs) and jump against them while running; you'll run up them! My code for gravity and jumping tests to see if the difference between your current height and the next height is small enough. I set it to a certain threshold for the smooth incline in the middle of the stairs leading outside, but it apparently works for the columns since they're at a slight angle.



#4 RipTorn   Members   -  Reputation: 722

Like
0Likes
Like

Posted 04 March 2006 - 10:42 PM

if you want to send the remaining files over I'll include them in the upload

#5 Rob Loach   Moderators   -  Reputation: 1500

Like
0Likes
Like

Posted 05 March 2006 - 05:36 AM

Although the new Axiom is still in the process of being made independant from RealmForge, its BSP loader is available here. Any clue what the difference is between yours and Axiom's?

Rob Loach [Website] [Projects] [Contact]

#6 cody   Members   -  Reputation: 199

Like
0Likes
Like

Posted 05 March 2006 - 06:52 AM

the axiom loader is much more complex and has more features(shaders,patches?). but it is also integrated with axiom.

DaWanderers code is very easy to read and to understand and has few dependencies.

#7 DaWanderer   Members   -  Reputation: 538

Like
0Likes
Like

Posted 05 March 2006 - 10:40 AM

Quote:
Original post by Rob Loach
Any clue what the difference is between yours and Axiom's?


I based mine off a series of tutorials I found on the web (I can't remember where now...). Perhaps my loader and Axiom's are similar if we used the same tutorials. In any case, if you want to "roll your own", it's good to have a few different perspectives.

I've also sent RipTorn the setup projects for the engine, so they should be part of the package soon if anyone is interested.



#8 remigius   Members   -  Reputation: 1172

Like
0Likes
Like

Posted 05 March 2006 - 11:01 AM

Well, it's not Managed DirectX, but I guess it's gonna be an interesting piece of code to take a look at nevertheless. Many kudos for sharing it! [smile]

Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!

#9 RipTorn   Members   -  Reputation: 722

Like
0Likes
Like

Posted 05 March 2006 - 06:03 PM

Quote:
Original post by Rob Loach
Although the new Axiom is still in the process of being made independant from RealmForge, its BSP loader is available here. Any clue what the difference is between yours and Axiom's?


Thanks for pointing that out, it is awesome news indeed.

#10 Rob Loach   Moderators   -  Reputation: 1500

Like
0Likes
Like

Posted 03 April 2006 - 02:08 PM

That's awesome, very nicely done. I love it, too bad I couldn't find anyone to play with...

It's been mirrored: http://files.robloach.net/Game Programming Final.zip

You might want to make a thread about it in the Axiom Forums just to spark some interest [wink].

Rob Loach [Website] [Projects] [Contact]

#11 dmreichard   Members   -  Reputation: 384

Like
0Likes
Like

Posted 04 April 2006 - 01:22 PM

It wont let me run it since I don't have the .NET framework 1.1, doesn't 2.0 have backwards compatability? I have the .NET 2.0 framework

#12 DaWanderer   Members   -  Reputation: 538

Like
0Likes
Like

Posted 04 April 2006 - 02:57 PM

The frameworks are meant to be installed side-by-side. 2.0 is not necessarily backwards compatible, but I believe the point releases (1.0, 1.1) must be.

#13 cutler258   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 July 2007 - 02:53 AM

hi, i couldnt compile.render system is error.

i include tao but Gl.glVertexPointer is false.it cant convert void to System.IntPtr.can you help me

#14 gharen2   Members   -  Reputation: 520

Like
0Likes
Like

Posted 25 July 2007 - 06:07 AM

Quote:
Original post by cutler258
hi, i couldnt compile.render system is error.

i include tao but Gl.glVertexPointer is false.it cant convert void to System.IntPtr.can you help me


I don't understand your question, but tao's glVertexPointer binding is fine.

This suggestion is just a guess based on what you've written: try using "IntPtr.Zero". Notice also that there's an overload that accepts an object instead of an IntPtr. Try using that instead.

If that isn't helpfull, please try rephrasing the question more clearly and post the exact error.

#15 cody   Members   -  Reputation: 199

Like
0Likes
Like

Posted 25 July 2007 - 08:03 AM

Post the source code line that gives the error.

Was the Tao library included in your download, or did you use the version from the Tao site? There were quite quite a lot changes since this game was released, but should be easy to fix.

#16 cutler258   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 July 2007 - 09:27 PM

i am using tao 2.0

http://img470.imageshack.us/img470/7731/ekranmg6.jpg

i have this picture :(

i convert render system to csgl..

theese are codes:

--------------------------------------------------------

private unsafe void RenderPolygonFace(int FaceIndex)
{
BSPFace CurrentFace = Faces[FaceIndex];

if (Textures[CurrentFace.TextureID] != null)
{
//Vertices
fixed (void* VertexPtr = &Vertices[CurrentFace.StartVertexIndex * 3])
{
GL.glVertexPointer(3, Gl.GL_FLOAT, 0, VertexPtr);
}

if (CurrentFace.LightmapID >= 0)
{
if (Lightmaps[CurrentFace.LightmapID] != null)
{
//Lightmap
Gl.glBindTexture(Gl.GL_TEXTURE_2D,Lightmaps[CurrentFace.LightmapID].TextureID);

//Setup blending
GL.glDisable(Gl.GL_BLEND);
GL.glTexEnvi(Gl.GL_TEXTURE_ENV, Gl.GL_TEXTURE_ENV_MODE, Gl.GL_REPLACE);

//Set texture coordinates
fixed (void* LightmapCoordPtr = &LightmapCoords[CurrentFace.StartVertexIndex * 2])
{
GL.glTexCoordPointer(2, Gl.GL_FLOAT, 0, LightmapCoordPtr);
}

//Draw face
fixed (uint* IndexPtr = &MeshIndices[CurrentFace.MeshVertexIndex])
{
GL.glDrawElements(Gl.GL_TRIANGLES, CurrentFace.NumMeshVertices,
GL.GL_UNSIGNED_INT, IndexPtr);
}
}
}

//Decal texture
Gl.glBindTexture(Gl.GL_TEXTURE_2D, Textures[CurrentFace.TextureID].TextureID);

//Setup blending
GL.glEnable(Gl.GL_BLEND);
GL.glBlendFunc(Gl.GL_DST_COLOR, Gl.GL_SRC_COLOR);
GL.glTexEnvi(Gl.GL_TEXTURE_ENV, Gl.GL_TEXTURE_ENV_MODE, Gl.GL_REPLACE);

//Set texture coordinates
fixed (void* TexCoordPtr = &TextureCoords[CurrentFace.StartVertexIndex * 2])
{
GL.glTexCoordPointer(2, GL.GL_FLOAT, 0, TexCoordPtr);
}

//Draw face
fixed (uint* IndexPtr = &MeshIndices[CurrentFace.MeshVertexIndex])
{
GL.glDrawElements(GL.GL_TRIANGLES, CurrentFace.NumMeshVertices,
GL.GL_UNSIGNED_INT, IndexPtr);
}
}
}

-------------------------------------------------------------

#17 cody   Members   -  Reputation: 199

Like
0Likes
Like

Posted 27 July 2007 - 12:54 AM

Hm... I cant see whats wrong in the code, but csgl is extremely outdated. Tao is the way to go.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS