Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Jul 2010
Offline Last Active Yesterday, 04:09 AM

#5310628 Data throughput

Posted by on 13 September 2016 - 01:37 PM

Wow Matias very thorough reply!

Yes 60fps was indeed the target and the fact that you think any of those things could be a problem makes me think more could be achieved.
Some limitations could be out of my control but you gave me a great idea to test the theoretical limits by taking out all the variables I can.

So I will do 2 tests. One with all the data staying on the gpu as a baseline. And a second one uploading all the data each frame but do no calculations on the cpu. I.e. not changing any of the data but just reupload it.

That should give me some good indicators.

I will also use some gou profile to see what commands got issues to help give me a better indication.

Thanks for great reply!

#5310592 Data throughput

Posted by on 13 September 2016 - 08:25 AM

Hey all,

Just looking for some guestimates with regards to how many vertices one could update safely per frame in a dynamic buffer.


I have done some testing and the limit seems lower than I thought it would be.


For reference I am uploading 5mb ish worth of data roughly at 20 bytes per vertex.

So about 250,000 vertices I can push though per frame and that seems to be the limit on my machine.


To be honest that should probably be enough for what I need I just wondered if that number seemed on the low to anyone else? I thought double that should have been easily achievable. 




(on a low-middish range gpu if that helps)

#5305904 render huge amount of objects

Posted by on 15 August 2016 - 02:44 AM

If you are on a desktop you can see and old flash demo I did here to test what your gpu can handle.

this is in flash by the way so native you should be able to beat what you see here (it is not massively optimised either)


There is no instancing and each object has a unique transform, the only thing constant between draws is the material.


Lower end gpus should be 500-1000 no problems, mid range 1500-3000, high end can hit 8,000+



#5296604 Batching draws - keeping buffers up to date

Posted by on 15 June 2016 - 04:11 AM

I really like this question (or set of questions) as it presents a large number of the issues developers in your position face.

From my experience if you are already on the right track, you identified a large bottleneck and improved it.


What you need to avoid it trying to catch/handle every situation in the most efficient way - this can often end up worse! I recommend an approach that doesn't try to solve all of the issues but just the main ones. Often enough the performance of such a solution is plenty good enough for most applications.


If you are optimising your engine for this game and this game alone things might be different, but suppose you want to use the engine for a future game one that has more transparent objects, or transparent objects completely mixed in with opaque ones all over the place? Then a seemingly good solution might end up being a bad one.


In terms of over complexity avoiding you could start with very simple dirty flags for things like children changed or not, rather that trying to work out which exact child was removed or added it might be easier just to know IF one was added or removed and respond accordingly, hope that makes some kind of sense.


You will have to make those calls though based on your needs.


That said some kind of double buffer might work for handling changes (or lack thereof) well i.e. for each frame swap buffers and copy large chunks from the last one where possible when no changes occur otherwise just write in the new data.

Just remember that blasting through more linear data can often be faster than jumping around all over the place trying to avoid unnecessary work due to cache misses anyway.


Look forward to seeing other replies in here :)


#5292247 Starfield with 3D points: ideas on how to create light effect around the star...

Posted by on 18 May 2016 - 04:46 AM

Some kind of bloom effect would probably help get nearer what you want.

I think if you did that coupled with a fractal noise you could be well on the way.


So use a down-sampled version of the image to blur it based on light intensity, then overlay that onto the original image. I would also use that blur texture as a alpha map for some kind of noise (such as fractal) to get that "cloudy" look. Depending on how you built the initial image you may need to think about how a noise texture might swim as the camera moves and you will need to fix that, i.e. maybe sample a cube map there, just guessing at this point :D

#5275908 instancing with multiple meshes

Posted by on 16 February 2016 - 07:56 AM

You can do all the VS-based custom vertex pulling trickery on the D3D9/GL2 APIs, by storing your vertex data in a floating point texture instead of a buffer ;)

Before you bother though, first make sure that you actually do need to dramatically optimise your CPU-side GL/D3D time per frame.


Ahh sneaky, and just move texture lookup locations to point to the correct "mesh".

I doubt it will make it into any sort of production, but I like to find alternatives and put them though their paces, better the devil you know ey

#5275898 instancing with multiple meshes

Posted by on 16 February 2016 - 05:38 AM

Thanks guys! Looks like it was as expected, possible - but requiring modern apis. Which is a shame as I am limited to older ones but at least I was along the right track :-D


Will experiment with passing in ids in a buffer and degenerating triangles. I have a feeling it might still be a faster approach than the additional draw calls.

#5234882 Game Development Help Please (language choice)

Posted by on 15 June 2015 - 07:42 AM

HTML5 etc....
But for some insane reason they built the game you linked to in flash - very odd considering you can do all that with js, css and html no probs.

Someone should probably let the devs know they made a mistake!


In all seriousness though; while web technologies allow you to create games like that, there are still a host of reasons you might not want to use them and would be better of with something else.


If the web is your target then html might well be the way to go, if is isn't then don't limit yourself by choosing it.

#5233112 AS3 platformer, making a TileMap scroll.

Posted by on 06 June 2015 - 04:28 AM

@Wyrframe, massive points to you for the big effort you are putting in helping out on this one. Folks like you are what make communities like this what they are!

Forums were a big help with my learning many many moons ago so I think it is so important to keep up the tradition of helping people when you can!

#5229810 Virtual Multiple Viewports with Render to Texture (CryEngine 3)

Posted by on 19 May 2015 - 07:38 AM

I have not used cryengine 3 but I can't imagine that they don't support render to texture - if they don't that is a real shame, because it makes your task a great deal harder... can't even think how you would do it without it.

#5229781 Communication between objects and systems in Game engines.

Posted by on 19 May 2015 - 03:39 AM

you could just create something that manages that task separately, like a player collision manager.

that gets access to the player and the scene and takes care of all the logic it needs inside of its own update function.


This way the player stays cleaner as does the engine code.

Plus it gets easier to maintain, say if you wanted to change from a raycast to an ellipsoid collision detection.

It doesn't work for every situation but it keeps things tidy and easy to tweak.
If you only need something really simple you could just do a single raycast and player update in the main update function, should only be a few lines of code.. but then that approach can get messy quickly as things get more complex.


All that said there are many many ways to skin a cat :)

#5219283 Skeletal animation issues

Posted by on 26 March 2015 - 05:21 AM

I am working on something similar at the moment and what I did was to render things on on the cpu as an overlay showing the positions of each of the transformed nodes to ensure they all line up properly visually.


It is pretty easy to do and very useful for debugging, essential you draw a line from each transform to it's parent if it has one, that way you can start to isolate where the issue is as with skinning there are many points of failure, from the shaders to the interpolation to the correct hierarchies.


Also for testing I made a simple 3 bone test shape and also exported the bone geometry - so much easier to debug when you are dealing with a simple 3 bone 2 parent system :D


Best of luck!!

#5218528 Programmatic Pixel Art

Posted by on 23 March 2015 - 11:53 AM

Sure it would work, and you could indeed build something like that for fun.

But when you want to add colour, and have larger images it is going to be severely limiting.

Drawing images will always be so much faster with image editing software than editing text... and if  you wrote a converter (image->text) well then it is self defeating as the image will generally compress much smaller/faster and be faster to decode.

If you used a raw array of data then you could just use a memcopy to create an image, and that would be fast - but might not worth the effort to geneate the code anyway in the first place, as it would no doubt take up more space.


That said... I have done this exact kinda thing before in a tiny console utility, I cached the bitmap data for the characters 0-9 in 10 unsigned integers in an array.
the first 24 bits described the character's shape (4x6 grid) and then the other bits can be used to store metadata such as the characters width in pixels.


This enabled me to blit numbers to a bitmap very quickly with very little data - just 1 uint to describe the pixels of a character :D

#5216813 Best Language to Program a Facebook game in?

Posted by on 16 March 2015 - 03:58 AM

Erm I have no idea why everyone thinks flash is dead  or slow here, it works fine on desktops and will work fine on devices too if you want (just export with same code using air).


For quite some time flash has been the go to tech for facebook games - this is not without reason.

It also supports vector graphics and has better 3d support through stage3d than html does at the moment.


"There is literally nothing that Flash can do that HTML5 cannot" well not quite literally rolleyes.gif 

Animated optimized vector graphics, compressed source, compiled source (not so easy for someone to just change your in game values), compressed pngs, easy use of fonts, anti aliasing, smoothing bitmaps, blend modes, code hinting, solid performance analysis tools, 1 click deploy to web, android or ios without any extras needed, sub pixel positioning, DRM support, fullscreen support that doesn't crash all the time, easy binary manipulation, works in very old browsers (no need to write your own array.indexOf implementation...), same across browsers, rapid prototyping using flash ide.... am sure there are more too.


Not to mention you can avoid js - always a bonus.


Performance with flash is not a problem for any decent developer. No browser is going to outright stop supporting flash anytime soon either.

Even if you build it in flash first, then port it down the line if you have to that might be a better idea, as you will have a working game build faster already.


Just to clarify, I write games in flash, js and unity - and when it comes to facebook games like the op wants- flash is the better/faster option.

#5214495 Bitmap graphics pixels scanning

Posted by on 04 March 2015 - 09:23 AM

Ah it was more for an example of the result not really the implementation, there is much more going on there than you need to be interested in.

Take a look here:


or here:


and choose the convolution filter and plug in the numbers from the first link

or here for some code in js you can easily port to java: