Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (731)
Games in Android Showcase (217)
games submitted by our members
Games in WIP (799)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 175 176 [177] 178 179 ... 186
  ignore  |  Print  
  What I did today  (Read 1690350 times)
0 Members and 3 Guests are viewing this topic.
Offline SHC
« Reply #5280 - Posted 2017-02-12 05:23:44 »

I apologize for bringing c++ to this forum once again..

1  
typedef std::_List_iterator<std::_List_val<std::_List_simple_types<std::function<void(int, int)>>>> ResizeListenerHandle;
So I wrote this as part of my c++ game. Believe it or not, it is actually useful.


... I sure am glad typedefs exist. persecutioncomplex

Combine that with macros!

1  
2  
3  
4  
5  
6  
#define DEF_ITER(type) typedef std::_List_iterator<std::_List_val<std::_List_simple_types<std::function<type>>>>

DEF_ITER(void(int,int)) ResizeListenerHandle;
DEF_ITER(void(int,int)) PositionListenerHandle;

// And so on...

Offline Aalhex
« Reply #5281 - Posted 2017-02-12 07:07:23 »

Today has been a stressful day. It’s a shame there’s no gun emoji on this forum. Roll Eyes

It is I, Alexander from the Junivörs.
Offline CoDi^R
« Reply #5282 - Posted 2017-02-13 08:42:09 »

This weekend I did a small experiment combining ForkJoinPool and artemis-odb to try processing entity system updates concurrently. The idea was to take a bag of entity IDs as provided by artemis, but instead of iterating them one by one, it splits the work among worker threads as much as it seems fit - which would be a parameter to decide based on how much work the system has actually to do on each entity.

I don't know yet if this is going anywhere, or even worth the overhead, but with entity numbers large enough I can already provide some bonus heat to my office room with CPU cores at 100% ...  Roll Eyes

Robotality - steamworks4j - @code_disaster - codi^r @ #java-gaming
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline VaTTeRGeR
« Reply #5283 - Posted 2017-02-13 09:40:36 »

@CoDi^R
It's certainly worth it, just not for every task.
If you have a task that requires minimal input and minimal output and apart from that does not modify shared data, that's your candidate!
Pathfinding, complex ai or line-of-sight calculations are a perfect fit Pointing

I tried this some time ago with a simple thread pool and i even got a small improvement by doing the posNew=pos+v*t with 4 threads, despite the overhead.
Offline Archive
« Reply #5284 - Posted 2017-02-13 19:13:51 »

Thanks to theagentd and a few hours on skype, gamma correction was added to my engine!
We changed from using 24 bit, R8G8B8 colors to 48 bit R16G16B16 long colors

Without gamma:


With gamma:

Offline Roquen
« Reply #5285 - Posted 2017-02-13 19:40:52 »

https://twitter.com/Jonathan_Blow/status/831225844655796226

edit: or just click here: https://www.humblebundle.com/freedom
Offline misthalu

Senior Devvie


Medals: 20
Projects: 1



« Reply #5286 - Posted 2017-02-13 19:51:26 »

This thread is a great idea.
Allow me to contribute.
These days we (girlfriend and me) is getting ready to release our first "Blu-Play" game. (www.blu-play.com)
So today we (that means her, because she's the graphics artist) have created a label and cover for the Blu-ray Disc. :-)



Offline KaiHH

JGO Kernel


Medals: 416



« Reply #5287 - Posted 2017-02-13 22:11:20 »

If you've been following US "politics" and media the last time and wonder... what the eff..., you must see this:
https://www.youtube.com/watch?v=xecEV4dSAXE
Amazing work. Just hilarious. Yeah, watching this is basically what I did today, besides work. Smiley
Offline orange451

JGO Kernel


Medals: 294
Projects: 5
Exp: 6 years


Your face. Your ass. What's the difference?


« Reply #5288 - Posted 2017-02-13 22:21:19 »

I just find it so hard It so hard to find John Oliver and Trevor Noah on Comedy central funny Sad

I liked having colbert on 24/7 on the station; Was a lot more enjoyable.

First Recon. A java made online first person shooter!
Offline princec

« JGO Spiffy Duke »


Medals: 906
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5289 - Posted 2017-02-13 22:23:16 »

Today I poked at a generic signature. Next thing I know it had exploded all over my entire class hierarchy. That'll teach me. Still, it is done now.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline KaiHH

JGO Kernel


Medals: 416



« Reply #5290 - Posted 2017-02-13 22:29:56 »

I liked having colbert on 24/7 on the station; Was a lot more enjoyable.
Thanks for the tip! Smiley Will try.
Offline dime26

JGO Knight


Medals: 34
Projects: 7
Exp: 12 years


Should traffic wardens be armed?


« Reply #5291 - Posted 2017-02-14 00:45:42 »

Was thinking of ways to add 3D buildings to the level, created a function that will create one big block or a block split up into X number of blocks at random. As I am using Box2D for the collisions (game is topdown 2D) it adds collision boxes where 3D objects are on the floor.

Next I will change clicking on tiles to open up an editor where you can make objects using cubes and some other shapes and apply texture to them.

Once I have a basic level editor will add load / save and a chunk manager.

Click to Play



Online Apo
« Reply #5292 - Posted 2017-02-14 14:19:40 »

Don't forget the valentine's day Cheesy
My interpretation Cheesy
Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #5293 - Posted 2017-02-14 18:56:56 »

I forgot Valentine's day Sad

But I deployed v0.1 of my new website:

http://beyondproxima.appspot.com/

It is a clickable 3d map of the stars near us. Click the star's Hipparchos catalog name to fly to the star at 10,000,000 times the speed of light.

It's coded with SVG, JS and Java.

(The JS is crude and brutal, view source to have a laugh Smiley ).

Offline Coldstream24

JGO Ninja


Medals: 80
Projects: 1
Exp: 4 years


You can fill that void inside with programming, but you'll never return a value.


« Reply #5294 - Posted 2017-02-16 04:15:16 »

Tackled one of the bigger components of my engine that I'd been putting off implementing. On and off, took me about a week, but I present 0.42 alpha of the Morningside Engine and the joint editor!

It was pretty tricky wrapping box2D joints in a way to work with my internal formats but I think it makes a powerful addition to the engine. They also save and load with maps, so they persist 100%.
I'm half-tempted to make a version of gMod at this point Tongue

My website: http://www.onedropgames.com/
My soundcloud: http://www.soundcloud.com/coldstream24
Creator of the Morningside Engine, co-founder of Onedrop Games.
Offline theagentd

« JGO Bitwise Duke »


Medals: 983
Projects: 4
Exp: 8 years



« Reply #5295 - Posted 2017-02-16 13:14:20 »

These last few days, I've worked on improving the RF graphics, since that's one of the main criticisms we got for it.

We don't really draw our houses in RF; we just draw the walls on the ground and leave the rest to the user's imagination. Now, some time ago I added a day/night-cycle, where the ambient light changes over the course of the day, with nice orange mornings and sunsets, and really dark nights. It's really nice, but didn't really have much impact due to the lack of shadows. I realized that I could really easily draw some sun shadows using the same shader and system as for point lights, allowing for a full day/night-cycle with the sun casting long shadows from the buildings, which even have faked roofs casting shadows now, which helps conveying the actual size and shape of the house even though we don't draw it.

I also added cloud shadows that slowly float over the screen and change shape, and added a cloudiness parameter that allows the clouds to be slowly faded in and out, allowing for transitions from a sunny day to a cloudy day over a couple of minutes of playtime, with really good results. I had to make a few compromises on the clouds though, as I really needed bicubic filtering to get them to look good. Still, I'm happy with the results.

Today I added "raytraced" god rays based on said clouds. It's pretty crazy heavy, but done at 1/16th the normal tile resolution so it's not too slow. They're accurate and follow the shape of the clouds as they float by. The intensity of the clouds are faded in based on the cloudiness parameter, so on clear days the god rays will essentially disappear to avoid turning the entire screen white, while on cloudy days the intensity ramps up so that a tiny hole in the cloud cover will cast a glorious pillar of light to the ground.

Here's a pic showing off all the new features:


Myomyomyo.
Offline theagentd

« JGO Bitwise Duke »


Medals: 983
Projects: 4
Exp: 8 years



« Reply #5296 - Posted 2017-02-17 16:40:02 »

Today, I wrote a mesh optimizer in Java to be used on the output of my Blender export plugin.

I'm not too proficient in Python and it's just so goddamn slow at everything, so instead of completely ruining the fast export times I've managed to get so far, I opted for writing a simple optimizer that takes in a model file, optimizes it, then writes it out again. This is done in 3 steps:

1. In the first step, I simply eliminate all duplicated vertices and leave just one of each, then reference the same one with an index buffer. The mesh I output from Blender is mostly unoptimized with lots of duplicated vertices, and this step reduces the vertex count by about 75% percent. This saves a lot of memory on the harddrive and reduces loadtimes a lot, but it actually does not improve performance very much. For example, in one of the submeshes of the giant robots of Robot Farm, the vertex count goes from 38544 --> 9248, a 76% reduction, but the number of vertex shader invocations only drop from 38544 --> 26902, a 30% drop. This leads to the next step...

2. In the next step, the triangles in the mesh is reordered to improve the effectiveness of the hardware vertex cache. As some people might remember, I've done a lot of experiments on the hardware vertex caches of Nvidia, AMD and Intel GPUs, and basically concluded that Nvidia's is f**king weird, AMD's is kinda weird and Intel's is the only sane one. In the end, I concluded that optimizing the meshes for each graphics vendor was too much work, so I simply went with a mainstream algorithm. I ended up implementing Tom Forsyth's simple algorithm, and it works really well. This algorithm simply reorders the triangles in the mesh (by reordering the indices in the index buffer) to increase the chance that vertices are reused as much as possible without specializing it too much to a specific cache size. It's pretty much a general-purpose optimization that should be better than nothing. Anyway, this step further reduced the vertex shader invocation count from 26902 --> 11847, which together with step 1 was a total reduction of 70%! Now, optimally, the number of invocations should be equal to the number of vertices in the mesh, which would mean that there is perfect reuse of vertices and no vertex had to be transformed more than once, but it may not be possible to achieve this. In the end, for this particular mesh the number of invocations is 28% more than optimal, which is acceptable to me.

3. Now, the meshes are optimized for the vertex cache and need a minimal number of vertex shader invocations, but there is one last thing that can be optimized. Inspecting the actual index buffer generated after step 2 reordered the triangles, it's pretty damn random.
Quote
..., 6031, 5989, 5991, 5992, 5993, 5991, 6032, 5992, 5994, 5995, 5996, 5994, 6033, 5995, 8387, 8388, 8389, 8387, 8409, 8388, 8390, 8391, 8392, 8390...
There's a lot of good reuse happening here, but also very huge jumps in which vertex each triangle uses. It essentially reads a completely random vertex from the vertex buffer each execution. This is bad for the GPU, as the vertex data from the VBO is read in with a certain cache line size depending on the GPU. In short, if you reference vertex 1000 and 1001, there's a big chance that the memory read for the data of vertex 1000 will cause the data for vertex 1001 to also be loaded into the cache. Therefore, it is a good idea to try to minimize the "distance" between each subsequent index in the index buffer to increase the chance of the input data of the vertex shader already being in the cache. I did this by simply reordering the vertices in the data to so that they are in the order that the index buffer references them. This does not change the triangle order; it simply changes where the vertices of each triangle lies in memory. Here's an excerpt from the output index buffer:
Quote
..., 2571, 2565, 2571, 2568, 2566, 2567, 2572, 2571, 2566, 2572, 2572, 2567, 2573, 2571, 2574, 2568, 2569, 2568, 2574, 2569, 2575, 2570, 2569, 2574, 2575, 2575, 2576, 2570, 2571, 2572, ...
Much better! This works super well with the optimized triangle order from step 2, as the algorithm tries to place all uses of a given vertex in one place so that it can be reused, so there's a very low risk of a very old vertex being referenced again. To measure the effectiveness of this step, I measured the average "index distance", which is the average
abs(currentIndex - previousIndex)
over the entire index buffer. The average index distance went from 42.82251 --> 5.490958, a very significant improvement to cache coherency!

All in all, here are the final results for the mesh:
Quote
Eliminating duplicate vertices...
Optimizing for post-transform vertex cache...
Optimizing for pre-transform vertex cache...
Vertex count: 38544 --> 9248 (76.00664% reduction)
Invocations: 38544 --> 26902 --> 11847 (69.2637% reduction, 28.103378% more than optimal)
Average index distance: 42.82251 --> 5.490958

Placing 500 of those high-poly robots with no LOD or anything in a test program, my FPS went from 12 to 32 when I switched to the optimized mesh, a ~62.5% reduction in frame time, which matches very well with the ~~70% invocation reduction when you add postprocessing and everything else taking up a bit of time in the first place.

Myomyomyo.
Offline FabulousFellini
« Reply #5297 - Posted 2017-02-17 22:19:41 »

This has nothing to do with java, but it doesn't happen every day.  I found a bag of drugs on the ground on my way to work.  If it was weed I would be very happy, but since it's white, I'm not sure what to do with it.  Maybe I'll go ask a cop what it is lol, but then again, I live in Chicago and would promptly be arrested for possession of a controlled substance.

-FabulousFellini
www.fabulousfellini.com
Offline princec

« JGO Spiffy Duke »


Medals: 906
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5298 - Posted 2017-02-17 23:54:45 »

Chuck it in the bin. Seriously. No good ever comes of white powdered drugs.

Cas Smiley

Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #5299 - Posted 2017-02-18 01:24:10 »

Chuck it in the bin... with your fingerprints on it?

Offline vfmachado

Junior Devvie


Medals: 7
Exp: 4 years



« Reply #5300 - Posted 2017-02-18 02:32:10 »

Today I put my engine into Astah to see how the things are connected...

I didn't include the terrain package and shaders code but I think that still valid.

Ps: I'm really open to suggestions about the initial architecture (I know that was a mess  Huh Cry )
Ps2: hope to help someone to realize how the game/engine architecture can be initialized.


Offline Archive
« Reply #5301 - Posted 2017-02-18 03:44:21 »

This isn't java or programming related. But i've now learned a pretty good amount of meshuggah songs on the drums!
Here's the list as of today:
-New Millenium Cyanide Christ
-The Exquisite Machinery of Torture
-Sickening
-Future Breed Machine
-Beneath
-Soul Burn
-Inside What's Within Behind
-Marrow
-Humiliative
-Stengah
-Rational Gaze
-Glints Collide
-Spasm

I'm currently working on learning Closed Eye Visuals

Now, for the java related thing:
I've completed the javadocs of the engine!

Offline Coldstream24

JGO Ninja


Medals: 80
Projects: 1
Exp: 4 years


You can fill that void inside with programming, but you'll never return a value.


« Reply #5302 - Posted 2017-02-18 11:21:12 »

I registered my company site and installed MediaWiki Smiley Also made a logo, which I quite like.
http://www.onedropgames.com/


If I wanted to post a WIP about my engine in the coming days, would it be okay?

My website: http://www.onedropgames.com/
My soundcloud: http://www.soundcloud.com/coldstream24
Creator of the Morningside Engine, co-founder of Onedrop Games.
Offline h.pernpeintner

JGO Coder


Medals: 55



« Reply #5303 - Posted 2017-02-18 11:27:00 »

Placing 500 of those high-poly robots with no LOD or anything in a test program, my FPS went from 12 to 32 when I switched to the optimized mesh, a ~62.5% reduction in frame time, which matches very well with the ~~70% invocation reduction when you add postprocessing and everything else taking up a bit of time in the first place.

You never fail to amaze me, agent. Never thought that index ordering could have such an impact. This topic is now definitely on my (long) list of TODOs. Are games nowadays always optimizing this? And....since you implement so much stuff, why don't you share your repository or your code?  Pointing
Offline theagentd

« JGO Bitwise Duke »


Medals: 983
Projects: 4
Exp: 8 years



« Reply #5304 - Posted 2017-02-18 13:44:48 »

You never fail to amaze me, agent. Never thought that index ordering could have such an impact. This topic is now definitely on my (long) list of TODOs. Are games nowadays always optimizing this? And....since you implement so much stuff, why don't you share your repository or your code?  Pointing
Thanks. =P

I'd imagine most games do something to optimize this since the gains can be so huge. In my case, it was really going from the worst possible case to almost optimal reuse, so my gains were a bit exaggerated.

Here's the code for my triangle order optimizer: http://www.java-gaming.org/?action=pastebin&id=1508 My implementation is O(n^2), so not entirely optimal according to the original paper. Still, it's fast enough for my uses. A 12 848 triangle mesh took 260ms to optimize for me, so good enough for an offline tool. There's some low-hanging fruit in there to optimize.

Here's the pre-vertex cache optimizer code. http://www.java-gaming.org/?action=pastebin&id=1509 Very simple, there's probably much better algorithms out there, but I couldn't measure significant gains from running this anyway.

Note: You should always run the triangle order optimizer FIRST, then run the pre-vertex cache optimizer. The triangle order optimizer messes up the vertex order, which the pre-vertex cache optimizer fixes without changing the triangle order.

Myomyomyo.
Offline princec

« JGO Spiffy Duke »


Medals: 906
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5305 - Posted 2017-02-18 15:13:49 »

I seem to recall years and years ago getting perfectly decent performance optimisation just by the simple expedient of sorting triangles in order of their average vertex index number. And that's O(n log n) perf on average. It's not quite as fancy but it gets like 90% of the win for bugger all effort and the best bit is that it can be done in realtime with dynamic meshes. Food for thought. (Why not try it and compare?)

Cas Smiley

Offline theagentd

« JGO Bitwise Duke »


Medals: 983
Projects: 4
Exp: 8 years



« Reply #5306 - Posted 2017-02-18 15:22:46 »

I seem to recall years and years ago getting perfectly decent performance optimisation just by the simple expedient of sorting triangles in order of their average vertex index number. And that's O(n log n) perf on average. It's not quite as fancy but it gets like 90% of the win for bugger all effort and the best bit is that it can be done in realtime with dynamic meshes. Food for thought. (Why not try it and compare?)

Cas Smiley
Actually, the first thing I did was sort based on the lowest index number. It couldn't compare to Tom's algorithm. Hmm... I'm gonna try something similar though.


EDIT: So I tried something really simple:

1. Sort triangles based on (i0 + i1 + i2).
2. Reorder vertices in the order they are used by the triangles (= the pre-transform cache coherency optimization, step 3 in my previous long post).
3. Repeat until the result gets stable.

The result was actually pretty good, but still not as good as Tom Forsyth's algorithm.

Quote
Simple algorithm after 86 iterations: invocations: 38544 --> 26902 --> 14308 (62.878788% reduction, 54.71454% more than optimal)
Tom Forsyth's algorithm: 38544 --> 26902 --> 11904 (69.115814% reduction, 28.719727% more than optimal)

EDIT 2: According to Forsyth, his algorithm can be implemented in linear time.

EDIT 3: Note that all the invocations counts are reported by the hardware of my Nvidia GPU. The numbers may be very different on AMD and Intel GPUs.

Myomyomyo.
Offline princec

« JGO Spiffy Duke »


Medals: 906
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5307 - Posted 2017-02-18 15:58:37 »

Try the average of the 3 verts as the sort key.

Cas Smiley

Offline theagentd

« JGO Bitwise Duke »


Medals: 983
Projects: 4
Exp: 8 years



« Reply #5308 - Posted 2017-02-18 16:05:05 »

Try the average of the 3 verts as the sort key.

Cas Smiley
It's the exact same thing. The average is (i1 + i2 + i3) / 3, so I'm just sorting based on <average>*3.

Myomyomyo.
Offline princec

« JGO Spiffy Duke »


Medals: 906
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5309 - Posted 2017-02-18 16:06:03 »

Hah, so it is of course.

Cas Smiley

Pages: 1 ... 175 176 [177] 178 179 ... 186
  ignore  |  Print  
 
 

 
Archive (338 views)
2017-04-27 17:45:51

buddyBro (536 views)
2017-04-05 03:38:00

CopyableCougar4 (980 views)
2017-03-24 15:39:42

theagentd (1018 views)
2017-03-24 15:32:08

Rule (994 views)
2017-03-19 12:43:22

Rule (976 views)
2017-03-19 12:42:17

Rule (974 views)
2017-03-19 12:36:21

theagentd (1073 views)
2017-03-16 05:07:07

theagentd (995 views)
2017-03-15 22:37:06

theagentd (762 views)
2017-03-15 22:32:18
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
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!