Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (773)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 48 49 [50] 51 52 ... 206
  ignore  |  Print  
  What I did today  (Read 2955626 times)
0 Members and 4 Guests are viewing this topic.
Offline CommanderKeith
« Reply #1470 - Posted 2015-01-21 12:43:47 »

Been prototyping an R-tree implementation using fancy Sort-Tile-Recursive bulk loading, as detailed here.

Generated from random points, notice the nice, clustered, non-overlapping (leaves) packing:
...
Probably one of my favorite data structures.
Nice job. Looks great.
I found that caching objects in local groups can speed up 2D pathfinding and even rendering significantly. I made something similar for polygons (regions) rather than points which was just a simple 2D array of tiles. Would be interesting to see your algorithm working with overlapping regions too.
What do you plan to use your algorithm for?

Offline Seiya02

JGO Coder


Medals: 7
Projects: 4
Exp: 5 years


No Text Here :x


« Reply #1471 - Posted 2015-01-21 14:10:20 »

Made myself a simple game updater, got a problem: how do i launch the downloaded .jar file?

example:
Patcher.jar
Game/Game.jar
Game/Test.png

the Game.jar loads the Test.png like this:
1  
new File("./Test.png");


I tried the following Code inside the Patcher.jar to launch the Game.jar:
1  
Runtime.getRuntime().exec("java -jar ./Game/Game.jar");


but there's 2 problems:
first: the Game.jar doesn't fine the Test.png file anymore cause it doesn't search in the Game folder
second: the Patcher.jar has to stay open for the Game.jar to keep running, i want the Patcher.jar to close

Anyone knows how to get that? ._.

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1472 - Posted 2015-01-21 15:24:26 »

I made something similar for polygons (regions) rather than points which was just a simple 2D array of tiles. Would be interesting to see your algorithm working with overlapping regions too.
What do you plan to use your algorithm for?

Sounds like the good ol' Bin.
R-trees can be used for arbitrary shapes as well, both storage and queries, the two types of queries most suited to them is intersection/containment (given shape S, what objects in the tree intersect it?) and k-nearest neighbors.
http://en.wikipedia.org/wiki/R-tree

I'm entering a contest which requires fast spatial queries; I deemed R-trees the way to go.
Now to port it to C...  persecutioncomplex
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ziozio
« Reply #1473 - Posted 2015-01-21 22:11:35 »

the Game.jar loads the Test.png like this:
1  
new File("./Test.png");


the current directory is the directory from where java was launched from. If it can't find it then you didn't execute your jar in the same directory as Test.png

To run a totally separate process in java is tricky because there isn't a platform independent way to do it. For windows you can force it by maybe doing cmd /c

1  
Runtime.getRuntime().exec("cmd /c start java -jar ./Game/Game.jar");


You are probably ok on linux / mac osx but if not you could use nohup.
Offline HeroesGraveDev

JGO Kernel


Medals: 382
Projects: 11
Exp: 4 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #1474 - Posted 2015-01-21 22:33:55 »

Made myself a simple game updater, got a problem: how do i launch the downloaded .jar file?

example:
Patcher.jar
Game/Game.jar
Game/Test.png

the Game.jar loads the Test.png like this:
1  
new File("./Test.png");


I tried the following Code inside the Patcher.jar to launch the Game.jar:
1  
Runtime.getRuntime().exec("java -jar ./Game/Game.jar");


but there's 2 problems:
first: the Game.jar doesn't fine the Test.png file anymore cause it doesn't search in the Game folder
second: the Patcher.jar has to stay open for the Game.jar to keep running, i want the Patcher.jar to close

Anyone knows how to get that? ._.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
// Path to Game directory
Path directory = Paths.get(SomeClass.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toAbsolutePath().resolveSibling("Game");
// Path to Game.jar
Path targetJar = directory.resolve("Game.jar");

ProcessBuilder pb = new ProcessBuilder("java");
pb.command().add("-jar");
pb.command().add(targetJar.toString());
pb.inheritIO();

try
{
    pb.start();
}
catch(IOException e)
{
    e.printStackTrace();
}
// Clean up launcher here.
cleanUpLauncher();
// Then exit
System.exit(0);


Additionally, never use relative paths for loading resources.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public static Path assemblePath(String... path)
{
    // Get the fodler the jar is located in.
    Path target = Paths.get(SomeClass.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toAbsolutePath().getParent();
    for(String p : path)
    {
        target = target.resolve(p);
    }
    return target;
}

Which can be used like this:
Path resourceFile = assemblePath("path", "to", "your", "resources", "some_resource.png");


All the code I've provided uses Java 7+. If you need a Java 6 version, I can provide that too.

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1475 - Posted 2015-01-22 02:54:56 »

How's the trackball? I always thought those were neat, but have never used one.
Offline kpars
« Reply #1476 - Posted 2015-01-22 02:57:01 »

How's the trackball? I always thought those were neat, but have never used one.

Absolutely amazing, been using them for 3 years and have never gone back.

- Jev
Offline Longarmx
« Reply #1477 - Posted 2015-01-22 03:02:12 »

How's the trackball? I always thought those were neat, but have never used one.

I used one for about 3 years as well (I don't anymore), and they're great except that I think it's a little harder to be as precise. Also, I noticed that performing dragging gestures were sometimes a little hard, even after using one for that long.

Offline kevglass

« JGO Spiffy Duke »


Medals: 319
Projects: 25
Exp: 22 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #1478 - Posted 2015-01-22 11:09:38 »

Today (and the last few weeks) I mostly got very frustrated at not having any time to do anything - day jobs suck. About to get distracted writing a mini-game so I can say I've done *something* in the last month or so.

Cheers,

Kev

Offline delt0r

JGO Wizard


Medals: 145
Exp: 18 years


Computers can do that?


« Reply #1479 - Posted 2015-01-22 14:24:42 »

Ah yes the curse of the day job. Well mine is going so badly right now i may well not have one really soon  Undecided

What did i do today? Broke even more code that was suppose to be released months ago.

I have no special talents. I am only passionately curious.--Albert Einstein
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline MrPizzaCake

Senior Devvie


Medals: 8
Exp: 3 years


Hello, another wonderful human being :)


« Reply #1480 - Posted 2015-01-22 15:56:00 »

Redid my battlestation.

*pics*

- Jev
What does everyone love about mechanical keyboards? I've used a few, even two from Razer, but they're so uncomfortable... I guess I'm just a mebrane keyboard-type of guy.

Also, it totally doesn't show you like Portal Tongue

How am I? Tough question, since emotions are confusing as heck Tongue
Offline Ecumene

JGO Kernel


Medals: 197
Projects: 4
Exp: 8 years


I did not hit her! I did not!


« Reply #1481 - Posted 2015-01-22 16:00:31 »

What does everyone love about mechanical keyboards? I've used a few, even two from Razer, but they're so uncomfortable... I guess I'm just a mebrane keyboard-type of guy.

I've found the blue switches to be very... Clicky. Too clicky in fact. I'm used to bottoming out keys like I would on membrane boards, but I'm slowly switching back to Cherry MX Browns which are allot easier to press, and make me type allot faster. But really, it won't make you immediately better at coding, it's just a personal preference.

Also, congratz on being the 1500th JGO post!

Also, it totally doesn't show you like Portal Tongue

Kinda over-did it really. persecutioncomplex

Offline MrPizzaCake

Senior Devvie


Medals: 8
Exp: 3 years


Hello, another wonderful human being :)


« Reply #1482 - Posted 2015-01-22 16:21:26 »

I've found the blue switches to be very... Clicky. Too clicky in fact. I'm used to bottoming out keys like I would on membrane boards, but I'm slowly switching back to Cherry MX Browns which are allot easier to press, and make me type allot faster.
Yeah, blues are extremely loud for me. Some people like the clickity sound, but I find it little annoying. Browns are better, but still, there's still some uncomfortable feeling when I type with them. Reds are propably the best I tried, but they still didn't beat good ol' membrane. And I won't even mention how uncomfortable blacks were.
I didn't try other switches though, so there may be a mecha-keyboard with the right color switch that might fit me.

But really, it won't make you immediately better at coding, it's just a personal preference.
Right, but it may make you a little faster when the keyboard is comfortable.

Also, congratz on being the 1500th JGO post!
Oh, I didn't notice that! Thanks! Smiley

How am I? Tough question, since emotions are confusing as heck Tongue
Offline Drenius
« Reply #1483 - Posted 2015-01-22 16:51:04 »

Did absolutely nothing interesting today...
Offline kevglass

« JGO Spiffy Duke »


Medals: 319
Projects: 25
Exp: 22 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #1484 - Posted 2015-01-22 16:53:31 »

1500th reply I think.

Cheers,

Kev

Offline kpars
« Reply #1485 - Posted 2015-01-22 20:20:40 »

Razer

Well there's your problem.



Anyway, there are a ton of reasons why mechboards are 'better' than membrane keyboards, I wrote a long post about them here. But in the end it's really just personal preference.

I've found the blue switches to be very... Clicky. Too clicky in fact. I'm used to bottoming out keys like I would on membrane boards, but I'm slowly switching back to Cherry MX Browns which are allot easier to press, and make me type allot faster. But really, it won't make you immediately better at coding, it's just a personal preference.

You obviously haven't used buckling springs before, they're much clickier. Tongue
You might enjoy Topre switches, but they're a bit expensive.

Kinda over-did it really. persecutioncomplex

You can never have too much Portal.

- Jev
Offline Ashedragon

JGO Coder


Medals: 27
Projects: 1
Exp: 4 years


The best person you could possibly be is yourself.


« Reply #1486 - Posted 2015-01-22 20:48:11 »

Today I livestreamed and made this track: https://soundcloud.com/literature-corner/dungeon-days

It certainly isn't mastered yet so some of the levels are a bit off, but after two hours I couldn't do any more, haha.

boo
Offline LiquidNitrogen
« Reply #1487 - Posted 2015-01-22 21:15:08 »

Today I woke up feeling alive and full of energy! I honestly don't recall that having ever happened before Cheesy
Offline basil_

« JGO Bitwise Duke »


Medals: 418
Exp: 13 years



« Reply #1488 - Posted 2015-01-22 21:16:48 »

Been prototyping an R-tree implementation using fancy Sort-Tile-Recursive bulk loading, as detailed here.

Generated from random points, notice the nice, clustered, non-overlapping (leaves) packing:

Probably one of my favorite data structures.
got inspired by you and continued coding on my interval-tree too.

figured, tile-recursive-sort-loading is possible only after all data is known (correct ?). i'm following the implementation as described here : http://www-db.deis.unibo.it/courses/SI-LS/papers/Gut84.pdf which is a very dynamic r-tree version. adding and deleting on the fly is fast, but generates lower quality trees. figured, the tile-sorting algorithm can be applied here too (partially, not recursive, but sorting dimensions by perimeter), which gets close to the quadratic-quality at linear-time :O






Offline basil_

« JGO Bitwise Duke »


Medals: 418
Exp: 13 years



« Reply #1489 - Posted 2015-01-22 21:23:14 »

Today I livestreamed and made this track: https://soundcloud.com/literature-corner/dungeon-days

It certainly isn't mastered yet so some of the levels are a bit off, but after two hours I couldn't do any more, haha.
nice! .. i like the way you go after the break at 2:08, guess the slower pace is coming from the missing guitar. thanks for sharing. Smiley
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1490 - Posted 2015-01-22 21:38:39 »

tile-recursive-sort-loading is possible only after all data is known (correct ?). i'm following the implementation as described here : http://www-db.deis.unibo.it/courses/SI-LS/papers/Gut84.pdf which is a very dynamic r-tree version. adding and deleting on the fly is fast, but generates lower quality trees. figured, the tile-sorting algorithm can be applied here too (partially, not recursive, but sorting dimensions by perimeter), which gets close to the quadratic-quality at linear-time :O

You are correct. Sounds interesting, could you elaborate slightly? Is it competitive with R+/R* trees? Afaik the quadratic split isn't actually very good, although it is better than the linear split(s). The first picture looks quite performant though.
R* topological split looks about as good as STR while remaining dynamic: (if more expensive than simpler splits)

Wikipedia

Also nice pictures as usual  Pointing
Offline LiquidNitrogen
« Reply #1491 - Posted 2015-01-22 21:44:13 »

basil - I would print out your graphs and put them on my walls as artwork if they were higher resolution, theyre beautiful!
Offline basil_

« JGO Bitwise Duke »


Medals: 418
Exp: 13 years



« Reply #1492 - Posted 2015-01-23 00:13:19 »

cheers! Smiley

true, quadratic split isn't too good, but good enough for raytracing and collision tests, if modified a bit. since it's prone to insert order i presort objects along a hilbert curve before inserting, which mean all data is known before. yet, initially building the tree is one thing, changing it on the fly still requires a speed algorithm there.

"on the fly idea" is basically - if a node gets too big, split it in two and distributing the affected children nodes along them. starting by picking two children with "worst" distribution, the seed.

the change i did here is, instead of simply comparing the union-area created by a pair of children and picking the largest, i additionally substract the children areas from that value. (unionarea - node1area - node2area). a tiny change, it simply prefers smaller children nodes.

i changed the quadraticNext() method to to use the extensions-delta and it's abs-value instead of just the extensions to pick the smallest. delta = ext1 - ext2. sign points into the "better" parent node, while selecting the _largest_ abs-value yields the best child-node. sounds counterintuitive but creates a "better packed" tree. it's still quadratic tho', testing all-pairs.

anyway, what was giving me a headache was the area-function itself. since it's width*height in 2D or *depth in 3D, once one dimension is zero then the area is zero too right? that's not too uncommon in 3D, once you have a triangle perfectly aligned to an axis ... it's gone. so i compute the area like ..
1  
2  
3  
4  
5  
6  
7  
8  
9  
  public static float area(float[] min,float[] max)
  {
    float area = 1.0f;
    for(int i = min.length; i-- != 0; )
    {
      area *= max[i] - min[i] + 1.0f;
    }
    return area;
  }
which is not correct i know. but when used to compute extensions and unions which are there just to be compared, it does not matter. it turns out, adding a fixed +1 also made the comparators lean towards "rectangular" shapes instead of "wide-spread" since for instance ..
10*10 = 100 and 2*50 = 100 but 11*11 = 121 and 3*51 = 153
in which case the more rectangular shape is distinguishable.

thinking about the tile-sort idea, instead of picking seeds and iterating over children i simply

- grab all children, which are not many since it's just at the time of splitting a "too big" node into two smaller ones.
- compute median ( list.length/2 ).
- sort them, two times each dimension, min/max-comparator. store the lists, makes 4 in 2D and 6 in 3D etc.
- loop all lists and compute its perimeter ( sum of (max-min)*2 in each dimension ) ..
-- two times. one for the first half of the nodes (zero to median) and one for the rest (median to list.length). add these together ..
- use value to find the smallest list.
- split list by its median (list.length/2)
- insert one half into one of the new parent-nodes, the other half into the other one.

basically, sort children, split in two, attach (similar to balancing a kd-tree). not using lots of list to create more nodes in recursion, eventually the whole tree bottom up or top down as you do with R* right ?

trees made like that are still "overlapping", more than quadratic, but have less nodes and build much faster. in the end it depends on what and how the tree is used.

sorry for the wall of text. o/
Offline princec

« JGO Spiffy Duke »


Medals: 1059
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #1493 - Posted 2015-01-23 01:37:01 »

Converted all the SPGL2 code to run entirely on modern OpenGL3.3+ with no backward compatibility. Seems we now have to basically reimplement half the OpenGL APIs in our own code, bah.

Cas Smiley

Offline ClaasJG

JGO Coder


Medals: 43



« Reply #1494 - Posted 2015-01-23 11:20:44 »

Installed putty and xming and now I try to dig into mathematica hearing the silence from a small pi cluster sitting in the corner of my room.

My english has to be tweaked. Please show me my mistakes.
Offline SHC
« Reply #1495 - Posted 2015-01-23 17:08:13 »

Updated my Moto G 1st Generation to Android Lollipop 5.0.2. This is not a custom ROM update, and is pushed out by Motorola.

 

So far enjoying the new Material UI everywhere.

Offline CommanderKeith
« Reply #1496 - Posted 2015-01-23 18:08:02 »

I made something similar for polygons (regions) rather than points which was just a simple 2D array of tiles. Would be interesting to see your algorithm working with overlapping regions too.
What do you plan to use your algorithm for?

Sounds like the good ol' Bin.
R-trees can be used for arbitrary shapes as well, both storage and queries, the two types of queries most suited to them is intersection/containment (given shape S, what objects in the tree intersect it?) and k-nearest neighbors.
http://en.wikipedia.org/wiki/R-tree

I'm entering a contest which requires fast spatial queries; I deemed R-trees the way to go.
Now to port it to C...  persecutioncomplex

Interesting topic. Thanks for the link to the bin, yes I made a crude version of a bin. It surprises me to see how far academics have studied geometric algorithms like this.
I notice on the wiki page that bins have similar characteristics to hashmaps. This must be an advantage of the bin over the tree since it makes queries O(1), assuming no collisions.
Trees on the other hand cannot go straight to the correct leaf, they have to climb through the branches from the trunk which is O(log(n)).
But the disadvantage of the bin is that data is often clustered and with each bin being the same size there will be some full bins and lots of empty bins wasting memory.
Is this a correct assessment?

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1497 - Posted 2015-01-23 19:27:48 »

Yes.
I analyzed some of the contest data and it is very clustered, with some very outlying clusters far away from the main groups as well, so a bin would have been (ha) terrible.
Meanwhile the tree completes [non-exhaustive] containment queries on 10M points in ~0.015 ms, and I haven't spent any time optimizing node sizes, locality, etc.
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #1498 - Posted 2015-01-23 22:13:44 »

I spent weeks avoiding creating normal arrays for my model loader and got started tonight. Can it be this simple?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
        Vector3f[] normalsArray = new Vector3f[coordsArray.length];
        OneToManyMap<Integer, Vector3f> map = new OneToManyMap<Integer, Vector3f>();
        for (int ii = 0; ii < indexesArray.length; ii += 3) {
            //triangle vectors a and b
            int idx1 = indexesArray[ii], idx2 = indexesArray[ii + 1], idx3 = indexesArray[ii + 2];
            Vector3f a = coordsArray[idx2].subtract(coordsArray[idx1]).normalizeLocal();
            Vector3f b = coordsArray[idx3].subtract(coordsArray[idx1]).normalizeLocal();
            Vector3f normal = a.cross(b).normalizeLocal();
            map.put(idx1, normal);
            map.put(idx2, normal);
            map.put(idx3, normal);
        }
        for (Integer idx : map.keySet()) {
            List<Vector3f> allNormals = map.get(idx);
            Vector3f sum = new Vector3f();
            for (Vector3f normal : allNormals) {
                sum.add(normal);
            }
            normalsArray[idx] = sum.divide(allNormals.size()).normalizeLocal();
        }


EDIT: changed the OneToManyMap.get() return a List and not a Set, as otherwise the average might go wrong.

Offline Ecumene

JGO Kernel


Medals: 197
Projects: 4
Exp: 8 years


I did not hit her! I did not!


« Reply #1499 - Posted 2015-01-24 05:39:13 »

Got into the windows insider program and a free copy of Windows 10, installed it on my Surface Pro 3 after having to hack an intel driver installer that specifically says not to install it on Windows 10 in the '.inf' file. Works fine though... For now...

Pages: 1 ... 48 49 [50] 51 52 ... 206
  ignore  |  Print  
 
 

 
EgonOlsen (1861 views)
2018-06-10 19:43:48

EgonOlsen (1883 views)
2018-06-10 19:43:44

EgonOlsen (1252 views)
2018-06-10 19:43:20

DesertCoockie (1684 views)
2018-05-13 18:23:11

nelsongames (1350 views)
2018-04-24 18:15:36

nelsongames (1968 views)
2018-04-24 18:14:32

ivj94 (2739 views)
2018-03-24 14:47:39

ivj94 (1942 views)
2018-03-24 14:46:31

ivj94 (3032 views)
2018-03-24 14:43:53

Solater (1083 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
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!