Well here is the Remake of rhy's awesomely programmed game called Line Racer.
I need your help for it btw
1.Can som1 suggest me File structure for the mapfile plz
2. am also gonna add a sorter to sort out what to draw in the map .
3. Rhy will u plz gimme the algorithms to implement race rulez now.
4. What Kinda Music u guyz want? MIDI or MP3
5. What shall i use Polygons with 3d Rendering or Lines with 3d rendering
6. Have u got C++ Compiler if not i will Upload it as a standard executable
PLZ HELP
and btw here is the ripped out source code of the game (dosnt has A MAP import alogrithm and no sound too so far its jst the Title Screen (typical DG games style))
The code is highly commented to Tell u guyz what it does especially ones who dont know about Code based languages
//This is Source code in C++ for Rhy's Line Racer MADE BY Fanofcena AKA Abhishek Hingnikar
//Header files . (these are the basic thing that tell the computer what to do)
#include<iostream.h> // For basic In and out funcions
#include<graphics.h> // For Graphics
#include<Math.h> // for mathematical functions
#include<conio.h>// for keyboard Initialisation
#include<dos.h> // For MSDOS functions
#include<stdlib.h>//For some basic functions
#include<stdio.h>//For most
//Basic Functions(could be termed as scratch blocks) and Strutures( group of variables for an object)
// Coor declares a coordinate in 3 dimensions
struct coor{
int x;
int y;
int z;
};
//coor_xy is teh coordinate in 2 dimensions
struct coor_xy{
int x;
int y;
};
inline char keystroke() // To check if a key is pressed and if pressed which one is pressed
{
if(kbhit())
{return getche();
}
else
return 0;
}
inline coor_xy PntPos(coor P,coor Cam,int xrot,int yrot,int zrot,int f_len) // The rhy's Gale1.2a programming this is how it looks in C++
{ int xy=(P.y*(cos(yrot))-P.z*(sin(yrot)));
int xz=(P.y*(sin(yrot))+P.z*(cos(yrot)));
int yz=(xz*(cos(xrot))-P.x*(sin(xrot)));
int yx=(xz*(sin(xrot))+P.x*(cos(xrot)));
int zx=(yx*(cos(zrot))-xy*(sin(zrot)));
int zy=(yx*(sin(zrot))+xy*(cos(zrot)));
int SFR=(f_len/f_len+yz+P.z+Cam.z);
coor_xy ret;
ret.x=(zx+P.x-Cam.x)*SFR;
ret.y=(zy+P.y-Cam.y)*SFR;
return ret;
}
inline int dist(coor P,coor Cam) // To find distance of 2 points I will use Draw distance
{ return sqrt(((P.x-Cam.x)*(P.x-Cam.x))+((P.y-Cam.y)*(P.y-Cam.y))+((P.z-Cam.z)*(P.z-Cam.z)));
}
void main() // This is the main thing that runs ie the When Flag clicked this thing runs :D though u can only have 1 main
{ coor Camera; // Here is the declration of a coordinate camera
//Lets initialise our camera at the starting position
Camera.x=-100;
Camera.y=0;
Camera.z=-200;
// The focal length
int focallength = 10;
// INITIALISATION OF GRAPHIC DRIVERS
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy, i;
/* initialize graphics, local variables*/
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error
occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with error code */
}
char game ='y'; // a variable of type character that tells if the game loop has to be run or not
do{ settextstyle(GOTHIC_FONT,0,5); // This sets the text style to Gothic Font with size 5 and Horizontal typing
for(float i=0;i<30;i+=5)// A loop that runs 6 times
{
cleardevice();// the clear button
setbkcolor(GREEN);//sets background color to green
setcolor(i);// sets Pen color to variable value i
outtextxy(100,200,"Credits to Rhy & BWOG");
delay(400);// Halts the screen for 400 miliseconds
}
cleardevice();
settextstyle(SANS_SERIF_FONT,0,20);
outtextxy(190,140,"DG");
settextstyle(SANS_SERIF_FONT,0,5);
outtextxy(190,260,"Games");
delay(900);
cleardevice();
settextstyle(0,0,6);
setbkcolor(BLACK);
setcolor(GREEN);
outtextxy(10,10,"Line Racing");
getch();
settextstyle(0,0,2);
outtextxy(0,180,"To Begin race press key");
outtextxy(0,220," no options so far");
getch(); // Halts the screen to the menu
char RACE='t'; // Declares and sets a variable RACE to t which tells the Computer that race is going on
coor Map[100];// Here is your map space a list which contains 3 coordinate per element :D
float Vel,Theta; // Variables for our car
do
{ cleardevice();//This gives us a fresh screen to paint
for(int i=1;i<=100;i++)// Prints the MAP ALL AS WHOLE MUWHAHAHA C++ HAS NO PROBLEM PASTING THE WHOLE 100Point map its too mere for it :p
{
lineto(PntPos(Map[i],Camera,0,0,0,focallength).x,PntPos(Map[i],Camera,0,0,0,focallength).y);// This function draws line from current point to the given point
}
char k = keystroke(); // sets a character variable keystroke to the keypressed
if(k=='w') // Accelerates your car
{ if(Vel<12)
Vel=Vel+1;
}
else if(k=='s') // Brakes!!!!!!
{ if(Vel>0);
Vel=Vel-1;
}
if(k=='a') // here we built the steering wheel though i think of using mouse rather then keyboard for directional control
{ Theta = Theta+10/Vel;
}
else if(k=='d')
{ Theta = Theta - 10/Vel;
}
if(k=='q')
{ exit(1);// this means if Q is pressed the program will exit
}
// The following code tells the car to move
Camera.x= Camera.x+Vel*cos(Theta);
Camera.y= Camera.y+Vel*sin(Theta);
delay(2);
}while(RACE == 't');
cleardevice();
outtext("Do u want to Quit(y/n)");
game= getche(); // Sets Game to N when the race is done and U want to quit;
if(game!='y'&&game!='n')// if game is not y or n starts a loop to ask
{ do{ cleardevice();
outtext("Please enter a valid choice(y/n)");
game= getche();
}while(game!='y'&&game!='n);
}
}while(game=='y'); // Runs the loop till game = Y
}Thankz in advance
your friend
Fanofcena
Last edited by fanofcena (2010-04-20 10:13:33)
Offline
fanofcena wrote:
1.Can som1 suggest me File structure for the mapfile plz
2. am also gonna add a sorter to sort out what to draw in the map .
3. Rhy will u plz gimme the algorithms to implement race rulez now.
4. What Kinda Music u guyz want? MIDI or MP3
5. What shall i use Polygons with 3d Rendering or Lines with 3d rendering![]()
6. Have u got C++ Compiler if not i will Upload it as a standard executable
1. What are you talking about.
2. I don't have one.
(3 is for RHY, I suppose)
4. MP3 if it doesn't make it too heavy.
5. I think lines only (like Gale3D) would look cool. Did I understand your question well?
6. No.
Last edited by technoguyx (2010-04-20 11:34:04)
Offline
3. Erm... Well...
I truly can't be bothered coding 3D recently.
Offline
technoguyx wrote:
fanofcena wrote:
1.Can som1 suggest me File structure for the mapfile plz
2. am also gonna add a sorter to sort out what to draw in the map .
3. Rhy will u plz gimme the algorithms to implement race rulez now.
4. What Kinda Music u guyz want? MIDI or MP3
5. What shall i use Polygons with 3d Rendering or Lines with 3d rendering![]()
6. Have u got C++ Compiler if not i will Upload it as a standard executable1. What are you talking about.
2. I don't have one.
(3 is for RHY, I suppose)
4. MP3 if it doesn't make it too heavy.
5. I think lines only (like Gale3D) would look cool. Did I understand your question well?![]()
6. No.
with 1 i meant that as C++ can open a file so we can have map stored in a different file
u understood ma question on 5 very nicely btw i can do it Textured 3d but as the name is line racer i will stick with lines
and RHY !!!!!!!!!
I am too confused on rules
Offline