Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (806)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 34 35 [36] 37 38 ... 216
  ignore  |  Print  
  What I did today  (Read 3678981 times)
0 Members and 5 Guests are viewing this topic.
Offline Chequered

Senior Newbie


Medals: 1
Exp: 2 years


I could use a cup of Java.


« Reply #1050 - Posted 2014-12-05 11:06:10 »

Having trouble staying focused and knowing where to start from this week. But I managed to refactor the code into more manageable sections today, and did some more frivolous background work to help set the scene.

Play date on Venus


Mission to the Moon


Can't wait to try this game out, it looks better each day.
Offline Chequered

Senior Newbie


Medals: 1
Exp: 2 years


I could use a cup of Java.


« Reply #1051 - Posted 2014-12-05 11:08:12 »

Worked on the turret aiming and basic enemy AI for my Tower Defence game. Please disregard the weird turret rotation bug, I'm working on this. Although I'm not completely sure why it is happening.

Click to Play
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #1052 - Posted 2014-12-05 11:17:55 »

Messed around with building a little framework for the Google App Engine Datastore for a Java / WebGL project I'm working on. The main object of the framework is to move all Datastore API calls and imports to my DataObject class - I don't like seeing shopping lists of imports from multiple frameworks in my classes.

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 #1053 - Posted 2014-12-05 11:19:06 »

Having trouble staying focused and knowing where to start from this week. But I managed to refactor the code into more manageable sections today, and did some more frivolous background work to help set the scene.

*awesome pics*

GIMME GIMME GIMME!
Seriously though, that's so awesome! I can't wait to try this game!

How am I? Tough question, since emotions are confusing as heck Tongue
Offline lcass
« Reply #1054 - Posted 2014-12-05 17:14:41 »

Passed my learner's license test and survived my first driving lesson.

(Edit: Everybody else involved survived too)
sigh I still have to wait a year Sad

Anyway I updated the code from my software that needed desperate performance upgrades.
I rendered this to a single VBO using a custom FloatBuffer handling class , only one area is modified when the tile is put down and the vbo is updated immediately ,the  world object has 5 VBOS , one central view one right , left up down etc each of them update the data offscreen when they know that they are coming next , then when the screen fully moves say onto the right VBO , that becomes the centre vbo and the prior centre one becomes the right. This allows for offscreen data loading lowering the chance of an artefact occurring or stuttering from the generation of the landscape.
Offline kpars
« Reply #1055 - Posted 2014-12-05 18:45:44 »

-snip-

Hnnnnng.

- Jev
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #1056 - Posted 2014-12-05 20:29:43 »

@home, uninstalled every JRE on my system. No more JRE/JDK confusion for Eclipse and Google App Engine. Ha!

@work, fell in love with C#.

Offline Slyth2727
« Reply #1057 - Posted 2014-12-05 23:04:14 »

@work, fell in love with C#.

I've been telling you guys!
Edit: Look what I found

Offline Mac70
« Reply #1058 - Posted 2014-12-06 00:51:29 »

Experimented with procedural terrain generation again, now with fractals:



I wrote this generator in 2 hours, but even after such a short time I am able to say that fractal-based generation is superior to noise-based (especially simplex noise). Main advantages of this random generation method:

  • VERY fast generation
  • possibility to generate less detailed, very similar looking maps on demand
  • only small amount of repeating patterns (probably possible to fix with better random function)
  • easily configurable
  • lazy generation

Generation times:
2048X2028 (seen above), full detail - ~2,3s
8192X8192, full detail - 33s
8192X8192, very high detail (almost the same as full detail, with just one generation layer less) - 23s
8192X8192, high detail (first noticeable quality loss) - 14s
8192X8192, low detail (very noticeable quality loss, but still should look acceptable in the far distance in case of 3d games) - 8s

I will try to improve this generator further, this looks very promising.
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1059 - Posted 2014-12-06 01:31:17 »

If you release the code (the pastebin would work, Gist would be better), we could probably speed that up quite a bit. 2s sounds slow, although I'm forgetting what all is involved with fractal gen.
It's diamond-square, right?

Looks good though!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mr.CodeIt

Senior Devvie


Medals: 2
Projects: 1



« Reply #1060 - Posted 2014-12-06 01:38:21 »

Successfully implementing a save/load game feature. Then on to the fun stuff  Grin
Offline Mac70
« Reply #1061 - Posted 2014-12-06 01:50:47 »

If you release the code (the pastebin would work, Gist would be better), we could probably speed that up quite a bit. 2s sounds slow, although I'm forgetting what all is involved with fractal gen.
It's diamond-square, right?

Looks good though!

https://gist.github.com/Warlander/0a786007e6d1e68355b6

Edit: XOR random generator improved generation speed by about 30%.

Edit2: Added multithreading, now 8192X8192 fully detailed map is generated in 14 seconds instead of 33.
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1062 - Posted 2014-12-06 05:13:23 »

I halved the run time without either of those things, so update your gist and we could be getting somewhere.

https://gist.github.com/BurntPizza/c6327045f6ad3d7c56c3 (Indentation seems half-broke in places, darn github editor)

Does 2048x2048 in ~430 ms (down from 880).

Don't time the write to file, that's way more expensive than actually generating an image, and not indicative of normal operation anyway.
Offline Jacob Pickens
« Reply #1063 - Posted 2014-12-06 05:28:45 »

I, after 2 hours, finally got a stream working with my mic and background music. Also works with Skype calls. Woot woot. Now broadcasting development of my next project. Pretty excited to see how this streaming thing works out.

Offline Roquen

JGO Kernel


Medals: 518



« Reply #1064 - Posted 2014-12-06 07:25:05 »

never use java.util.Random. for anything.  ever.  haven't I said that before?
Offline ra4king

JGO Kernel


Medals: 508
Projects: 3
Exp: 5 years


I'm the King!


« Reply #1065 - Posted 2014-12-06 08:41:22 »

For anything at all...ever? Why not?

Offline Roquen

JGO Kernel


Medals: 518



« Reply #1066 - Posted 2014-12-06 10:40:13 »

The design has no use case.  It's bad at everything.
Offline SHC
« Reply #1067 - Posted 2014-12-06 17:46:20 »

I'm participating in LD. My Game title is "MousyDare", here are a few screenshots:











Enough for today, will improve them tomorrow!

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1068 - Posted 2014-12-06 17:59:42 »

never use java.util.Random. for anything.  ever.  haven't I said that before?

His main problem was cache thrashing so I took care of that first, but yeah I agree, don't use Random for anything that needs high quality or speed.
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #1069 - Posted 2014-12-06 18:06:23 »

His main problem was cache thrashing so I took care of that first.

Can you elaborate?

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1070 - Posted 2014-12-06 18:22:33 »

He had a nested loop for summing and averaging the different noise layers together into the final image:

(paraphrased code)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
// remember that width and height are large, at least several thousand each

for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
        for (Layer l : layers) {
            result[y][x] += l.get(x, y);
        }
        result[y][x] /= numLayers;
    }
}


(One thing is that the inner loop, being a for-each, creates an iterator every one of it's 4M or so executions, but that's another matter)

The problem here is that each layer has it's noise array, which is read from in Layer::get. This means that you grab one pixel worth of information from each layer, and then immediately evict it from cache to make room for the next layer (which will be a cache miss every time).

Fixed it using Loop interchange and fission:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
for (Layer l : layers) {
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            result[y][x] += l.get(x, y);
        }
    }
}

for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
            result[y][x] /= numLayers;
    }
}


This yields massive performance gain even despite (N + 1) times more loops over the main array because it reads everything it needs from the arrays before going on to the next one, instead of going back and forth, grabbing little bits at each stop, and the main array will be hot in the cache the whole time anyway.

(Also alleviates more hidden concerns such as the potentially immense register (and GC less so) pressure caused by creating the N iterators in the tight loop)

There are other little things, but this was the largest single gain.
Offline pitbuller
« Reply #1071 - Posted 2014-12-06 19:19:51 »

1  
2  
3  
4  
5  
6  
7  
   private double getValueOrDefault(float[][] array, int x, int y, double def) {
        try {
            return array[x][y];
        } catch (IndexOutOfBoundsException ex) {
            return def;
        }
    }


This seems extremely odd way to do clamping to edge. You are always calculating that default value and its only used at edges(0.0488221645% of cases with 8k grid). Instead of this I would iterate edges with special case loop and then inner part without extra fuss. I would also unroll the smoothValue method.

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1072 - Posted 2014-12-06 19:53:58 »

I agree, although those methods are never called, so I didn't bother.
Exceptions-as-control-flow are never a good idea.
Offline Mac70
« Reply #1073 - Posted 2014-12-06 20:22:32 »

https://gist.github.com/Warlander/0a786007e6d1e68355b6

Gist updated. Smiley I will probably refactor project and make WIP thread soon.
Offline basil_

« JGO Bitwise Duke »


Medals: 418
Exp: 13 years



« Reply #1074 - Posted 2014-12-06 21:07:54 »

Exceptions-as-control-flow are never a good idea.

have to disagree. Smiley .. in "gaming" context it's totally fine if you do not get too broad :

1  
2  
try { return array[x]; } catch ( IndexOutOfBoundsException  ex ) { return 0; } // fine
try { return array[x]; } catch ( Throwable ex ) { return 0; }                  // NOT fine

something similar applied to
equals
:

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  
public class vec3
{
  [...]

  @Override public boolean equals(Object v)
  {
    try
    {
      return equals((vec3)v);
    }
    catch(ClassCastException ignored)
    {
      return false;
    }
  }

  boolean equals(vec3 v)
  {
    try
    {
      return [insert compare test here];
    }
    catch(NullPointerException ignored)
    {
      return false;
    }
  }

  [...]
}
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #1075 - Posted 2014-12-06 21:16:51 »

Exceptions are extremely heavy things - how often do you want Java calling up a stack trace?

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1076 - Posted 2014-12-06 21:17:53 »

It's super hacky, and while optimizing for performance I'm going to eliminate as many exception creations as possible.

http://java-performance.info/throwing-an-exception-in-java-is-very-slow/

Offline basil_

« JGO Bitwise Duke »


Medals: 418
Exp: 13 years



« Reply #1077 - Posted 2014-12-06 21:23:22 »

ofc it is about not having the exceptions coming up at all.

as with the array test : if 99.99% of the time it does not happen, the extra fuzz for doing "proper" tests is a waste of cpu time.
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1078 - Posted 2014-12-06 21:29:46 »

On the contrary, not having the "extra fuzz" can easily thwart bounds-check elimination, resulting in slower code.
The 99.99% figure is also to the benefit of the branch predictor, so that fuzz will be faster than you expect.
Also some optimizations are disabled inside of try{} blocks, although I don't remember exactly which.
Offline basil_

« JGO Bitwise Duke »


Medals: 418
Exp: 13 years



« Reply #1079 - Posted 2014-12-06 21:43:55 »

i never got anything but performance gain from that.

try debugging a totally ignored exception. at least with -server it's optimized to no stacktrace. see OmitStackTraceInFastThrow vm arg.
Pages: 1 ... 34 35 [36] 37 38 ... 216
  ignore  |  Print  
 
 

 
Riven (587 views)
2019-09-04 15:33:17

hadezbladez (5533 views)
2018-11-16 13:46:03

hadezbladez (2411 views)
2018-11-16 13:41:33

hadezbladez (5794 views)
2018-11-16 13:35:35

hadezbladez (1233 views)
2018-11-16 13:32:03

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

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

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

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

nelsongames (5125 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

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
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!