Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Nov 2009
Offline Last Active Jul 10 2012 04:31 PM

Topics I've Started

How to handle update-rate?

03 January 2012 - 03:19 PM

Have been working a little on a tile-based game/simulator to test and display different AI behaviour on my laptop. When running the simulator on my regular computer an uncapped framerate will obviously make the simulation go much faster.

The most obvious solution to the problem with too fast framerate was time.sleep(0.5) which made it run at (about) 2 FPS.

The second, also obvious, solution was to get the time it took to iterate one step, then subtract that from 1000 / 60 which made it run at (almost exactly) 60 FPS.

But what happends the other way around? Assume that I have two computers and tell them both at exactly the same time to move from A to B (without either of them being connected to the other, ultimatly controlled by a server). The first computer runs at 2 FPS and the second runs at 2000 FPS. How can I calculate the relative speed per update if I want them both to arrive at B, at the same time?

Writing this, I'm assuming that I'd have to multiply the time it took for each update with a distance per second value. But as it's tile-based both the minimum and maximum movement is 1. It would of course be possible to increase dx, dy until they were greater than 1, but that doesn't seem good enough as it could still differ as much as 1 / FPS seconds between the results.

As my above thoughs might seem a little messy, how can I normalize update-rate between different hardwares?

[C# XNA] Simple draw?

05 December 2009 - 08:50 AM

Hey there! I've been looking at C# and XNA for a few hours now and I think it's pretty ok. I have no problems when I'm trying to draw sprites, but I can't find anything about drawing simple lines or rectangles in 2D? I've found a few examples on drawing 3D lines on a 2D surface, but they need alot of code and is fairly complex for such a simple task.. Could someone please point me in the right direction.

Which language to choose?

02 December 2009 - 07:20 AM

I've decided to pick up game programming on my spare time but I can't decide on the language. I'm not planning to write anything that really needs the extra speed C++ provides, so first I thought I'd use Java. I pretty much finished a basic arcade engine I can use to write simple games, but the more I write the more I dislike the restrictions of Java.. My current goal is a multiplayer isometric game that can run with atleast 50 players at the same server, so not that massive. But I'm wondering if I should go with C# instead, what would you suggest, which language is better suited for game development?

[java] Which surface to use?

21 November 2009 - 01:45 PM

Hello there! I've been reading some tutorials about java 2D Graphics and game programming. But there's alot of diffrent ideas on how to design the games and which surface to display the game on. 1. Which surface to use? Should I use a JFrame, JPanel, BufferStrategy or something totally different as my surface when I draw? With JFrame and JPanel I'm having trouble with the drawing, I can't get any other method than paint to draw something even when I get the surface.getGraphics() from another method. With BufferStrategy it seems like I can't draw anything in color, just grey or black.. Although I can draw pictures without problem. 2. Which Graphics object? Should I use the Graphics or the Graphics2D object? And if using the Graphics2D object, what effect will these lines of code have to the drawing? Except making it "smoother" (according to the article where I saw it).
        RenderingHints rh =
            new RenderingHints(RenderingHints.KEY_ANTIALIASING,