Show Posts
|
|
Pages: [1]
|
|
1
|
Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D faster movements at higher FPS
|
on: 2013-04-12 13:20:58
|
|
Thanks for your answers. I always tohught this way:
lower FPS -> higher Delta x = velocity * delta;
higher FPS -> lower Delta x = velocity * delta;
x = x ??
Or is the problem at the acceleration, because First I accelerate without multiplying with delta, and use the accelerated value for my movement...?
On the other hand setTargetFPS(60) seems to be a good way to get rid of it, but it's not the best way I think.
Are there other suggestions? Thanks
|
|
|
|
|
2
|
Java Game APIs & Engines / Engines, Libraries and Tools / Slick2D faster movements at higher FPS
|
on: 2013-04-09 21:25:13
|
Hello everyone, I got a problem with slick2D. The movements are faster at higher FPS rates, although I multiply with the delta given in Update(); Example: 1 2 3 4 5 6 7 8 9 10
| @Override public void update(GameContainer gc, int delta) throws SlickException { myUpdate(delta); }
public void myUpdate(int delta) { tmpY = body.getBounds().getY(); tmpY += gravity.y * body.acceleration * delta; body.getBounds().setY(tmpY); } |
Aft 300 FPS the movement is much faster than 60 FPS. This is very frustrating since I am doing such stuff for weeks and now it won't work. Where is the problem? Am I using delta wrongly?
|
|
|
|
|
9
|
Game Development / Game Mechanics / Re: A little bit of math - Rotation
|
on: 2013-02-27 19:21:49
|
Thanks vbrain. I came up with a new problem. How can I manage stop increasing my laser's beam width when it collidates with the frame bounds (or objetcs flying around). I do not know how to calculate the ending point of my Rectangle, when it is rotated. The beam currently goes endlessly into the wide nothing (out of frame)....   edit: I think I made it. It looks good so far. 1
| endPos.set((float)(x + width * Math.cos(Math.toRadians(rotation))), (float)(y + width * Math.sin(Math.toRadians(rotation)))); |
width is the radius. This gives me a Point of the "circle" -> my rotation. for those who had the same problem, or will have the same problem in the future. I am a one man show 
|
|
|
|
|
10
|
Game Development / Game Mechanics / Re: A little bit of math - Rotation
|
on: 2013-02-27 14:30:47
|
I was to quick writing this thread  I added a g.resetTransform(); before the burst image even could rotate... however... is there an idiot secure mini tutorial for wanne-be game developers regarding cos(), sin() and PI, which you would recommend?
|
|
|
|
|
11
|
Game Development / Game Mechanics / A little bit of math - Rotation
|
on: 2013-02-27 14:07:31
|
Hey guys, I never listened to our maths teacher back in school time, now I could kick myself in the a**  . I got a laserbeam and at the end a burst (in this case a dot). This laserbeam is rotating from the center to all the edges and so on. How can I calculate the new coordinates for the end of the beam, where should be displayed an image of a typical laser burst. My first attempt (thought) was to use some Math.sin and cos. But I really do not know how to use them properly. Wikipedia couldn't help me neither, it's not game dev related enough. I hope you guys are patient and could help me with this, hopefully trivial, question. Thanks in advance.  Kronos 
|
|
|
|
|
15
|
Games Center / 4K Game Competition - 2013 / Moonshadow
|
on: 2013-02-16 13:17:23
|
Hello everybody, I just submitted my first game ever made. Hope somebody likes it. here it comes  Warning! Untrusted content: Kronos submitted an applet to JGO. If the applet asks for permissions, it will have full access to your system. ( read more) - If you allow to launch the applet, it will run in sandbox mode by default.
- Signed applets will popup a security-dialog, which asks for permission to full access to your system.
- The applets are launched from a seperate sub-domain, to protect you from eavesdroppers.
- Only run applets of people you trust, regardless of whether the applet asks for permissions or not.
JGO cannot be held responsible for the contents and/or behavior of the hosted applets. or link: http://www.besli.de/
|
|
|
|
|
17
|
Games Center / 4K Game Competition - 2013 / Re: Easy shrink method
|
on: 2013-02-15 12:35:17
|
Kronos, did you try to unpack and test locally the resulting jar in a standard applet code ? 1 2 3
| Input file : game.pack Command line>unpack200 game.pack game.pack.test.jar Output file : game.pack.test.jar |
That worked, and it is even smaller. However. Does that mean my pack.gz file will work at the 4K website? Thank you very much, I am relieved a bit 
|
|
|
|
|
18
|
Games Center / 4K Game Competition - 2013 / Re: Easy shrink method
|
on: 2013-02-14 17:42:48
|
you did read what I said that you have to set it up in a real webserver ? You cannot simply create a .html page with this code and double click it. It will not work .
In any case, just submit it and keep trying to set it up on your computer. The approval process takes 1 or 2 days anyway, and by then you'll know if it works or not.
I myself submitted my pack200ed without testing it. If the pure jar works in your machine, pretty much likely it will run pack200 in the java4k site.
I uploaded it on my website, and nothing happened. I hope the guys from 4K know better to handle that thing  I really hope  Thank you all for your patience 
|
|
|
|
|
19
|
Games Center / 4K Game Competition - 2013 / Re: Easy shrink method
|
on: 2013-02-14 15:44:16
|
I'm getting desperate  I only used eclipse export, than pack200 with mentioned options: --effort=9 --no-keep-file-order --strip-debug and this HTML5 object Tag: 1 2 3 4 5
| <object type="application/x-java-applet" height="600" width="800"> <param name="code" value="G.class" /> <param name="archive" value="jar/game.pack.gz" /> <param name="java_arguments" value="-Djnlp.packEnabled=true"/> </object> |
also with cache_archive. I've seen this several times. Please help me  I want to submit today  P.S.: the applet without pack200'ing it, runs very well in the browser with the object tag.
|
|
|
|
|
21
|
Games Center / 4K Game Competition - 2013 / Re: Easy shrink method
|
on: 2013-02-13 22:15:11
|
I tried it your way, but I get errors after the 3rd step with the jarg.jar. But the jshrinker does the job anyway, but I it won't run in the browser, although I added the params to the applet tag. It says no G.class found... Whats wrong there? My steps javac -target 1.7 G.java jar cvfM game.jar G.class jshrink with standard configuration (load and save) pack200 game.pack.gz game.jar
1 2 3 4 5 6 7
| <object type="application/x-java-applet" height="600" width="800"> <param name="code" value="G.class" /> <param name="archive" value="game.pack.gz" /> <param name="java_arguments" value="-Djnlp.packEnabled=true"/> Applet failed to run. No Java plug-in was found. </object> |
|
|
|
|
|
24
|
Games Center / 4K Game Competition - 2013 / Easy shrink method
|
on: 2013-02-13 19:52:32
|
Hello, I want to contribute to the current 4K contest. My jar is 6.819 Bytes big. I am doing this at the moment with little success: pack200 --repack fourK.jar pack200 fourK.jar.pack.gz fourK.jar The result is 4.420 Bytes. All the shrinking tools seem to be offline  Please help me, thanks guys 
|
|
|
|
|
26
|
Game Development / Newbie & Debugging Questions / Re: Game Loop too fast
|
on: 2013-01-22 22:58:45
|
Thanks guys. I have changed the period variable to: long period = 1000000000 / TARGET_FPS; no I can use a more "normal" speed value -> 1.75 e.g. before it was 0.025 I think  But the FPS still shows about 280. A delta value about 0.2 to 1.2 is pretty normal, isn't it? p.s.: it is too obvious that this is the source code from the killer gaming book  P.s.s: What does Polygon's translate do? I wrote the coordinates to the console, and x an y were only at about 20 and the thing flew around like fire 
|
|
|
|
|
27
|
Game Development / Newbie & Debugging Questions / Game Loop too fast
|
on: 2013-01-22 21:27:46
|
Hello everybody, this is a very nice forum. I have got a problem with my run - game loop. The first 1-2 seconds it has more than 1800 FPS and after that it is about 300, althoug I set the target FPS to 60. I tested this loop and animated a polygon which moves from x:0 y:0 diagonal down. After the FPS break from about 1800 to 300 it runs with full speed out of sight  These are the deltas at that special moment: 0.15598080623923224 1.5791460031658402 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| public void run() { final int MAX_FRAME_SKIPS = 5; final int NO_DELAYS_PER_YIELD = 16; final int TARGET_FPS = 60; final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;
long beforeTime, afterTime, timeDiff, sleepTime; long overSleepTime = 0L; long excess = 0L; long period = 1000 / TARGET_FPS;
int noDelays = 0; int fps = 0; int lastFpsTime = 0; double delta = 1.0; beforeTime = System.nanoTime(); isRunning = true;
while (isRunning) { update(delta); render(); paintScreen();
afterTime = System.nanoTime(); timeDiff = afterTime - beforeTime; sleepTime = (period - timeDiff) - overSleepTime; delta = timeDiff / ((double) OPTIMAL_TIME); lastFpsTime += timeDiff; fps++;
if (lastFpsTime >= 1000000000) { printFps = fps; lastFpsTime = 0; fps = 0; }
if (sleepTime > 0) { try { Thread.sleep(sleepTime / 1000000L); } catch (InterruptedException e) { e.printStackTrace(); } overSleepTime = (System.nanoTime() - afterTime) - sleepTime; } else { excess -= sleepTime; overSleepTime = 0L;
if (++noDelays >= NO_DELAYS_PER_YIELD) { Thread.yield(); noDelays = 0; } }
beforeTime = System.nanoTime();
int skips = 0;
while ((excess > period) && (skips < MAX_FRAME_SKIPS)) { excess -= period; update(delta); skips++; } }
} |
I really hope, that somebody could help me. Maybe to improve my loop as well. Thank you very much in advance, Best regards, Kronos. edit: embarassing moment  I used myPolygon.translate(x, y); I don't know what this does exactly, but not what I wanted it to do. The loop seems to be okay, beside that it does not reach my target FPS which is set to 60. 
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|