Jump to content

  • Log In with Google      Sign In   
  • Create Account

C0lumbo

Member Since 02 Nov 2012
Offline Last Active Yesterday, 03:51 PM

#5231805 Help with opengl diffuse shader

Posted by C0lumbo on 29 May 2015 - 10:38 PM

The reason it comes out transparent is because of the last line:

 

gl_FragColor = (diffuse * texture2D(u_Texture, v_TexCoordinate));

 

You're multiplying the RGBA you get from texture2D by the diffuse scalar you've calculated. You only want to multiply the RGB. Try:

 

gl_FragColor = (vec4(diffuse, diffuse, diffuse, 1.0) * texture2D(u_Texture, v_TexCoordinate));




#5230567 Imposter Transitioning to Mesh

Posted by C0lumbo on 23 May 2015 - 08:10 AM

Have you tried just manipulating the world matrix of the 3D mesh version of the tree?

 

You should be able to quantise down the rotation of the tree to match the same orientation that the imposter was using, and you manipulate the scale of the matrix to flatten it as well.

 

The other alternative might be to do some sort of fragment discard based transition effect which is often more subtle than simple 'popping'. It's mentioned (but not detailed) in this paper: http://www.cs.ucsb.edu/~holl/pubs/Candussi-2005-EG.pdf

 

"To avoid the popping effect while going from one LOD to the other, we implemented a smooth fade-in/fade-out transition for billboards. The fade effect is done with alpha test; when fading out, the number of rendered pixels is smoothly reduced, when fading in, it is smoothly increased. This is done by assigning random alpha values for the billboard texture pixels and then varying the alpha comparison value for the alpha test."




#5230447 degenerate triangles

Posted by C0lumbo on 22 May 2015 - 12:22 PM

Use indices. Obviously the proper answer is to profile, but the performance difference is probably marginal enough that it's hard to measure, so just use indices because it makes sense.

 

By using indices you are sending less data through (an index is smaller than a vertex), but more importantly by using an indexed draw you are allowing the GPU to use an optimisation called a post-transform cache. Basically, the quad (012, 213) involves 6 vertices, but the GPU can realise that it can reuse the previous vertex shader output for the second instance of vertices 1 and 2, skipping some work. GPUs don't use a post-transform cache for non-indexed rendering because it'd be too much work to check which vertices are duplicates of earlier ones.

 

There's a trickier question of whether or not you should use indices as a triangle strip with degenerates (0, 1, 2, 3, 3, 4, 4, 5, 6, 7, 7, etc) or a triangle list (0, 1, 2, 2, 1, 3, 4, 5, 6, 6, 5, 7). It probably makes little difference but I'd choose the latter because there is at least some archaic console hardware that performed particularly badly with degenerates.

 

Note that rendering a big load of quads is quite common, sometimes it's handy just to make one giant array of indices exactly for that purpose and share it across your 2D system, your particle system, etc.




#5229282 How does Clash of Clans (mobile) keep track of timing?

Posted by C0lumbo on 16 May 2015 - 02:26 AM

There are standard functions for getting the time from a device (e.g. http://www.cplusplus.com/reference/ctime/time/). iOS, WP8 and Android also have additional functions for getting the device time.

 

Most computers, (phones included) will have their own clock that continues to run independently of whether the device is switched on or off, in desktop computers the clocks use a separate battery. No idea what phones do, tbh, not sure if they'd use up precious space to add an extra battery just for a clock, perhaps they just use the main battery, and if you ever fully drained the battery (hard because phones turn off when there's still a few percent left) the local time would become wrong.

 

In games with timers, there's always the risk of exploits by users manipulating the device's clock and the solution is usually to use both local time (for better user experience) and server time (for cheat prevention). When online, CoC probably uses the server time, when offline it probably trusts the local time.

 

However, I imagine if someone tries to manipulate the local time to make building faster then the next time you go online and the CoC server time is available the game will have code to detect that and it will take corrective measures (e.g. maybe it'll take back the stuff you gained using the exploit).




#5228904 Architecture copyright

Posted by C0lumbo on 13 May 2015 - 11:53 PM

Here's a case from a few years back that made the news in the UK. The church that was allegedly copied seemed to not have a copyright infringement case in this particular instance:

 

http://news.bbc.co.uk/1/hi/england/manchester/6736809.stm

http://en.wikipedia.org/wiki/Controversy_over_the_use_of_Manchester_Cathedral_in_Resistance:_Fall_of_Man#cite_note-12

 

Hope your game is not violent!




#5226001 So, what happened to god games ?

Posted by C0lumbo on 28 April 2015 - 12:18 AM

Yes, I think it's a real shame.

 

Personally, I got turned off by the fact that as god games became more complex, I seemed to spend more and more time doing really boring micromanagement tasks.

 

Black and White in particular had the odd situation where I was playing as a super powerful god, but I seemed to spend all my time being a child minder to stupid minions. Now Godus combines similar tedious micro management with farmville-esque clicking-on-stuff-to-collect-it.

 

So I ended up making a god game which focuses on global war and destructive acts-of-god because I think the key thing about god games is the wielding of power, not worrying about minutiae.




#5225703 Small indie question

Posted by C0lumbo on 26 April 2015 - 02:32 PM

Why worry about $200, the amount of time you've invested in getting your game this far is worth much more than $200.

 

Will you make the $200 back? Not sure, the game looks pretty enough to, but plenty of games don't make anything and there's a very good chance your game will be the same.

Will it be worth it from a learning point of view? Yes, go for it! Plus, it's a big personal achievement and it's quite a buzz releasing your own game on the app store, even if you do lose money on it.




#5224515 Did I Work On This Game?

Posted by C0lumbo on 20 April 2015 - 10:56 AM

Hopefully you'll have a couple of proper titles on your CV by the time you look for a new job, and this can sit as a single bullet point in an 'Other TItles' section.

 

Just don't exaggerate it on your CV, the chances are reasonable that the guy who will interview you will know someone who was on that game team for the entire project, and you really don't want to be caught out in a lie.




#5218539 Particle Z Fighting

Posted by C0lumbo on 23 March 2015 - 12:41 PM

Sounds like you have a situation where the render order is changing frequently.

 

Is there any way you can switch to a render mode where the order doesn't matter, e.g. additive blend. Or multisampling with alpha to coverage?

 

Otherwise, sounds like you need to sort them, or at least get to a point where the sorting isn't changing often enough to be noticable




#5217131 Best language for standalone RTS game?

Posted by C0lumbo on 17 March 2015 - 01:47 PM

From your description, I'd say that for you, using javascript in Unity would be your most productive choice. C# in Unity would be a good choice if you're looking more toward longer term goals of increasing your skillset.




#5213486 "Reverse" frustum culling?

Posted by C0lumbo on 28 February 2015 - 07:47 AM

I think your problem is identical to voxelising the frustum shape, so perhaps you could direct your google searches in that direction.

 

It's not something I know anything about really. Maybe picking a point that you know is inside the frustum and then flood-filling the voxel grid would be an OK approach (I'm sure it's far from optimal though!).




#5212235 How do game engineers pack their data?

Posted by C0lumbo on 22 February 2015 - 03:36 AM

This is a nice article on prepping data offline ready for efficient loading: http://www.gamasutra.com/view/feature/132376/delicious_data_baking.php?page=1

 

Another thing to think about is whether you want to use a 'push' or a 'pull' approach to loading resources.

 

The pull approach is perhaps more natural, you have a bunch of resources set out into a logical (to a human) folder structure (possibly in some sort of zip-esque archive format), then your game code requests the assets it needs in some arbitrary order and they get loaded. Sometimes when you're loading a model, it might contain dependencies on some texture or sound, so you fire off loads for them too.

 

The problem with the pull approach is that you're seeking all over the place. Which is fine for solid state storage (SSD, cartridges, mobile) is OK for hard disk drives, but is a total nightmare for DVD/Blu-Ray, etc, as the seek costs can be huge.

 

The push model is an approach where you create a single file for a collection of stuff that will get loaded together. So if your game is level based and non-streaming, your tools might construct a single level file containing all the appropriate models, sounds and textures. The game code will request to load the level file, and the load process will push each of the resources it comes across into the right subsystem.

 

I guess with the current crop of platforms, and the fact that games stream so much dynamically, the push vs pull choice is less important, and it's always possible to make the pull model work OK by carefully laying out resources on the storage media, but I think the push approach is the better one if you're planning out a system from scratch.




#5212110 Non axis aligned collision detection

Posted by C0lumbo on 21 February 2015 - 08:54 AM

Generally, the fastest collision algorithms are for simple geometric shapes (spheres, ellipses, orientated bounding boxes, capsules, cylinders, etc), if you really need arbitrary geometry, then it's a lot faster to implement collision for convex hulls, finally and slowest, if necessary you might need to collide against polygon soup.

 

So, your question is pretty broad. You need to work out what you can get away with for your use case. You might conclude that your characters are well represented by capsules and your environment is a polygon soup, then you'll need some sort of hierarchical representation of your environment to collect relevant triangles, and you'd need to google triangle vs capsule collision detection to find out how that's done.

 

This is an excellent book that I'd thoroughly recommend: http://realtimecollisiondetection.net/books/rtcd/

 

But if you're just looking for a quick plug-in solution, then you need to at least work out what shapes you're going to collide.




#5211373 Hiding savedata to prevent save backup

Posted by C0lumbo on 18 February 2015 - 02:16 AM

I totally get where the OP is coming from. I've played FTL on PC and cheated occasionally to backup saves. Now I'm playing on iOS where it's harder to cheat - it's still totally possible, but there's enough friction in the way of cheating that I don't bother. The game is a very different experience because the stakes are much higher when permadeath can't be circumvented.

 

IMO, your option #3 is the best. By having a save file and a corresponding registry entry (with a timestamp or hash or something), it's still easy for someone to cheat/transfer the progress, but I think the extra step of having to modify the registry adds just enough friction to the cheating process that I think that large numbers of people wouldn't bother.




#5206741 Interesting implementation employees?

Posted by C0lumbo on 26 January 2015 - 01:56 PM

In a theme park management game (might have been 'Theme Park') there was a negotiation mini-game for agreeing wages/supplier prices where you gradually reach out to shake each others hands. Give too much and you pay over the odds, give too little and the deal breaks down entirely.

 

You could include something similar for your hiring process perhaps.

 

PS - It was Theme Park. See the 2nd screenshot on this page (or maybe it's the 4th screenshot really given it's from the DS): http://www.gamingsteve.com/blab/index.php?topic=7952.0)






PARTNERS