Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Sep 2012
Offline Last Active Yesterday, 06:56 PM

#5289673 Is making game with c possible?

Posted by TheChubu on 01 May 2016 - 10:12 PM

why we always use c++?

We do?

#5289663 Is using the Factory or Builder pattern nessesary?

Posted by TheChubu on 01 May 2016 - 09:02 PM

Domestic shouldn't be there and Client shouldn't be abstract. Literally no difference between the classes in your example. Either you got a client with just an id, or an international client with a list of ids.  


Dont make classes just because. For a subclass to exist it has to either have different behavior (methods) or different state (fields) than the superclass. Otherwise it has no purpose.


Hell you could remove International/Domestic altogether, remove the ID field from Client, and just let Client have a documents list, some will only have an Id, some will have passports/driver licences.


Also you should respect standard naming schemes: ID == bad, id == good. clientID == bad, clientId == good.


Have the constructor enforce invariants, can an id be null? Can a last name be null? Can a first name be null? Strict API leads to less bugs.

#5289591 Why does GLSL use integers for texture fetches?

Posted by TheChubu on 01 May 2016 - 11:15 AM

tl;dr; Because bad calls were made.

#5288238 Optimizing Generation

Posted by TheChubu on 22 April 2016 - 08:25 PM

All of those virtual functions are silly. Quite a few of them don't even use state from the object (ie, they could be static).


And the rest shouldn't work like that at all:

public virtual int Temperature()
  // -100 to 100
  return 0;

public virtual bool Light()
  return false; 


Those are fields dude, not methods.


public readonly int Temperature;
public readonly bool Light;
// etc.


Defaulting to virtual is a bad idea on C#, VM wont inline those functions. Also that Block could just be a struct just fine if instead of relying on 10 virtual functions you use fields as you should.


All of those FaceDataX methods could be static. You can just get all those "isXYZSolid" booleans first as local variables, then do the logic over them, instead of doing "IsSolid(north)" then asking the same again a few lines below. I really hope the Vector classes are structs, otherwise you're allocating a shit load of tiny objects.


Also you could make the enums "extend" byte directly, save a couple of bytes here and there.

#5286067 Yo dawg, I herd u liek gd.net

Posted by TheChubu on 09 April 2016 - 03:41 PM

So we put gd.net in ur gd.net PM editor so you can gd.net while you're gd.net'ing




I have no idea how this happened. I accessed the PM screen, then some other section, then hit "back" on the broswer a few times and soon enough I had gd.net loaded inside the text editor \o/


PD: I posted this topic from inside the text editor  :D


EDIT: It seems the text editor is an iframe, and somehow the site got set as source of the iframe (My guess: Relative fetch element magic of jQuery).

#5285903 If statements are all you need

Posted by TheChubu on 08 April 2016 - 02:58 PM

Ifs? Nah, MOV is all you need 


#5285142 how we do a collision?

Posted by TheChubu on 04 April 2016 - 05:42 PM

We do a downloadings of Bullet or Box2D and let them handle collisions for you.

#5284346 Should I start with fixed-function-pipeline OpenGL or the newest possible?

Posted by TheChubu on 30 March 2016 - 03:48 PM

    Back to the topic, I did some 5-6 tutorials with the old OpenGL, now the next best step seems to be to read "Learning Modern 3D Graphics Programming" (why do people use the word "modern" in a book, I've always wondered). Nevermind, hope I don't have problems.
Thats a really nice online book thingy. It teaches pure "core" OpenGL, so no deprecated stuff at all. It also nails down the math nicely. 

#5283604 Vulkan render pass questions

Posted by TheChubu on 26 March 2016 - 02:01 PM

 - It might be possible to work around this by packing all my bloom mipmaps into a single texture.

Yeah, googled around for "nv_texture_barrier vulkan" but got no results.


In any case, yeah, just use more render passes.


Probably you've seen this


They talk a bit about sub render passes but the example they gave is contrived (as the speaker acknowledged).

#5281293 Game Engine design for many-typed many-copied entities

Posted by TheChubu on 14 March 2016 - 09:26 PM

 A bitset with 1,000 bits fits into two cache lines (64 bytes per cacheline = 512 bits per cacheline), and the very first iteration will shrink this to one cache line (it halved the search area), meaning AT WORST this causes one cache miss. 

Wait a second, you're mixing a bunch of things: First you mentioned binary search over a vector, not a bitset. Second, you're suggesting binary search for iteration? That doesn't makes much sense, it wouldnt help you for iterating over a bitset.


For binary searching through a vector (what you initially suggested) you'd need 1000 ints for the IDs, thats 4kB of data and it'd really involve a bunch of cache misses.


There are plenty of ways to iterate over the bits of an int, but it has to simply check if each value of the backing array has any single bit on before fetching the next one, regardless of the technique you use to iterate over the bits themselves in the single int.

#5281158 Game Engine design for many-typed many-copied entities

Posted by TheChubu on 13 March 2016 - 10:32 PM

I wonder how fast a binary search over a vector would be compared to a custom bitset implementation...
Binary search fcks up the CPU's branch predictor. Its pretty much one random jump into memory each iteration, hard to predict, and many times the branch decides which memory segment needs to be loaded next if they're far apart enough, thus hindering the CPU's ability to preload it into a cache line. This cost is amortized if you're handling a lot of data.


Bitsets its a couple bitwise ops to find the word index in the array, jump to it, then do a couple bitwise ops again. Much more straightforward (although not as memory efficient if they're very sparse).

#5280620 Game Engine design for many-typed many-copied entities

Posted by TheChubu on 10 March 2016 - 08:58 PM

When you scroll down to "Results", the graph shows what I mean about ECS not scaling well:


Eh, check these benchs from artemis-odb guys https://github.com/junkdog/artemis-odb Those are raw benchmarks, no game, just testing the framework's functions in a "game loop" without game.


So I cloned Artemis Spaceship Warrior demo game, adapted it to dustArtemis (my own fork of artemis), made it spawn a shitload of enemies and bullets and I can play with around between 7k and 12k active entities flying around according to the counter, at 300 fps (minimum). Which is 3.3 milliseconds for each frame of the entire game, and its made on libGDX, which isn't known for performance. I get over 100k entities created and deleted after playing the game 15 seconds like this, 3.3 ms per frame minimum.


(it has a high entity count because each bullet, particle and background star is an entity, so it gets crazy high).

#5280461 How to programmatically create Tile Maps

Posted by TheChubu on 09 March 2016 - 08:02 PM


#5280448 Blending with two buffers

Posted by TheChubu on 09 March 2016 - 06:16 PM

Don't draw to the front buffer. It causes artifacts.


The front buffer is conceptually the one you're showing in the monitor. So any tiny change in there will cause artifacts. Don't touch it. If you need more buffers, learn how to use framebuffer objects.

#5280447 How to programmatically create Tile Maps

Posted by TheChubu on 09 March 2016 - 06:12 PM

So you dont have a computer, but you're coding in Java... how exactly? In paper?