Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Sid makes a FPS from scratch in 48 hours

ever

Scholar
Joined
Nov 13, 2008
Messages
886
SCO said:
You must be some kind of super coder. I've been making a graphical interface for two years and i'm still finding bugs and ways to avoid them.

Hmm, I' m nota super coder, I didn't create crysis or anything just something like doom. This is what I accomplished in five days with no prior coding experience:

a)Managed to get a defined line segment face with a height variable in the struct drawn by means of ray casting
b)This came with things like a camera rotation of the camera movement of the camera etc.
c)Store all my line segment faces (I called them sides) in a binary space partioning tree (this was the grand daddy it allowed for z-ordering and some backface culling)
d)Draw the bsp with zero chance of error
e)some kind of crappy lighting algorithm where I mess around with the RGB values just based on how far away the camera is from the side being drawn.
f)collision detection using the bsp tree

That is all. No bugs anymore either. If I ever get more free time when I am not running my business I plan to play around with some voxels and A.I on the non geometric side of things.

Code:
Side splitSide (Side side, Side dividingSide, boolean front) {
  
  //Identifies which vertex of the side to be split is infront of the dividingSide and which is behind.
  
  Vertex containedVertex = inlyingVertex (dividingSide, side.segment.vertex1, side.segment.vertex2); 
  Vertex outlyingVertex = outlyingVertex (dividingSide, side.segment.vertex1, side.segment.vertex2);
  
  //Split coordinates.
  
  float splitX; 
  float splitY;
  
  Vertex splitVertex; //the vertex at split
    
  LineSegment splitSegmentFront; //lineSegment for front side of split
  LineSegment splitSegmentBack; //back side
  
  Side sideBack;
  Side sideFront;
    
  //If the lineSegment of the side is perpendicular to the X-axis splitVertex X and Y are determined by substituting one the side's X into the dividing side's segment
  //line equation
  
  if (side.segment.perpX) {    
    splitX = side.segment.vertex1.X;
    splitY = dividingSide.segment.gradient * side.segment.vertex1.X + dividingSide.segment.Yintercept;
  }
  
  //If the lineSegment of the dividingSide is perpendicular to the X-axis the program does the same as above but vice versa.
  
  else if (dividingSide.segment.perpX) {  
    splitX = dividingSide.segment.vertex1.X;
    splitY = side.segment.gradient * splitX + side.segment.Yintercept;    
  }
  
  //If neither side segment is perpendicular to the x axis then their line equations are solved simulatenously to give the intercept coordinates.
  
  else {
    
    //Using the identity x = (b2 - b1) / (m1 - m2) to solve X simulatenously, then sbustituting that for the Y solution.
     
    splitX = (dividingSide.segment.Yintercept - side.segment.Yintercept) / (side.segment.gradient - dividingSide.segment.gradient);
    splitY = side.segment.gradient * splitX + side.segment.Yintercept;       
  }
  
  splitVertex = new Vertex(splitX, splitY); //constructs the vertex at split
  
  splitSegmentFront = new LineSegment(splitVertex, containedVertex); //creates the LineSegment for the front Side
  splitSegmentBack = new LineSegment(splitVertex, outlyingVertex);  //ditto for back Side
  
  //sets height values to be the same as the parent line.
  
  splitSegmentFront.setHeight(side.segment.heightValue);
  splitSegmentBack.setHeight(side.segment.heightValue); 

  //After the lineSegments have been constructed appropriately then the program can finish splitting the side by constructing one of the two resulting sides as ordinated
  //by the boolean in argument.
  
  if (front) {
    sideFront = new Side(splitSegmentFront, side.sideValue);
    sideFront.defineColors(side.R, side.G, side.B);
    return sideFront;
  }
  else {
    sideBack = new Side(splitSegmentBack, side.sideValue);
    sideBack.defineColors(side.R, side.G, side.B);
    return sideBack;
  }
}

There have some code used for bsp tree creation.

I am super duper proud of my small accomplishments and I will not have you doubting them!
 

ever

Scholar
Joined
Nov 13, 2008
Messages
886
Marsal said:
They played his game with an Xbox controller, so he might have been using XNA GS. You don't have to write a 3D engine in the "traditional" sense (with editors, lights, custom importers...). XNA has most of the boilerplate code already done. His map was a flat surface with some walls and just the basic lightning. With some experience, easily done in hours, not days. C# is king of rapid development.

He could have cheated with those models, although it's not impossible to make 2 simple models, texture and animate them rudimentarily in a few hours.

There is, of course, more to the game then just the map and the player models, but he has been programming for 20 years, so one could assume he has a couple of algorithms up his sleeve.

EDIT: Too slow. You don't have to pirate anything. Visual Studio Express is free and has most of the functions of VS Professional (and other versions). You don't need advanced version checking, collaboration tools and similar stuff to write "simple" games (in terms of manpower and cost). XNA GS is also free. Blender for 3D. Gimp for texturing and image manipulation. All free. Or you could just "get" Photoshop and 3DS MAX and do it like a man :)

Yeah thats all great advice and all when its your job and productivity is your main goal.

But this isn't my job its my latest hobby so I just play around in code::blocks and write random crap, most of which is crap. I don't MAKE games I just want to know how they are made. I'll probably end up writing my own quake like engine or some voxel caster and make that free market/ ultima VII A.I thing and stop coding forever.

Thus is the way of the world.
 

Yeesh

Magister
Joined
Nov 10, 2006
Messages
2,876
Location
your future if you're not careful...
Overweight Manatee said:
We really need to find a way to clone him so that we can place at least one in every major game development studio.

Yes, it's such a shame that there's this inverse relationship between computer prowess and procreation prowess, or we could have a bunch of 20 year old mini-Sids slaving away in our secret game mines right now.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom