Show Posts
|
|
Pages: [1] 2
|
|
3
|
Discussions / General Discussions / Re: The Scoop on webstart.
|
on: 2011-04-12 00:29:21
|
If I made a webstart, would I have to edit all the source code to work with it?
No. Webstart is very easy to integrate with a Java desktop application. I would definitely recommend using it, but you can wait if you want without having to worry about it.
|
|
|
|
|
5
|
Game Development / Performance Tuning / Re: Can I draw thousands of sprites with good performance?
|
on: 2011-04-11 15:47:02
|
|
You could definitely get better performance than that. Think of how many triangles a modern game spits out at 60 fps. You are probably not reaching super fast performance because of bandwidth. You may be trying to send too much information to the graphics card each frame. With that said, ask yourself if you actually need more performance. If you are getting 60 fps and you are drawing what you wanted to draw, then don't worry about it. Maybe latter you can try to step that up for low end machines, but there is not much of a reason to spend time optimizing until you are nearly done.
|
|
|
|
|
6
|
Games Center / Archived Projects / Re: Gilbert-Johnson-Keerthi algorithm demo (2D)
|
on: 2011-03-24 00:42:30
|
|
I am just maintaining the velocities. I add an vector pointing to the center of the screen to each object's velocity, and if two objects are intersecting I push their velocities apart. Basic rigid body physics is the easy part. I already have a class for that, just didn't use that here for some reason. The hard part of physics is satisfying constraints.
|
|
|
|
|
7
|
Discussions / General Discussions / Re: Eclipse vs. Netbeans
|
on: 2011-03-23 13:28:24
|
I can't tell about NetBeans, cause I've never used it . But what I've noticed is that you'll become a fan of the first one you start using (since both are good) . So pick your choice carefully !
It was actually the opposite for me. I used Eclipse first then switched to NBs. I first used Eclipse a few years ago and at the time the interface was kind of clunky. Since then, they have made a lot of improvements. Now it is pretty much entirely personal preference. If there is some specific feature you really want, there may be some difference, but for the general user there really is no wrong choice.
|
|
|
|
|
9
|
Games Center / Archived Projects / Re: Gilbert-Johnson-Keerthi algorithm demo (2D)
|
on: 2011-03-23 03:57:10
|
Really nice! Can you really create custom shape easily and it will work ''out of the box'' with the physic engine? I wonder if it's more flexible than other physics engine. Sometimes I feel kind of restrain by the physic engine so that I need to change all my code to match with it while I thought it would be nice if you could match the physics engine code to your game. Anyway that's probably just me.
Btw, I keep 100 fps and 100 ups up to 300 objects. After that it drop.
This is only collision detection right now, but one of the nice things about GJK is you just need to implement the support function to use any shape. From a code perspective, there is a Collidable interface with the getSupport function. Any two shapes implementing that can be tested for collisions. Once I add some real physics to this, a rigid body would contain a list of Collidables that define its area. It would then be strait forward to add a new shape such as a capped rectangle or ellipse or whatever. So in answer to your question, yes it would be easy to add a new shape. Changing other aspects of the physics would as usual be more difficult.
|
|
|
|
|
10
|
Games Center / Archived Projects / Re: Gilbert-Johnson-Keerthi algorithm demo (2D)
|
on: 2011-03-23 01:47:54
|
|
It is interesting how quickly the performance collapses. There is probably something else going on other than the CPU load. Maybe the memory bandwidth becomes the bottleneck or something with the JVM. I'm not going to bother digging to deep into this because with a good broad phase, it all becomes kind of irrelevant.
|
|
|
|
|
12
|
Games Center / Archived Projects / Re: Gilbert-Johnson-Keerthi algorithm demo (2D)
|
on: 2011-03-22 04:30:17
|
My favorite thing is that you can test any two shapes you define a support function for. The collision detection algorithm doesn't need to know anything else about the shapes or how they are stored.
Minor correction: any two convex shapes, but you can decompose most complicated concave shapes into convex approximations, which is good enough for physics engines. Yes, the algorithm is intended for only convex shapes. If you correctly create your support function, it will actual define the shape of the tightest convex hull regardless of whether or not the shape itself is convex. Sort of an unusual property, but it could actually be useful for some situations. There are some other interesting things that I am looking into. It may be possible that for a shape that is offset and rotated, to not actual need to transform the shape at all. For an offset shape you just add the offset to the returned support point, rather than offsetting all the points first. I am not entirely sure, but for a rotated shape you may be able to rotate the direction vector before asking for the support, then unrotate the returned point. Combining these two means you would never need to actually transform a polygon for example. This would be a big plus and would also open the opportunity to make some form of hashed support look-up for polygons because the geometry would be static. I am still working through some of this, but it seems like there is a lot more potential for optimization.
|
|
|
|
|
13
|
Games Center / Archived Projects / Re: Gilbert-Johnson-Keerthi algorithm demo (2D)
|
on: 2011-03-22 03:11:58
|
Are there any good tutorials or articles about this algorithm, since I have never heard of it before?
There is a good video at the top of this page http://mollyrocket.com/forums/viewtopic.php?t=245. It discusses GJK in the 3D case where there is a greater benefit to using it. This page http://physics2d.com/content/gjk-algorithm has a good tutorial as well. The GJK algorithm is commonly used for 3D collision detection. It is not used as often for 2D because SAT is about the same speed and less complicated. That's not to say there is no benefits to GJK for 2D. My favorite thing is that you can test any two shapes you define a support function for. The collision detection algorithm doesn't need to know anything else about the shapes or how they are stored.
|
|
|
|
|
14
|
Game Development / Newbie & Debugging Questions / Re: Applet/frame low fps problem
|
on: 2011-03-22 00:03:21
|
clearRect and fillRect do the same thing except one uses the background color and the other uses the current set color, respectively. Plus I meant the Applet one is fine. The JPanel example is the one that needs fixing  If I recall correctly, fillRect just paints over the specified rectangle with the color while clearRect replaces the pixels with the background color (try this with partly transparent colors) From the JavaDoc "Beginning with Java 1.1, the background color of offscreen images may be system dependent. Applications should use setColor followed by fillRect to ensure that an offscreen image is cleared to a specific color". You can setBackground from Graphics2D or for the underlining component to control this. I don't know if there is any performance difference between the two operations.
|
|
|
|
|
15
|
Games Center / Archived Projects / Re: Gilbert-Johnson-Keerthi algorithm demo (2D)
|
on: 2011-03-21 23:55:38
|
Do you have any plans to add the Expanding Polytope Algorithm to the collision detection for interpenetrating objects?
Yes. I would like to expand this enough so that it can be used for physics simulation where it's useful to have a bit more information. I haven't done enough research into EPA to implement that part yet, so it will have to wait.
|
|
|
|
|
16
|
Games Center / Archived Projects / Re: Gilbert-Johnson-Keerthi algorithm demo (2D)
|
on: 2011-03-21 22:13:16
|
Nice!
I get around 250 objects before the object update time gets almost 95% and the fps goes down to 10. 280 objects give 2 fps and 99% update time.
Ya, that's around the point where the performance breaks down for my PC as well. 250 objects is roughly 3,100,000 collision checks / sec or about 31,000 per frame. Once I add in some broad phase collision detection, this should be fine for most games of moderate complexity or less. I need to try out some caching. If the last point of the simplex (for non-intersecting objects) is saved, you can start from there on the next iteration. This would allow you to eliminate most non-intersections in one iteration instead of two. It would also be very easy to multi-thread this because each check is independent of the others.
|
|
|
|
|
17
|
Games Center / Archived Projects / Gilbert-Johnson-Keerthi algorithm demo (2D)
|
on: 2011-03-21 20:25:05
|
I have been working on a 2D implementation of the GJK collision algorithm, and I now have an applet put together to demonstrate it. The applet can be found here. Let me know what you think. If you could share what sort of performance you are getting, that would be great. I will post the source code soon, once I get it cleaned up a bit. Just as a note, the collision detection is intentionally naive (every object tested against every other object). This was to make it easier to stress the simulation.
|
|
|
|
|
18
|
Game Development / Newbie & Debugging Questions / Re: X and Y Coordinate change rate
|
on: 2011-03-21 12:12:06
|
|
You could first try adding System.nanoTime() calls during each update loop and calculate the time they take. This is so you can establish whether or not the update frequency is what is causing the problem. If you are using sleep(), the sleep time is the minimum amount of time slept, but it could sleep longer so that may be the problem.
|
|
|
|
|
20
|
Java Game APIs & Engines / Java 2D / Re: Maximum FPS ?
|
on: 2011-03-18 13:34:45
|
Ok, so if for instance I locked the frame rate at 50 FPS, there is no problem with that?
Toine
It would probably be fine, but most computer screens will refresh at 60 Hz. This means sometimes the same image will be sent to the screen twice. Most people will not notice this, so it shouldn't be much of a problem.
|
|
|
|
|
21
|
Java Game APIs & Engines / Java 2D / Re: Maximum FPS ?
|
on: 2011-03-18 12:11:00
|
|
25 FPS is just around the point when things become fluid. Higher FPS's are noticeably smoother. I don't believe the human eye really sees in FPS though. It is a continuous response and for things that are actually frame based, the mind fills in the gaps. Ultimately it is a bit irrelevant in a game because very few monitors support more than 60 Hz.
|
|
|
|
|
22
|
Game Development / Newbie & Debugging Questions / Re: LWJGL Beginning
|
on: 2011-03-17 04:40:47
|
You should look at the Redbook. It is the programming guide for OpenGL. The commands for LWJGL are pretty much identical to the normal OpenGL calls, so it should be strait forward to use other material. If you dig around on the LWJGL page you can also find some additional information in the documentation section.
|
|
|
|
|
25
|
Java Game APIs & Engines / Java 2D / Re: 2D-sprites and screen resolution
|
on: 2011-03-16 17:48:09
|
|
I depends on what method is used to scale, but yes it can look ugly. The faster the interpolation method is the worse it generally looks. One way you can get around this is to scale the images once when the game starts up. Performance is less of an issue then so you can use the best looking interpolation available.
|
|
|
|
|
27
|
Game Development / Newbie & Debugging Questions / Re: Debug : My Applet wont work on every computer.
|
on: 2011-03-15 13:41:48
|
Your Applet wouldn't load on my system. All I got was a grayish-blue blank screen. My OS is Windows 7 (64 bit) and my Java is up to date. I would recommend that you try breaking your applet down to its simplest parts. Once you have that working, add back in your other stuff until it breaks. That will tell you where the problem is. My extends chains are somewhat a 20 classes long.
That shouldn't cause any problems while its running, but likely means your code is not very maintainable. You should look into component based entities, which is a popular design pattern to eliminate the need for deep object hierarchies.
|
|
|
|
|
28
|
Game Development / Newbie & Debugging Questions / Re: Mathematical vectors
|
on: 2011-03-15 02:12:17
|
|
You can define a position as a offset from the origin (a vector) or as several values (a point). There are position vectors, also sometimes called a radius vector, and closely related with displacement vectors. If you are using Cartesian coordinates, these are all pretty much equivalent, but not necessarily so in any other basis.
|
|
|
|
|
29
|
Game Development / Newbie & Debugging Questions / Re: Mathematical vectors
|
on: 2011-03-14 19:56:50
|
Position (a point in space, the location at a given point in time for your spaceship or car or whatever) is NOT a Vector.
A position IS a vector. It is a direction and distance from an arbitrary point in space (the origin). Edit: It may be more accurate to say you can define the position as a vector in the above way when using the Cartesian coordinate system..
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|