Jump to content
  • Advertisement

Venerable Vampire

  • Content Count

  • Joined

  • Last visited

Everything posted by Venerable Vampire

  1. Venerable Vampire

    Projection in the middle of View

    The way you are doing it, which is fairly consistent with the way OpenGL works, has the point at 0,0,0 in 3d space being translated to the center of the screen. What you need is for an object to be shifted out of the screen by a number of units along the z axis so as to make it appear. There is no easy formulaic thing for determining a 'correct' distance because you usually don't want it to be based on that but on user input instead (games, 3d modellers, etc.). Just pick your projection value and fiddle with z values untill it looks right. On another note, your projection distance can be calculated from the screen width and the field of view you want. projection_distance = width/2/tan(field_of_view/2); Note that tan is a trig function, and is usually in radians.
  2. Venerable Vampire

    why won't this work??

    I assue from the private static final thingy you are in Java, so I have two things. 1. private static final int The keyword "final" there indicates that the variable cannot be changed after initialization. So you usually give it a value in the same statement as the declaration, as in your first (working) example. 2. outside of methods variable declarations are permitted, but assignments are not. So: private static final int GAME_STATE_INTRO = 0; is perfectly valid outside of a method. While: GAME_STATE_INTRO = 0; is not, unless you did that in main, but then a conflict might arise over the final keyword, not sure.
  3. Venerable Vampire

    Pong help

    I agree with the people above me, and I must recommand that you do two things, in order: 1. put pong on hold for a little while. If you really are just that new to programming, you don't want to consider graphics yet, much less user interaction or animation! Learn your language. You mentioned C. C is a great language, go find websites about it. Learn all you can about it untill you really think you can do it. I learned Java to quickly and was frustrated for about 6 months where I did little to no coding. Don't do that! 2. Get something like Allegro or SDL. You said simple, but those are about as simple of graphics as you can possibly get. I haven't used Allegro, but I know SDL does everything for you and lets you do graphics, user-interaction, and animation with little to no trouble. Learn how to do some kind of simple demo with each of those first, then try pong. 3. Have fun!
  4. Venerable Vampire

    Engine of Colin McRae Rally

    I also would not like to start a flame war, but how can you even suggest that Micro$oft would even think of PORTING DIRECTX. It's like a staple of windows.
  5. What are you using? GLUT - glutSetCursor(GLUT_CURSOR_NONE); <--- maybe, not sure SDL - SDL_ShowCursor(false);
  6. Venerable Vampire

    moving problems.

    OK in SDL when you press a key the key pressed event that is generated only occurs once, and the released event also only occurs once. You can't just poll the loop to see if the key was held. Suggestion: Make an array of boolean variables, like 256 or 512 in size. When a key is pressed, set the boolean with that key value to true, and released set it to false. So every loop when you need to move something or check a key press, check the array and not the actual event queue.
  7. Venerable Vampire

    Any explanations for this.

    In OpenGL near plane values of less than 1 can cause artifacts. Just use 1 if you can.
  8. Venerable Vampire

    Problem rendering colored spheres on Mac

    java stuff works exactly the same on every platform supported, mac included. The problem is most likely that the Java3D library is not installed, or not installed correctly. I haven't used Java3D much, or recently, but it may be that a special linkage needs to be used. Specifically what kind of problems are you having?
  9. Venerable Vampire

    Java Engine

    Definantly an application. As an applet you can't get total control of the screen or some other stuff that really allows for a fully-imersive demo/game/thingy. If you want to impress your teacher/classmates make a simple 3d game or rotating (fill in cool shape). Or a wave simulation.
  10. Venerable Vampire

    vector versus array - a race

    you're thinking of lists, like linked list in the 'list' class. Those are much more 'dynamic' that just straight arrays, but usually you don't need all that and it is better to use vectors because it's just as fast to access in the middle as it is to increment along it.
  11. Venerable Vampire

    How to deconstruct a game...?

    c compilers can usually give you the assembly source for a particular source file. I think the *nix syntax is somthing along the lines of: gcc myfile.c -S and returns a file myfile.s or something
  12. Venerable Vampire

    problem with exercise in C++ book

    kbhit is a command that checks to see if a keyboard key was pressed, and maybe returns the value (it's not cross platform so I've never used it). A slightly better (more cross platform) solution might be to use getchar() until the char is a new line ('\n'). That way it'll pause until you get the return or enter key's pressed. An even better solution would be to not worry about it until you get into the really fun stuff, like graphics with SDL, Allegro, even GLUT (shudders). Have Fun!
  13. Venerable Vampire

    how would i go about doing this (java)

    Quote:Original post by lucinpub That is the sign of a very poor design. If this is your project and not just some exercises from a book or something, you need to rethink the design of your system. When only considering "good" code verses "bad" code, I agree 100%. That being said I have written a Sokoban Clone (In Java) where virtually every class was connected to it's "owner" (the main class) to retrieve data to perform calculations. It was easier than passing a bunch of variables for every function call. The game worked, and I might still have it.
  14. Venerable Vampire

    how would i go about doing this (java)

    When you are passing classes in Java, what you are really passing is the POINTER to the class. So when you initialize A first, with the argument of B, A gets a null pointer in whatever variable should hold the reference to B, which is bad. So instead do something like this. ClassA myClassA = new ClassA(); ClassB myClassB = new ClassB(); myClassA.setInstance(myClassB); myClassB.setInstance(myClassA); With each class having a member variable of the other's type, and the setInstance function setting that variable to the value passed. That should work.
  15. Venerable Vampire

    Learning Experiment

    I have been reading some articles about parsing/compiling programs and I decided to try my hand at writing an interpreter of my own. I made a little calculator similar to some lex/yacc examples out there, but without the lex/yacc, just as a learning experience. If anyone cares to read through the source and point out glaring errors I would be quite thankful. I plan to eventually write a toy language without the aid of lex/yacc so I need to understand this stuff. source
  16. Venerable Vampire


    On a sort of almost related note, sranddev is a function that auto-seeds based on time, with no extra function call. It saves like 4 key-strokes. Wow. Also there is actually a function random (and conversly srandomdev), which might be a more even distribution? Not sure.
  17. Venerable Vampire


    One word, SDL. It allows a fast, low-level graphics setup and when coupled with the many many extensions it lets you do graphics, images, sounds, fonts, networking, etc. with very little actual code. In short: It's cool.
  18. Venerable Vampire

    My first game

    on a side note, SDL!!!!!!!!!!!! Its portable, which is cool. (Especially for us mac people :))
  19. Venerable Vampire

    Compiler Creation

    Does anyone know of any good tutorials online for compiler creation? I ordered a book but it won't get here for a while. :(
  20. Venerable Vampire

    Compiler Creation

    Thanks everyone, I'm currently checking out the pdf and I'll look at the online article later. Combined with the book (if it ever gets here) I should be able to fiddle around. Thanks again!
  21. Venerable Vampire

    string - char *solved*

    Ah, then like it was said above use the method strcpy on 2 char arrays, or use the = operator on 2 std:string (make sure these are NOT pointers)
  22. Venerable Vampire

    string - char *solved*

    no you can't do that. You are assigning the pointer. Overload the '=' operator to do strcpy or something.
  23. Venerable Vampire


    On a not-so-semi-related note: I was thinking about this same question and the subject of actually WRITING my own compiler for it came up. Any tutorials on compiler design and creation, maybe using those wonderful tools I've heard so much aboue (lex and yacc)?
  24. Venerable Vampire

    Mode 13h graphics

    SDL. It can be a pain to setup on some platforms but the windows install is fairly basic (I use a mac and it pissed me off for a while :() It is UBER-basic and it has all kinds of 3rd party add-ons for sound, image loading, networking, fonts, etc. It also lets you create an OpenGL context to play with 3D. Check out CLICKY
  25. Venerable Vampire

    problem to read important chunks in a .3ds file

    LOL, you're doing exactly what I did just recently when writing this same loader. When you read in chunks, and declare them in the switch, make sure that chunks that actually have data, like 0x4000, that you READ that data. As it is as soon as you recognize the type you exit. For testing purposes either remove chunks that have some data or read the data. If you don't it just reads in the next chunk type as garbage and messes up badly! Trust me, I've been there :D Otherwise looking good!
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!