Java-Gaming.org Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (612)
Games in Android Showcase (172)
games submitted by our members
Games in WIP (658)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 75
1  Game Development / Newbie & Debugging Questions / Re: Closed-System Cartesian Coordinates? on: 2015-08-31 01:03:16
Ideally you just simulate the surface of a sphere in some spherical coordinate system, and projection is just converting that into longitude/latitude (if that wasn't already the representation), for which Gall-Peters is already defined. Collision detection etc. on a sphere might be fun though.
2  Game Development / Newbie & Debugging Questions / Re: Game has a bunch of short pauses on: 2015-08-28 15:48:56
Like i said, im pretty sure it is not GC

You can be sure by looking at the flight recorder, or another tool which shows GC events.
3  Game Development / Newbie & Debugging Questions / Re: Game has a bunch of short pauses on: 2015-08-28 03:38:00
Monitors don't have graphics cards...

If your on a laptop or something with Nvidia optimus-like graphics card switching, then that might be plausible, but it would probably just result in evenly lower performance, not pauses.
I doubt it's a vsync-like issue if the pauses are more than slight jitters.
How frequent are the pauses?

EDIT: also, are you using swing, or LWJGL, or...?
4  Game Development / Newbie & Debugging Questions / Re: Game has a bunch of short pauses on: 2015-08-28 03:01:46
Try using JMC's flight recorder, you can clearly see gc pauses there, plus where that memory usage is coming from: http://www.javacodegeeks.com/2015/01/java-flight-recorder-jfr.html

5  Game Development / Newbie & Debugging Questions / Re: About separating game logic from rendering on: 2015-08-26 05:43:38
It means that ideally you should be able to express your code something like this:

1  
2  
3  
4  
5  
gameLoop:
    processUserInput()     // kind of separate from game logic, but could include in processGameLogic
    processGameLogic()     // produces the current game state from last frame's state
    renderCurrentState()   // does nothing to change game state, only renders it
    sleep(remainingTime)


The game state doesn't have to be a single object (although it could be), it is comprised of whatever datastructures you use to store e.g. the currently loaded level, it's map, the entity list, the player's position, inventory, score, etc.

Rendering of course can (and probably will, depending on how you define it) use 'logic' during it's step, but that program logic should be separate in that it has no effect on what the current game state is. It is local to and contained by the rendering phase. render()'s only job is to read and display the state.

User input can/should also be it's own step, which can be a sub-step in the logic phase if you like, I described a single method using queues here:
http://www.java-gaming.org/topics/i-get-a-java-lang-nullpointerexception-i-cant-fix/36564/msg/347415/view.html#msg347415
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-25 05:43:27
Wes the man, not letting his dreams be dreams.
There's your 200th medal.
7  Game Development / Newbie & Debugging Questions / Re: I Get a java.lang.NullPointerException I cant fix on: 2015-08-22 21:22:19
A good idea to keep in mind is to separate the event reporting (and rendering) from the logic of the game. Since events can be thought of a stream of things over time, a queue is good for this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
mousePressed:
    put an event into queue;

tick():
    while (queue isnt empty) process event in queue;
    do rest of game logic;

game loop:
    tick();
    render();
    sleep();



Since two thread are touching this queue, you still need a lock mechanism of some kind, but this isn't as big a deal as each thread only accesses it in one place. Plus, queues with internal locks are already made for you: BlockingQueue
The fool-proof implementation is LinkedBlockingQueue, as it automatically grows to any size (up to maximum integer).
The methods you would be interested in are offer and poll.
8  Game Development / Newbie & Debugging Questions / Re: I Get a java.lang.NullPointerException I cant fix on: 2015-08-22 21:03:25
Menu#mousePressed modifies Handler#object and is called from the event dispatch thread whenever the mouse is pressed inside the component.
Meanwhile Handler#render and Handler#clearEnemies and some other places are accessing and modifying the list from your Runnable thread, Thread-2.
You need to keep the list behind a lock or simply not access it on more than 1 thread. I recommend not accessing it from the mousePressed method.

Quote
This is my first java game and i was using alot of youtube tutorials for this and multi-threading is what the tutorial told me to do

Well it wasn't a good tutorial.
9  Game Development / Newbie & Debugging Questions / Re: I Get a java.lang.NullPointerException I cant fix on: 2015-08-22 18:14:13
Quote
Exception in thread "Thread-2" java.lang.IndexOutOfBoundsException: Index: 777, Size: 2

Last time I'll say it: race condition. Looks like one thread is clearing the list, while the other is still reading from it. Sometimes you get a NPE, sometimes an out of bounds exception, and sometimes nothing bad happens, which is the worst.

If you want any help with it, you'll have to post any code that accesses the list, not just where the list is defined.
10  Game Development / Newbie & Debugging Questions / Re: I Get a java.lang.NullPointerException I cant fix on: 2015-08-22 15:23:33
Probably changed the code back to an LL to try and fix it.
If internal LL methods are throwing an NPE, then it's almost certainly a race condition. Changing that line to object.get(i).render(g); has nothing to do with it.

The easiest way to fix it is to only access the objects list from one thread. Barring that, you can use a lock when accessing the list.
11  Game Development / Newbie & Debugging Questions / Re: I Get a java.lang.NullPointerException I cant fix on: 2015-08-22 01:03:44
TempObject.render(g); <- line 25 I'm guessing?

TempObject is null, as in your list contains at least one null value.
It's quite possibly a race condition. I would eliminate as much usage of threading as possible.
12  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-21 01:38:45
@philfrei

There are some potential options: https://www.google.com/search?q=java+vst

One of which I messed around with a while ago is this: http://jvaptools.sourceforge.net/scripteffect.html

Here it is in FL:


Derpy sample script: http://pastebin.java-gaming.org/f83f944373d17
Based on a gompertz curve for asymmetrical waveshaping: https://www.desmos.com/calculator/fcxl2xtwld

It's really more of a prototyping thing though.
13  Games Center / WIP games, tools & toy projects / Re: TwoP (Mutliplayer fighter) on: 2015-08-18 22:28:57
Remember to

1  
2  
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
14  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-18 19:34:05
On another note, how do I add inline code tags? In my couple of years browsing this forum I have never figured it out Sad

[icode][/icode]


If you're ever wondering how someone did something with BBcode, just quote their post and look.
15  Game Development / Newbie & Debugging Questions / Re: [SOLVED] Appropriate way to show damage numbers on: 2015-08-18 00:49:49
Yep, it's pretty much the best way if a more specialized data structure isn't applicable.

Tangential, but this is also the basis for how many garbage collectors are implemented, look through all the objects and copy live ones, the dead objects are just overwritten on the next sweep.
16  Game Development / Newbie & Debugging Questions / Re: Appropriate way to show damage numbers on: 2015-08-18 00:31:02
Here is a post describing the double buffered technique: http://www.java-gaming.org/topics/concurrentmodificationexception-when-removing-an-item-from-an-arraylist/32939/msg/308953/view.html#msg308953
17  Game Development / Newbie & Debugging Questions / Re: Appropriate way to show damage numbers on: 2015-08-17 22:45:21
If the upward motion is of a constant speed then the sprites will be expiring in FIFO order, aka use a queue/deque:

1  
2  
3  
4  
5  
while queue.peek().shouldExpire() // y > max
    queue.pop(); // constant time

foreach sprite in queue
    draw_and_incrementY(sprite); // assorted processing


If you use an Array, then iterate in reverse to have correct removals, currently you're skipping sprites.
Also, don't removeValue, that's a linear search. Just remove the current index.
There's also the double buffer technique, iterate over array placing non-expired entries into 2nd array, then process 2nd array and clear old one, and swap.
18  Game Development / Newbie & Debugging Questions / Re: Shooting projectile to mouse cursor in libGDX on: 2015-08-17 05:46:05
There is a wealth of these threads already if you search 'bullet mouse' or similar in the search bar.
19  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-08-17 01:13:27
What exactly are you interested in? Timings of different slerp implementations?

The angles being slerp'd, I believe. Experimental evidence for 'most angles are small.'
20  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-08-16 23:25:42
He's saying (correct me if I'm wrong) that in practice most calls to slerp tend to be small angles (and if they aren't, you would want to subdivide those angles in your animations), and thus reduce to nlerp, so slerp is not necessary.
21  Game Development / Game Play & Game Design / Re: Octalysis gamification framework on: 2015-08-15 17:11:13
Upside down duke JGO logo 'easter egg'

A while ago I went to see what the different ones were:







Oh, and Riven, you still haven't taken off your hat  Wink

22  Game Development / Newbie & Debugging Questions / Re: Problem with splitting BufferedImage on: 2015-08-14 06:53:26
Depending on whether they actually need to be separate instances, you may get utility out of getSubImage().

E.g:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
/** Split parent into numX by numY spritesheet */
public static BufferedImage[][] split(BufferedImage parent, int numX, int numY) {
    BufferedImage[][] tiles = new BufferedImage[numX][numY];
    int tileW = parent.getWidth() / numX;
    int tileH = parent.getHeight() / numY;

    for (int x = 0; x < numX; x++)
        for (int y = 0; y < numY; y++)
            tiles[x][y] = parent.getSubImage(x * tileW, y * tileH, tileW, tileH);

    return tiles;
}
23  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-08 16:55:05
Somehow I never heard about (or don't remember) java having intersection types:
http://docs.oracle.com/javase/tutorial/java/generics/bounded.html (at the bottom)

Combined with the fact that lambdas are structurally typed, you can do some weird stuff: http://benjiweber.co.uk/blog/2015/08/07/anonymous-types-in-java/
(despite what that link says, intersection types have been around before 8)
24  Game Development / Newbie & Debugging Questions / Re: Ran into an odd bug when I tried to generate random numbers for items in my game on: 2015-08-06 04:31:16
Well this is entirely a code issue and you posted no code, so we're not really going to be able to help.
25  Game Development / Newbie & Debugging Questions / Re: Interfaces and Method call- Handling by the JVM on: 2015-08-05 05:45:57
Java has single-dispatch on the type of the first argument and the method arity.
This is implemented via name mangling. https://www.google.com/search?q=name+mangling+java
26  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-03 01:41:43
VSTs are a bit rough, but this is the starting point I used: http://www.martin-finke.de/blog/articles/audio-plugins-001-introduction/
There's also some good links here: http://www.kvraudio.com/forum/viewtopic.php?t=329696
JUCE looks promising, but I haven't messed with it.
27  Games Center / Showcase / Re: jfCraft on: 2015-08-02 02:20:35
It doesn't cover everything you mentioned, but in case you aren't aware, you can attach binaries to github releases, not just the source.
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-31 02:37:07
Nice, reminds me of this, but for meshes: http://www.snakehillgames.com/spritelamp/
29  Game Development / Newbie & Debugging Questions / Re: Check to see if Triangle intersects Rectangle on: 2015-07-31 02:07:53
@OP: to flesh out my answer:

This SO thread has theory and code for treating the triangle as 3 line segments against a AABB: http://stackoverflow.com/questions/99353/how-to-test-if-a-line-segment-intersects-an-axis-aligned-rectange-in-2d

If speed turns out to be an issue with that method and triangles are often well outside of the rectangle, then computing and testing against the triangle's own AABB might be a fast way to confirm negatives before doing the full line-line-line-rect test, esp. if the triangles coordinates are stored in a way that makes computing the AABB easy.
30  Game Development / Newbie & Debugging Questions / Re: Check to see if Triangle intersects Rectangle on: 2015-07-30 06:24:32
https://www.google.com/search?q=rectangle+triangle+intersection+test

One option is to test each line in the triangle against the rectangle, perhaps first testing the triangle's bounding box against the rectangle.
Pages: [1] 2 3 ... 75
 
Roquen (15 views)
2015-08-29 11:30:54

GamerC4 (25 views)
2015-08-22 20:38:50

GamerC4 (23 views)
2015-08-22 20:37:18

GamerC4 (27 views)
2015-08-22 20:37:01

Kefwar (31 views)
2015-08-22 18:07:24

GamerC4 (24 views)
2015-08-22 01:00:24

GamerC4 (37 views)
2015-08-22 01:00:17

GamerC4 (24 views)
2015-08-22 00:57:35

GamerC4 (25 views)
2015-08-22 00:56:59

BurntPizza (31 views)
2015-08-21 01:38:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!