Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (804)
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 ... 69 70 [71] 72 73 ... 216
  ignore  |  Print  
  What I did today  (Read 3667852 times)
0 Members and 2 Guests are viewing this topic.
Offline thedanisaur

JGO Knight


Medals: 59



« Reply #2100 - Posted 2015-04-21 04:48:06 »

I recently found System.arraycopy() in my quest to make my level editor faster (I just implemented batch rendering and building vbos with 1.5 billion floats takes a while...) and I was going to tell you that I increased my build method's speed by 26x (~175,500ms to ~6,600ms).

Which is still slow, but pretty good none the less, then I realized that I was reading my profiler wrong and I actually decreased the method time to ~460ms!!! 381X increase in performance! It's pretty basic stuff, but I find it pretty cool so I figured that I'd share more.

Here's what I was doing initially:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
      for(int i = 0; i < m_new_terrain_objects.size(); i++)
      {
         //Get the object
         TerrainObject object = m_new_terrain_objects.get(i);
         //Set the vertex offset for this object
         object.setBatchVertexOffset(m_vertex_array.length);
         //copy the vertex array from the object
         float[] src_vertices = createInterleavedArray(object.getTransform(), object.getMesh().getVertices());
         //build a temp array of the current vertex size plus the new vertex array size,
         //so that the new info can be added
         float[] temp_array = new float[m_vertex_array.length + src_vertices.length];
         //now copy the current vertex data into the temp array
         System.arraycopy(m_vertex_array, 0, temp_array, 0, m_vertex_array.length);
         //now copy the new object's data into the temp array
         //at the proper offset (the length of the current vertex array)
         System.arraycopy(src_vertices, 0, temp_array, m_vertex_array.length, src_vertices.length);
         //now update the current vertex array to reflect the changes
         m_vertex_array = temp_array;
      }


temporary array copies, building a new array every time, and basically utter nonsense. I thought a little more about it and I refactored:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
int size = 0;
      for(int i = 0; i < m_new_terrain_objects.size(); i++)
      {
         size += m_new_terrain_objects.get(i).getMesh().getVertices().length * (Vertex.SIZE - 4);
      }

      float[] temp_array = new float[m_vertex_array.length + size];
      System.arraycopy(m_vertex_array, 0, temp_array, 0, m_vertex_array.length);
      int current_index = m_vertex_array.length;
      for(int i = 0; i < m_new_terrain_objects.size(); i++)
      {
         TerrainObject object = m_new_terrain_objects.get(i);
         object.setBatchVertexOffset(current_index);
         float[] src_vertices = createInterleavedArray(object.getTransform(), object.getMesh().getVertices());
         System.arraycopy(src_vertices, 0, temp_array, current_index, src_vertices.length);
         current_index += src_vertices.length;
      }
      m_vertex_array = temp_array;


There was no real way for me to get around figuring out the final array size so I have to touch every new object and find how many vertices there will be. Then I build one temp array to hold the final data and proceed to fill it up with all them floats.

Now I do have another function (createInterleavedArray()) that still builds a new array of the mesh data that I could just store, but I prefer it in a more readable format, the batched objects are only built in the level editor, and I already have good enough performance in this area.

Every village needs an idiot Cool
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #2101 - Posted 2015-04-21 04:59:33 »

What about
m_vertex_array = Arrays.copyOf(m_vertex_array, m_vertex_array.length + size);
and then ditch temp_array?

Offline Opiop
« Reply #2102 - Posted 2015-04-21 19:39:38 »

Started a new job doing fairly repetitive work, but making very nice money and it's not even that hard! I've learned to always have connections, my girlfriend's step-father offered me this job and now I'm doing really well.

Also started on an Android app, having lots of fun in XML!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kingroka123
« Reply #2103 - Posted 2015-04-21 20:06:25 »

@opiop65 Pssst... Android Studio  Pointing
Offline thedanisaur

JGO Knight


Medals: 59



« Reply #2104 - Posted 2015-04-21 22:49:19 »

@BurntPizza Good thinking.

Every village needs an idiot Cool
Offline Opiop
« Reply #2105 - Posted 2015-04-22 03:38:01 »

@opiop65 Pssst... Android Studio  Pointing
I'm already using it Wink The preview renderer doesn't play nice with custom views though, so I can't do much with the drag and drop editor :/

The rest of it is very cool though! Love the Gradle integration.
Offline death_angel
« Reply #2106 - Posted 2015-04-22 09:27:49 »

I am working on a prototype for a game:
<a href="http://www.youtube.com/v/vClIgQkx_sI?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/vClIgQkx_sI?version=3&amp;hl=en_US&amp;start=</a>
And started to creating one of the three main characters:

I am just a guy
Offline Slyth2727
« Reply #2107 - Posted 2015-04-25 18:28:53 »

New solve times for the 3x3 cube.. I'm getting slightly better, haven't really worked on it recently. My personal best is now 23 seconds Smiley so close to sub 20!



Related to programming, I'm going to states with my game in about a week.. I really need to work on it some more.
Offline rwatson462
« Reply #2108 - Posted 2015-04-25 21:25:47 »

Hey, as I feel like I have achieved something today, I'm going to get in on this post!

Today I have made a cracking start on a game (no, really).  I call it Lost Luggage.

I can't do graphics so it's all textual right now, here's a screenie:



The aim is to get luggage on the left to the correct aircraft on the right Wink   The part I was most pleased about it that I finally got to level 3 after 20 minutes lol
Offline MrPork
« Reply #2109 - Posted 2015-04-26 03:34:05 »

                I've kept on updating my game project called "Project Eclipse" with the help from multiple people including BurntPizza! Especially BurntPizza. I am currently trying to make a Parallax star field that doesn't leave nothingness when they get randomly put on the screen after getting deleted from getting out of bounds. I'm going to have to figure out how to do some pac-man style object wrapping so I generate the stars once and done. All the assets including sound and music is made by me! Cheesy

<a href="http://www.youtube.com/v/tZseJnzQx8Q?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/tZseJnzQx8Q?version=3&amp;hl=en_US&amp;start=</a>

"f**k it, maybe it'll work." -Me
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Opiop
« Reply #2110 - Posted 2015-04-26 19:29:47 »

Going for my first round of interviews for my internship on Tuesday, so I've been studying and trying really hard to focus on what I actually need to learn, instead of working on my Android app which I'm really excited about!
Offline SHC
« Reply #2111 - Posted 2015-04-27 17:16:57 »

Wrote an IRC bot for fun. It is also a mini IRC client that I can use it to chat by sending manual commands by typing into the command prompt window.



Features right now are some basic commands, a calculator (based on Nashorn), SASL authentication, SSL connection. Had any more ideas that'd be cool to implement? Please tell me.

Offline Slyth2727
« Reply #2112 - Posted 2015-04-28 04:05:13 »

Played around a little with making a Minecraft 'hacked client'. Even though the code is horrendous, it's still fun to play around with it. Here's what I've got after messing with it after a couple days (just finished the basic rear view mirror thing).

Offline Ecumene

JGO Kernel


Medals: 200
Projects: 4
Exp: 8 years


I did not hit her! I did not!


« Reply #2113 - Posted 2015-04-28 14:47:58 »

Played around a little with making a Minecraft 'hacked client'. Even though the code is horrendous, it's still fun to play around with it. Here's what I've got after messing with it after a couple days (just finished the basic rear view mirror thing).

Sooner or later someone's going to sue you or something... Keep it up Cheesy

Offline Ashedragon

JGO Coder


Medals: 27
Projects: 1
Exp: 4 years


The best person you could possibly be is yourself.


« Reply #2114 - Posted 2015-04-29 02:28:24 »

I started messing around with a music tracker called Sunvox. I've dealt with trackers before, but they've always been rather unwieldly for me. I'm kinda liking Sunvox so far, though.  I've also fixed a number of issues regarding the Behavior System I wrote for my own little framework (help my workflow a bit by having some things already done), but it's still far from perfect.

boo
Offline Slyth2727
« Reply #2115 - Posted 2015-05-01 05:07:15 »

I actually finished a game Smiley
May release it here soon. I'm content. It's also 1 am.
Offline Ashedragon

JGO Coder


Medals: 27
Projects: 1
Exp: 4 years


The best person you could possibly be is yourself.


« Reply #2116 - Posted 2015-05-03 01:58:45 »

Made more music, this one being a sort of town/water dungeon theme for RPGs. It's free to use (just gotta give credit) so there's that.
I also started thinking about a component entity system for a game I'm making, because it's one of the most efficient ways I could think of that would also be easy for modding. Modded UI might be slightly tricky, but me and my partner might be able to come up with a solution.

boo
Offline theagentd
« Reply #2117 - Posted 2015-05-03 09:03:52 »

I rewrote some of my mapped VBO managing code and improved the two slowest renderers in Insomnia. Before, every view (camera/shadow map) had its own set of VBOs for what was visible for that view. Each view frustum culled terrain and 3D models, constructed a list of instances that were visible, mapped a buffer, placed the data in the buffer, unmapped the buffer, then rendered itself. All views like these were calculated in parallel to the extent that this was possible (cull views and construct lists in parallel, map buffers in OpenGL thread, data uploaded in parallel, buffers unmapped in OpenGL thread, render everything in OpenGL thread). This had a number of problems that were quite difficult to detect.

1. Mapping a lot of buffers is slow as hell. In my stress test, I had almost 1000 point lights visible with 6 shadow maps each, resulting in over 10 000 VBOs being mapped each frame. Persistent mapped buffers "fixed" this as the map operation could be avoided, but that doesn't help OGL3 GPUs, causing a shitload of driver overhead. Mapping a lot of buffers also kills the driver's internal multithreading, as each map operation causes synchronization inside the driver.

2. Due to how my code was structured, each pass needed to fetch render data (visibility lists, VBO) of each view from a tiny little HashMap. It turned out that the simple map and unmap passes run on the OpenGL thread were locking up the OpenGL thread for much longer than they should be due to the overhead of having to fetch the render data.

3. My engine can seamlessly switch between using unsynchronized VBOs and persistently mapped VBOs. It turns out that glMapBufferRange()'s ability to reuse the previous ByteBuffer instance is very limited.
Quote
The old_buffer argument can be null, in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, otherwise a new ByteBuffer is created.
In other words, it can only reuse the previous ByteBuffer if you map the exact same number of bytes each frame and the driver gives you the exact same memory address (which it should unless you reallocate the VBO). When using unsynchronized VBOs, the number of visible objects for each view changed pretty much every frame, causing new ByteBuffers to be allocated each frame. In my stress test, this amounted to over 10MBs of garbage per second of ByteBuffers, Cleaners and Deallocators.


The solution was pretty simple, but required some rewriting. I modified my renderers to use a shared VBO system, so instead of each view mapping their own buffers they would "reserve" a part of the VBO instead. Since I'm only mapping a handful of VBOs each frame now, the driver overhead is minimal. Fewer mapped VBOs also means fewer ByteBuffers created each frame. In addition, the mapping and unmapping code for unsynchronized VBOs does not need to query the render data of each view anymore since it only needs to know the total amount of data needed, removing a lot of HashMap overhead. Although I expected this to yield a noticeable performance increase when using unsychronized VBOs, I did not expect unsychronized VBOs to become as fast as persistent VBOs. In addition, both unsychronized and persistent VBOs are significantly faster than before.

Note: Threading in the below table refers to the Threaded Optimization setting in the Nvidia Control Panel, which controls driver multithreading. Both Intel and AMD also have multithreaded drivers, but do not allow the user to override the driver's automatic selection.

TechniqueOld FPSNew FPS% improvement
Unsynchronized, threading off34 FPS52 FPS53%
Unsynchronized, threading on19 FPS62 FPS226%
Persistent, threading off46 FPS53 FPS15%
Persistent, threading on57 FPS64 FPS12%

This is mostly an optimization for computers with older GPUs that don't support persistent VBOs, where the improvement is 82% (34 FPS --> 62 FPS), but even computers with GPUs that support persistent buffers got a 12% increase from the improved parallelism due to the reduced HashMap overhead. Using a single thread in Insomnia and disabling threaded optimization so it only uses 1 thread, I get 21 FPS. With 8 threads on my Hyperthreaded quad core and threaded optimization, I get 64 FPS = 3.05x scaling.

Myomyomyo.
Offline Opiop
« Reply #2118 - Posted 2015-05-03 15:03:29 »

Finished the interview process for my internship, I'm now working on a little project that will determine if they will hire me or not! Also had my senior prom, it was actually kind of fun and being dressed up really gives you a confidence boost. It also helps when you have a pretty girlfriend Wink
Offline theagentd
« Reply #2119 - Posted 2015-05-03 15:09:17 »

Lost my summer job and the apartment I plan on living in in a few a weeks had break-in.

Myomyomyo.
Offline kingroka123
« Reply #2120 - Posted 2015-05-04 00:25:14 »

I published my first app today  Grin. find it here-> Tura It is VERY simple to play. I hope you guys enjoy it.
Offline Ecumene

JGO Kernel


Medals: 200
Projects: 4
Exp: 8 years


I did not hit her! I did not!


« Reply #2121 - Posted 2015-05-04 00:32:21 »

Prepping for the Canada Wide Science fair... I've finished my 5-page paper, the computer is built, everything is weighed to be transported through plane, and I've been working sleeplessly on the project board. There's around seven days left until my flight. Grin

Offline goblinJoel
« Reply #2122 - Posted 2015-05-04 01:07:22 »


I have no idea if I can actually use FB photos like this.

I made a Spinner widget! Because I was afraid of Swing and whatever AWT uses! I made my own! I also make many other things, like poor decisions!
Offline Slyth2727
« Reply #2123 - Posted 2015-05-04 02:29:23 »

Lost my summer job and the apartment I plan on living in in a few a weeks had break-in.

That really sucks man.. I'm sorry about that. I hope you're feeling better, that must've been a pretty tough blow.
Offline theagentd
« Reply #2124 - Posted 2015-05-04 17:24:24 »

Lost my summer job and the apartment I plan on living in in a few a weeks had break-in.

That really sucks man.. I'm sorry about that. I hope you're feeling better, that must've been a pretty tough blow.
Thanks. Seems like the apartment's mostly okay, and it doesn't look like all hope is out for the summer job, although it won't be what I expected and it seems like it's not as much as it initially was. Well, better than nothing...

Myomyomyo.
Offline Slyth2727
« Reply #2125 - Posted 2015-05-04 20:27:57 »

Thanks. Seems like the apartment's mostly okay, and it doesn't look like all hope is out for the summer job, although it won't be what I expected and it seems like it's not as much as it initially was. Well, better than nothing...

As long as you've got some source of income, you'll be fairly better off than a lot of other people. I'm sure there are plenty of jobs available for programmers though, especially talented ones?
Offline Olo

JGO Coder


Medals: 15
Projects: 3
Exp: 5 years


Metaphysical solipsism AFFIRMS your existence


« Reply #2126 - Posted 2015-05-04 20:47:57 »

Finally found time to do some programming Smiley
Created a working (but featureless ;c ) raycast renderer:

And a copy of Conway's Game of life:


If you really want to try them here are the links:
DoomTest.jar (Left Right Up Down - move, zx - look)
GameOfLife.jar (space-run, as - increase/decrease step time, mouse-draw)

-Can you fix it?
-No, I can't. But I can bypass it with one of these.
Offline theagentd
« Reply #2127 - Posted 2015-05-05 16:45:58 »

Thanks. Seems like the apartment's mostly okay, and it doesn't look like all hope is out for the summer job, although it won't be what I expected and it seems like it's not as much as it initially was. Well, better than nothing...

As long as you've got some source of income, you'll be fairly better off than a lot of other people. I'm sure there are plenty of jobs available for programmers though, especially talented ones?
My only income is student aid, and I don't get that during the summer. The problem is that I declined my previous summer job to get that one... Luckily it seems like not all hope is lost with the new one, although it seems like it'll be a different task than what I had in mind.

Myomyomyo.
Offline SHC
« Reply #2128 - Posted 2015-05-05 17:28:09 »

I tried (and achieved) doing multi-threaded application using GLFW (My OO wrapper for GLFW actually).



This uses immediate mode mainly since it is a test, but the other tests are indeed modern GL. Will soon update this one. Source code is available here: GLFWMultiThreadTest.java

Offline Opiop
« Reply #2129 - Posted 2015-05-05 17:30:36 »

Bought a Windows Phone to test out and see if I like WP. Also probably going to get into developing apps for it if I actually do end up upgrading my current phone to a WP, which could be fun! I also have been working at getting my internship pretty hard, hopefully I'll know here in a few days.
Pages: 1 ... 69 70 [71] 72 73 ... 216
  ignore  |  Print  
 
 

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

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

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

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

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

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

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

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

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

nelsongames (5116 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!