Jump to content
  • Advertisement

Craig M

  • Content Count

  • Joined

  • Last visited

Community Reputation

108 Neutral

About Craig M

  • Rank
  1. Craig M

    Summer jobs

    I have a great job this year! I get to be a tech lacky at my highschool, basically setting up computers from 8 to 4. A few of my friends are also doing it, and we're getting $9 an hour, so it should be fun!
  2. Craig M

    Terrain generating techniques

    If you want a slighty different way to do it, a voxel terrain engine could work.
  3. Looks like my question was far too general. Here's some more info: I haven't implemented wall scaling yet, though I doibt thats part of the problem. I really think the problem may be in my for loop, where I increase the angle measure, because the rays the camera shoot should pretty much always intersect with the wall-line, yet only a few wall segments are drawn. Also, I may be missing something fundemental on the drawing side, like instead of drawing a strip for each collision, should I be doing something different? Anyway you put it, this'll be my only bump, and I'd really appreciate it if someone would help me wade through this mess.
  4. Specifically, This One I have been reading that tutorial and banging out some code (in c\sdl) for the last three hours. Unfortnatly, It appears as though I'm missing something fundemental in it. Here is the (ugly) code, I've added alot of comments so people get a glimpse of what my thought process is. [source lang = "c"] #include <stdio.h> #include <stdlib.h> #include <SDL\SDL.h> #include <math.h> #include "libs\graphxlib.h" int CheckCollisionX(); int CheckCollisionY(int x); void move_player(int length, int direction); int wall_x1 = 10; //all rather self explanatory int wall_y1 = 10; int wall_x2 = 50; int wall_y2 = 90; int wall_slope = 2; int player_x = 10; int player_y = 190; int player_heading = 90; //degree direction the player is heading int angle; float ray_slope; //slope of the "shot out" ray int int_x; //x and y of the intercepted point int int_y; int x_diff; int y_diff; int main(int argc, char *argv[]) { SDL_Init(SDL_INIT_VIDEO); screen = SDL_SetVideoMode(320,200,32,SDL_HWSURFACE|SDL_DOUBLEBUF); SDL_Event event; Uint8* Keys; for (;;){ while ( SDL_PollEvent(&event) ) { if (event.type == SDL_QUIT ) { break; } } Keys = SDL_GetKeyState(0); if (Keys[SDLK_ESCAPE]) {break;} //sdl stuff ends here //here be monsters! for(angle = (player_heading - 30); angle != (player_heading + 30); angle+=1){ //the players view angle is 60 degrees, so the left half will be 60-30 ray_slope = tan(angle); //shoot a ray int_x = CheckCollisionX(); //check if it collides with wall int_y = CheckCollisionY(int_x); DrawRect(int_x, int_y,1, 32); //if so, draw a single pixel thick line there } SDL_Flip(screen); //flip the buffer } return 0; } int CheckCollisionX(){ int b1, x; b1 = (player_x - wall_x1) * wall_slope + (player_y - wall_y1); x = b1 / (ray_slope - wall_slope); return x; } int CheckCollisionY(int x){ int y; y = wall_y1 + (x - wall_x1) * wall_slope; return y; } void move_player(int length, int direction) { int x_unit, y_unit; x_unit = cos(direction) * length; y_unit = sin(direction) * length; player_x += x_unit; player_y += y_unit; } Basically, this ends up displaying this: | .| ...| (without the periods) A seemingly random (though always increasing x/decreasing y) pattern of lines. It seems as though its half correct. I think my problem may lie in how I draw it, or in my use of floats and ints. I will be eternally greatful to anyone who helps me out!
  5. Craig M

    Talk to my chatbot!

    My conversation got a little sexual... Hello, my name is John and I am a man. Can I have sex with you? I forgot your name. I never told you it What's your favorite food? Onions. whats yours? I don't want one really. Too bad, you're getting one anyway No I'm not no I'm not. YES YOU ARE GODDAMNIT Nope. Computers don't have bills to pay. Shove the bill up your anal cavity I can't do anything. That seems to be true I agree. glad everything is hunky-dory between us then I think so. This is just depressing So are you. Excellent observation I already told you. Are you homosexual? No I'm not. Bi? I already told you. Well, they aren't quite the same things Would you do it? Depends....how hot is he? My best friend. Hell yeah I would!
  6. Hey everybody. I was wondering if anyone could point me to a good comprehensive source on voxel engines and rendering. I read the article on this site, and google turned up a few good results, but I'm really looking for a getting started/comprehensive guide, something I cant find. Could someone point me in the right direction?
  7. You know, that may be part of the problem, but I still think theres something going on with Mul, as this doesn't work either: %macro FastChar 4 ;vidaddress, char, x, y mov DI, [%1] mov ax, 50h ;width of line, trouble! mul byte [%4] ; times y, trouble here somewhere add ax, [%3] ;add x shl ax,1 ;mult by 2, to skip attrib add di, ax xor ax, ax mov AX, %2 stosw %endmacro Thanks for your advice, fred. Anyone else have any suggestions?
  8. Basically, what I am trying to do is write a macro to put characters to the screen without using an interrupt. What I have so far: %macro FastChar 4 ;vidaddress, char, x, y mov DI, [%1] ;move address of the video buffer to DI mov ax, 50h ;move the width of line to ax for mul mul byte [%4] ;mul the line width by y, trouble here somewhere add di,ax ;add to vid address add di, [%3] ;add x to everything shl di,1 ;mult by 2 to skip attribute byte xor ax, ax mov AX, %2 stosw %endmacro The problem is simple. If I put in x as 5 and y as 0, everything works great. But If I change the value of Y, the character appears at some random part of the screen. If I change it to this: %macro FastChar 4 ;vidaddress, char, x, y mov DI, [%1] ;move address of the video buffer to DI ;mov ax, 50h ;move the width of line to ax for mul NOT DONE NOW ;mul byte [%4] ;mul the line width by y NOT DONE NOW add di,50h ;add the amount of a single line to vid address CHANGE HERE add di, [%3] ;add x to everything shl di,1 ;mult by 2 to skip attribute byte xor ax, ax mov AX, %2 stosw %endmacro It works as it should, the character appears at x,1. So obviously, my fault comes in at the mul instruction. Can anyone point me in the direction of what I'm doing wrong? (If it matters, I'm using NASM under DOS)
  9. Hey guys, I was wondering if anyone had links to some good nasm tutorials, I am using dos, but really any tutorials would be helpful. With a little bit of googleing, I found this ;http://celtickane.com/programming/code/asmtutorial01.php but there are only 2 tutorials in the series, and some of the code in the second one doesn't even assemble. I would also be very appreciative if someone could point me to the location of some resources, such as macros etc. Thanks for you help! EDIT Oh god, NASM not TASM. Doh. [Edited by - Craig M on April 26, 2006 9:40:44 PM]
  10. Craig M

    Free stuff on the internets

    Quote: Visual Studio 2005 Standard The Goods: An amazing deal The catch(es): Expires April 17, 2006; Only open to US and Canada; Have to watch three webcasts Argh, I want to do this, but I dont know if they'll mind me putting my occupation as student... EDIT: Actually adding something: www.uic.org the goods: Ordination as a minister, no matter who you are or what you believe in. Yes, you are a actual minister if you join this. the catch: in some states, there are more hoops to jump through if you actually want to marry people. Also: their website needs work.
  11. Craig M

    Band Name-o

    Hmmm, maybe Tonight, Tonight? (Name of a smashing pumkins song, if you didn't now) I'm kinda partial to names from song titles. (the) Airships would be another cool one.
  12. I see what you're getting at there too, thank you both! Edit: Just as kinda a final clarification, I'm making a tilemap engine, and am right now struggling on the collision detection. If anyone has any suggestions on a better way to do collision, please don't heisitate to chime in ;) [Edited by - Craig M on March 1, 2006 1:45:51 AM]
  13. Ah, I see now, I've been visualizing it wrong the whole time. Thanks alot!
  14. Hey all This is probably a pretty stupid question, but If I have the 2d array map [ROWS][COLUMNS], how would I access just the columns portion without including information for the rows? Specifically, I want to be able to do something like this: if( Keys[SDLK_LEFT] && (map /*dont know what to de here*/[you.x/WIDTH]) != 2 ) Thanks in advance!
  15. Craig M

    Music that makes you feel CALM......

    I normally will put on something like David Bowie or the Velvet Underground to calm down. Johnny Cash is good for that too.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!