Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 ... 44
1  Game Development / Newbie & Debugging Questions / Re: [solved] Finding the distance between 2 rectangles on: 2014-09-15 22:08:09
Eh:
(for n-dimensional vectors p and q)
Euclidean: d(p, q) = √(Σ(qi - pi)2)
Manhattan: d1(p, q) = Σ|pi - qi|
2  Discussions / General Discussions / Re: Microsoft to buy Mojang for $2 billion? on: 2014-09-15 20:16:55
Didn't he apologize later for those messages? Maybe it wasn't those specific ones, but he did for something similar.
People's values can change. We also don't even know a lot of the details in the transfer of ownership. They could have worked it out in a way that Notch felt would work well and go along with any vision Minecraft was supposed to be. We don't know.
3  Discussions / General Discussions / Re: Microsoft to buy Mojang for $2 billion? on: 2014-09-15 17:55:53
Whoa, it's Chris!

Yeah I hope he can go do what he wants to now, but I fear it may be difficult to escape the notoriety, at least for a while. He did mention it, and said that he at least doesn't feel the obligation to acknowledge it though.
4  Discussions / General Discussions / Re: FlipFlop - Examn f(CLK) on: 2014-09-15 04:18:39
Playing with it here, interesting thing is the output of the NAND is 3.75/3 = 1.25 Hz (although a weird non-symmetrical duty cycle), but the built in JK flops don't have a clear so I can't determine what affect that has. There is a JK flop from scratch in the examples if you want to try it yourself.
5  Discussions / General Discussions / Re: FlipFlop - Examn f(CLK) on: 2014-09-15 03:59:47
Pretty sure this is just crappy test question style writing: Pick the closest answer, not the exact answer. Hence 5 Hz as the actual output is 3.75 Hz as figured by Longarmx.

EDIT: unless it's way trickier than I'd say is warranted on such a test and I'm not remembering how/if the CLR bus affects the frequency... if anything I'd think something like (f1-1 + f2-1)-1 which still isn't 5...
6  Game Development / Game Mechanics / Re: Pathfinding algorithm questions on: 2014-09-14 22:08:35
Well there are various path smoothing algorithms to take straight-line paths and bend them into curves. Might look into those.
You could also add random noise to the cost metrics, although it probably won't look good.
7  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > Building Info! < on: 2014-09-14 20:09:36
If your pathfinding is A* or something else with cost metrics, prioritizing roads should happen automatically.
8  Game Development / Game Mechanics / Re: Handling Sprite Overlapping on: 2014-09-14 03:39:30
Wouldn't you want to sort the monsters before looping through them? (or after they all move around, but before rendering)
Also, no need to create a new comparator each time, just have a static instance.

Also you can simplify the comparison via Integer.compare(i1, i2)

And, yeah, you might just be sorting it in reverse order.
9  Game Development / Performance Tuning / Re: Check for null or check for implementation? on: 2014-09-13 15:10:24
Null checks are very fast, reflection is generally slow.
Source, under "Low level safety checks": https://wikis.oracle.com/display/HotSpotInternals/PerformanceTechniques
10  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-09-11 22:37:28
Please use [img width=800][/img] (or smaller), or just link a smaller image.
11  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX]Render an electric beam? on: 2014-09-11 22:35:31
You can probably go off this: http://www.java-gaming.org/topics/slick2d-javara-commandconquer-red-alert-with-taste-of-java/33355/msg/318764/view.html#msg318764
12  Game Development / Newbie & Debugging Questions / Re: Is it Possible to use Java and send sounds through the microphone? on: 2014-09-11 22:26:30
Your answer is here: http://stackoverflow.com/questions/9115444/how-can-i-create-virtual-microphone-driver-by-using-java

I also don't see any wrappers on a quick google search, you'll have to make a JNI wrapper for something like this yourself.
13  Game Development / Newbie & Debugging Questions / Re: User Interface Animation : What to use? on: 2014-09-11 01:55:28
You know that libGDX has an Animation class, right?

Even without that, the nasty if-else ladder can be reduced to this:
text = upAndDowners[((int) animationVariable) % 40 / 10];


As for UI, you should be using Scene2d ui, so the no-brainer is Actions:

1  
2  
3  
4  
5  
6  
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;

actor.addAction(moveTo(x, y, duration));

// let's get fancy
actor.addAction(sequence(moveTo(200, 100, 2), color(Color.RED, 6), delay(0.5f), rotateTo(180, 5)));


Actions are super legit.
14  Discussions / Miscellaneous Topics / Re: What other programming languages do you use & why? on: 2014-09-10 13:15:21
Humm...maybe I should take the time to look at Julia more closely:  http://www.evanmiller.org/why-im-betting-on-julia.html

I took a peek at it a while ago, but I didn't know that. Humm indeed...
15  Discussions / General Discussions / Re: Microsoft to buy Mojang for $2 billion? on: 2014-09-10 01:27:26
Quote
Citing a "person with knowledge of the matter,"

Still basically a rumor. If true, I hope they don't go through with it, but then $2B is a shitton of money...

Full article from the WSJ (de-paywalled courtesy /u/P1xels)
https://i.imgur.com/dYSiNTF.jpg
16  Discussions / Miscellaneous Topics / Re: What other programming languages do you use & why? on: 2014-09-08 18:16:44
Embed a JVM?
17  Game Development / Newbie & Debugging Questions / Re: Moving player tile-to-tile (A* Pathfinding finally done) on: 2014-09-08 11:54:24
I was saying breadth first doesn't do weights, could of said that more clearly.
18  Game Development / Newbie & Debugging Questions / Re: Do you need all bits to represent a byte? on: 2014-09-08 03:32:55
Can you write 014 and still mean 14?

Yes.
Technically you can have any number of leading zeros in any base, and it doesn't affect the number.

However, note that if the number is in two's complement (aka signed) then the most significant bit does matter, it's the sign bit. This is because binary doesn't have a negative sign (can't write -014). But one's complement, the zeros don't matter.

EDIT: actually, not sure on that terminology, I should say that the zeros don't matter with unsigned integers, too sleepy to go verify on one's complement etc.
19  Games Center / Cube World Projects / Re: Open source cube world projects on: 2014-09-08 02:27:33
"Well designed"  Tongue

Also not technically open source.
20  Game Development / Newbie & Debugging Questions / Re: Moving player tile-to-tile (A* Pathfinding finally done) on: 2014-09-08 00:25:04
Note that just flood fill + back trace is just breadth first search, A* is Dijkstra’s + greedy best first search. They'll both yield fastest paths, but A* can handle weights and is faster to execute.
Just so you're aware of the difference.
21  Game Development / Newbie & Debugging Questions / Re: Moving player tile-to-tile (A* Pathfinding finally done) on: 2014-09-07 23:59:31
Like I said, the 5th section of Amit's guide:

1  
2  
3  
4  
5  
6  
7  
// The code to reconstruct paths is simple:

current = goal
path = [current]
while current != start:
   current = came_from[current]
   path.append(current)
22  Game Development / Newbie & Debugging Questions / Re: Moving player tile-to-tile (A* Pathfinding finally done) on: 2014-09-07 23:13:18
All calculated tiles along path have been found, now return the list containing the path (Tracing children)

The 5th visualization javascript thingy on the page I linked covers that.
This is all still part of A*, or any pathfinding algo for that matter, I think that's why we are confused, as your thread title is misleading.
23  Game Development / Newbie & Debugging Questions / Re: Moving player tile-to-tile (A* Pathfinding finally done) on: 2014-09-07 23:04:40
You say you've completed the pathfinding but are now looking for a "fastest path."
I'm not sure you know what pathfinding is.
The A* gives you that path, if you don't have a path then what you've done isn't A* or any pathfinding algorithm. Maybe you've made flood-fill, the first part of such an algorithm?

Anyway, here's one of the better A* tuts I know of to get you on your way: http://www.redblobgames.com/pathfinding/a-star/introduction.html

Don't make a new thread.
24  Game Development / Newbie & Debugging Questions / Re: Moving player tile-to-tile (A* Pathfinding finally done) on: 2014-09-07 22:15:24
Please for the love of Knuth don't use a linked list and then iterate over it with a for loop. Hurts the soul.
25  Game Development / Newbie & Debugging Questions / Re: Saving Game Data on: 2014-09-07 20:29:04
Since you're just storing key : value pairs, why not make life easy and use either Preferences or Properties?
26  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-09-07 14:10:17
Practicing making some music for my game so I don't have to steal other peoples music.

What software do you use?
27  Game Development / Newbie & Debugging Questions / Re: [Solved] Player Movement based on Mouse Clicked on: 2014-09-07 04:08:46
Fun part is when you go back to your old code you thought was hot shit when you wrote it, and you were so, so proud of it, and realize you could of written the entire thing to run 4 times as fast in half as many lines. Tongue

Done this a lot. Although it's usually more like it executes faster than I can blink instead of 5 minutes, and in a tenth as many lines.

Eventually you even start writing code you can actually understand when you come back to it after a while!
28  Game Development / Newbie & Debugging Questions / Re: Player Movement based on Mouse Clicked on: 2014-09-07 03:29:54
If it works, it works.
Hopefully, as you gain experience, you will see your code evolve from "pile of hacks" to elegance. Happens with any skill.
29  Game Development / Newbie & Debugging Questions / Re: Player Movement based on Mouse Clicked on: 2014-09-07 03:11:00
Then use brensenham like I said:

(copy-paste w/ modification from Wikipedia)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
function line(x0, x1, y0, y1)
    Point current = new Point(x0, y0);
     int deltax := x1 - x0
     int deltay := y1 - y0
     real error := 0
     real deltaerr := abs (deltay / deltax)    // Assume deltax != 0 (line is not vertical),
          // note that this division needs to be done in a way that preserves the fractional part
    int y := y0
     for x from x0 to x1
        if (Math.max(Math.abs(x0 - x), Math.abs(y0 - x)) >= SPEED) // traverse line until we've reached length SPEED
@@             return current;
        current.x = x;
        current.y = y;
         error := error + deltaerr
         if error0.5 then
             y := y + 1
             error := error - 1.0


Insert any other collision checks, etc on each loop iteration.
30  Game Development / Newbie & Debugging Questions / Re: Player Movement based on Mouse Clicked on: 2014-09-07 02:59:54
I still don't really see why you can't use my original solution in your code.

Slight modification:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
if (destination != null) {
    Point current = position;
         
    double dx = destination.x - x;
    double dy = destination.y - y;
         
    double dist = Math.sqrt(dx * dx + dy * dy);
         
    double dx2 = dx / dist * MOVEMENT_SPEED;
    double dy2 = dy / dist * MOVEMENT_SPEED;
         
    dx2 = Math.min(Math.abs(dx), Math.abs(dx2)) * Math.signum(dx2);
    dy2 = Math.min(Math.abs(dy), Math.abs(dy2)) * Math.signum(dy2);
         
    if (!Double.isNaN(dx2) && !Double.isNaN(dy2)) {
       move((int) Math.round(dx2), (int) Math.round(dy2));
    }
         
    // we reached the destination
   if (dist < MOVEMENT_SPEED)
        destination = null;
}  
Pages: [1] 2 3 ... 44
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (19 views)
2014-09-12 09:08:26

Norakomi (54 views)
2014-09-10 13:57:51

TehJavaDev (63 views)
2014-09-10 06:39:09

Tekkerue (31 views)
2014-09-09 02:24:56

mitcheeb (53 views)
2014-09-08 06:06:29

BurntPizza (37 views)
2014-09-07 01:13:42

Longarmx (23 views)
2014-09-07 01:12:14

Longarmx (27 views)
2014-09-07 01:11:22

Longarmx (27 views)
2014-09-07 01:10:19

mitcheeb (35 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!