• Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About FiveFootFreak

  • Rank
  1. Do i need a good PC for.....

    Since the first game you should probably code is Tetris, and even textual output would be just fine for a Tetris clone, you could, in theory, use any machine you come across for the first year or so of your programmers career. It may be difficuilt finding the right tools for prehistoric PCs, so just get anything relatively decent without spending too much cash. Should be just fine for coding and you wont code Unreal anytime soon anyway.
  2. [java] getting started with Java help

    Try the Java Tutorial It's also labeled "Getting started", but I don't think it's the same as the "Getting started FAQ" you mention, and it's pretty good. It worked for me. ;)
  3. [java] Thread.sleep

    @Thygrrr Thread.yield() takes no parameters and doesn't return a value, so how do I know how long it yields? Do I need to surround it with calls to System.currentTimeMillis(), like with gameLogic() and updateGraphics(), to see if sufficient time has ellapsed to continue, or is there a "smarter" way of using it?
  4. [java] Thread.sleep

    Thanks for the replies, I'll check into Thread.yield() and into Timer to see what suits me best.
  5. Greetings, this is my very typical game loop (simplified): while(running){ startOfLoop = System.currentTimeMillis(); gameLogic(); updateGraphics(); endOfLoop = System.currentTimeMillis(); loopTime = endOfLoop - startOfLoop; while (loopTime < 50){ try { Thread.sleep(5); } catch (Exception e) {} loopTime += 5; } } As you can see, I'm aiming for 20fps. That's why the inner while-statement checks to see if the looptime is lower than 50ms. If it is, the threads sleeps for 5ms and 5ms are added to the counter, until it's over 50. After experimenting with different sleep values I found that using high values above 20 made the application eat upto 90% of total CPU cycles (I looked it up in the task manager). At 10, this slumped to about 30% and at 5 it's about 15%. I was wondering, why is it, that higher precision requires less CPU time? Is there a way to calculate an ideal value for sleep()? Or should you always use Thread.sleep(1)? I felt uncomfortable with that, thats why I left it at 5. What actually happens inside Thread.sleep()?
  6. C# = the future?

    Microsoft is evil. All that is required for evil to triumph is for good men to use .NET
  7. [java] Eclipse JDT uses own compiler?

    So, does the Eclipse compiler produce the same bytecode as the Sun compiler in the end? And if not, is there a significant difference in performance between these two? If it says "15% performance increase in next Java version" on the Sun website, does it affect Eclipse developers at all? What has the greatest impact on performance, the compiler or the VM used?
  8. Greetinx, I was searching the Eclipse site for info on when the new Java 5 features will be supported, when I stumbled onto this: Quote: JDT Core is the Java infrastructure of the Java IDE. It includes: An incremental Java compiler. Implemented as an Eclipse builder, it is based on a JCK1.3a compliant compiler evolved from VAJ compilers. In particular, it allows to run and debug code which still contains unresolved errors. What does this mean? I thought Eclipse uses the javac compiler of the JDK you specify, but this sounds, as if Eclipse has its own compiler. Here is the whole document:
  9. [java] Calling methods from paintComponent()

    Okay, nevermind... this works, the error was somewhere else in my code. Always make sure the radius is greater than zero before trying to draw circles... :\
  10. Hi there, anyone know why calling methods from "paintComponent" and passing the graphics context as argument doesn't work? Like this: public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D)g; someObject.paintYourself(g2); } The drawing code in "someObject.paintYourself" doesn't work. But it works if I put the code directly into paintComponent. Is the use of g2 only allowed inside the "paintComponent" method? But how can Java tell, that I'm in some other method and just passed g2 as argument?
  11. [java] Opinions on Java IDEs?

    Emacs IS an excellent editor. You can customize it to do almost anything you like. Problem is, you first have to invest lots and lots of time in it, before you can actually exploit it's power.
  12. [java] Problem With Algorithm

    First of all, you should use ArrayList instead of Vector, unless you require synchronization. You implement both the sorting and the "if power is equal, add coefficients" method in "sort". This should be done sepperately. For the sorting, "Monomical" should implement "Comparable" and then you should use the "java.util.Arrays.sort()" method to do this for you. The other immediate thing I can see is: in the "sort" method: if(difLength != monomials.size()) { for(int i = 0; i < monomials.size(); i++) { Monomial testObject = (Monomial) monomials.elementAt(i); for(int j = 0; j < monomials.size(); j++) { Monomial currentObject = (Monomial) monomials.elementAt(j); if(currentObject.getPower() == testObject.getPower() /*&& (currentObject.equals(testObject))*/) { testObject.setCoeff(testObject.getCoeff() + currentObject.getCoeff()); monomials.removeElementAt(j); j=0; } } } The two "for" loops both iterate through the whole size of "monomials". Thereby, every Monomial gets compared to itself, the powers of itself are added and then the object is removed. That's all I can help you with at the moment. Sorry for not providing any coded solutions... I'm drunk. :\
  13. [java] Opinions on Java IDEs?

    Loading an existing projetct into Netbeans is a real pain. I also found it alot slower than other IDEs. I also give my vote to Eclipse. It's powerful, solid, extensible and has a big community providing lots of useful plugins for it, or you can develop your own. Apart from that, you can use Eclipse for C++, UML, and lots of other things as well, if you install the corresponding plugins. If you have the cash, I can also recommend IntelliJ. I think it's the best commercial Java IDE. But I'm not sure if it's worth spending money here. Eclipse can do almost everything that IntelliJ can do, and it is being improved all the time.
  14. C and returning string

    A string is an array of chars. To access an array of chars you need a char pointer to a char array. I haven't programmed C recently, but I believe it should look something like this char [] someFunc(){ return (a char[]); } or using pointers: char* someFunc(){ return (a char*); }
  15. Programming Role Playing Games with DirectX 2nd ed

    Usually DirectX version changes are no big deal. Only in some cases (like the removal of DirectDraw from DirectX7 to DirectX8) would you actually notice it, especially if you are new to programming DX and wont use any ultra-shiny-spicy functions anyway. But if you really need to know, check the authors site or reviews on Amazon.