Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 13 Sep 2012
Offline Last Active Today, 10:45 PM

#5220056 Relationship between Linux and Java/Dalvik, .so vs .jar

Posted by TheChubu on 29 March 2015 - 06:29 PM

assume the Android operating system has some layer built in to allow the two to communicate with each other much like the .NET framework.
Its just the Java VM calling into native code. Pretty sure no exceptional OS feature is needed for that beyond calling a function in a library.


Although as swiftcoder mentioned, Java's particular native interfaces are awful. I have no experience making them, but just for using them you have to forego a couple of things. For example, data has to be marshalled between what the native code sees and what you sent it from JVM run code. Things like endianess, liveness of the pointers, and so on.


Say that you pass an array (effectively, a pointer to an array) to native code. The JVM wont probably be able to guarantee that it wont move the array in a GC pass while the native code is running (remember GC runs in a different thread), that way the native code wont be able to read nor write to it so JVMs will probably just defensively copy anything that you pass to native code. AFAIK there are explicit memory pinning mechanisms exposed in CoreCLR for example, not something you get in JVMs currently though (on the other hand, HotSpot in desktop has a very, very advanced JIT compiler, which is nice).


There are ways to explicitly use a native buffer from inside Java-land, so called "direct" ByteBuffers, aka, wrapper over a pointer returned by a malloc call. They work well, they can be read efficiently by native code, no additional copying required for just passing the data, but they're a pain in the but to use from Java and you will need additional copying from the data in your Java program to the insides of the native buffer/direct ByteBuffer.


Direct ByteBuffers have also a rather convoluted mechanism for being freed that requires a phantom reference to a cleaner object, that frees the memory when it goes out of scope (or so it would like you to think) so there isn't a deterministic (nor garbage free!) way to free unused memory, which can be a big issue, since native/direct buffers have an upper limit in JVMs (meaning you can get an out of memory error just by using too much of that specific kind of memory, regardless of you having actual memory left or not).


As you can see, it gets pretty complex really fast, its simply one of the rough spots in Java and the JVM that became obvious enough when the language got popular.

#5219828 From scratch vs Unity

Posted by TheChubu on 28 March 2015 - 10:13 AM

Why make a game from scratch when you can use unity? Particularly the new Unity 5.

Unity solves the kind of problems I like to solve myself. Say, the architecture of the whole thing. I like to think up how say, the loading systems will construct data that the game systems will consume, the interfaces they will use to communicate, things like that.


Besides, once I come up with these things, I like to use them. For example, I like to use my RenderPass class, see how it fares when the next feature comes up, for the point lights pass I had to refactor a few things, for the bloom pass it turns out that it worked fine as it is. I really enjoy not only to design these things but also to see how they fare when its time to make modifications.


So to me that's my reason for not using it, Unity has no appeal to me, it wont help me to do the things I enjoy to do.


Now in the other hand, if I you are more "results focused", ie, you just want to make a game and don't really care for the rest, or if we're talking about work and not a hobby, I'd say Unity is a great choice. Those do are reasons to use Unity.

#5219802 Books and Tutorial Recommendation

Posted by TheChubu on 28 March 2015 - 07:06 AM

arcsynthesis.org/gltut is down, but the repository is still there:




Download the tutorial 0.3.8 file, it has the PDF with the tutorial/book inside and all the sources. I like how it goes about the theory and the progression.

#5219277 Skeletal animation issues

Posted by TheChubu on 26 March 2015 - 04:50 AM

Well, look at this: 




The wireframe is the actual geometry. I bake the bind pose on the vertices. The garbled polygons and pink pixels (NaNs) is the result of my awesome skeletal animation. Those garbled polygons should resemble the humanoid walking, but It kinda doesn't resembles that... at all.


My understanding is that each joint can be represented with a rotation matrix, and that rotating along the hierarchy of joints, you get the final position.


What I do is to have a two dimensional array Mat3f[][], first index is the joint, second you would index into a specific frame of that joint. The idea is to lerp between the frames, according to the animation timer and current delta, and multiply the resulting interpolated matrix by the parent bone (which it should be already an interpolated matrix of the current frames of the parent joint).


Now pardon my Java but this is my code to compute each joint:
Aaand this is the vertex shader: 
If you need more information just ask.

#5219233 Question about saved games

Posted by TheChubu on 25 March 2015 - 11:11 PM

Exactly and at that point you would be storing your saved data in database.
Even if its not an online game, you could use an embedded database like SQLite to store save game data. It wont be as fast as writing your own custom binary format... but you wont need to write your own custom binary format :3

#5218982 Documentation for PSGL and GNMX

Posted by TheChubu on 25 March 2015 - 12:20 AM

Googling PS3 GCM turns this in the first result:




PSGL is the shading language, not the API.

#5217965 LibGDX Box2D libraries

Posted by TheChubu on 20 March 2015 - 04:10 PM

Yes, just use those two. For Bullet its the same, gdx-bullet.jar and gdx-bullet-natives.jar


The ARM files are probably separate since you wouldn't distribute your application in a .jar for those devices in the first place (need RoboVM for iOS, .apk and DEX for Android), so cant put those in the *-natives.jar.


And the .jar files you've mentioned are just java/jni wrappers on the top of the cross-compiled ( in case of ARM ) libraries. So you need to add .so (dll) file for x86 to support PC.


No, the *-natives.jar contains those. Its designed that way so you don't have to specifically create a directory path to load the native libraries (unlike say, LWJGL), libGDX resolves the path automatically loading them as resources inside the natives jar. You can open them with anything that supports ZIP compression to see whats inside, you'll see the .dll for windows, .so for Linux and .dylib for OSX, x86 and x86_64 versions. 

#5217537 Mantle programming guide and white paper released

Posted by TheChubu on 18 March 2015 - 09:06 PM


#5217508 arcsynthesis.org

Posted by TheChubu on 18 March 2015 - 07:09 PM

Eh no need to use the way back machine. If you followed the tutorial, at the beginning it says you should download the tutorial files from a BitBucket repository:




The PDF version of the tutorial is inside the file.

#5216202 What are your opinions on DX12/Vulkan/Mantle?

Posted by TheChubu on 12 March 2015 - 08:57 PM

 One to store per-draw data 
Do you use some form of indexing into the UBO to fetch the data? I'm currently batching UBO updates (say, fit as many transforms, lights or materials as I can on one glBufferSubData call) and do a glUniform1i with an index, then index into the UBO to fetch the correct transform. This has the obvious limitation that I need one draw call per object being drawn to update the index uniform in between, but honestly I'm not sure how else I could do that. And AFAIK its also how its made in a nVidia presentation about batching updates.


Good thing is that I can do usually batches of 100 to 200 in one buffe rupdate call, bad thing is that I have equivalent number of draw and glUniform1i calls. Have in mind that I'm using OpenGL 3.3 here so no multi draw indirect stuff :D


And BTW, marking Promit's post as "Popular" is the understatement of the year (I never saw that badge before!). Thing hit like all the retweets and 300 comments on Reddit. You could sell Promit as internet traffic attractor if the site is low on cash :P

#5216106 How do you stop your game from being stolen/torrented?

Posted by TheChubu on 12 March 2015 - 12:25 PM

How do you stop your game from being torrented?
You cant.

#5215662 Weird winding behavior porting to GLES

Posted by TheChubu on 10 March 2015 - 09:31 AM

Since my understanding is that both of these systems should have the same default culling behavior, I'm wondering if I missed something in initialization? 
Yes, set the winding order to whatever you need on all platforms, don't rely on the default settings being properly set. Specially on mobile you're bound to hit a rough spot in some device somewhere that doesn't does what it should do.


Also: https://www.opengl.org/wiki/Face_Culling

#5215659 GLSL Working on Nvidia & not on AMD

Posted by TheChubu on 10 March 2015 - 09:20 AM

Pretty sure AMD's GLSL compiler will complain if you put 'f' at the end of float literals (because its not valid GLSL).


But yeah, when each shader is compiled, check if it compiled correctly, print log otherwise. Then link the program and check if it was linked correctly, print log otherwise. You won't get anywhere if you don't start to do that.


Also, use ARB_debug_output/KHR_debug.

#5215449 What are your opinions on DX12/Vulkan/Mantle?

Posted by TheChubu on 09 March 2015 - 11:35 AM

Congrats for ending up on John Carmack's twitter feed!
LMAO the clickbait title they guy gave it hahaha


He could have gone all the way:


"Nvidia's ex employee tells you 10 things you wouldn't believe about the company!"

"5 things nvidia isn't telling you about their drivers!"

"Weird facts from nvidia employee, shocking!"

#5215306 How do I know if I'm an intermediateprogramming level?

Posted by TheChubu on 08 March 2015 - 03:19 PM

This thread reads like one of those crappy personality tests you find around.


"You are an X, Xes do not like to Y, but are very Z when they put their mind to it."