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 10 Nov 2006
Online Last Active Today, 06:35 AM

#5132571 Pixel processing question - kill/discard a pixel

Posted by Ashaman73 on 19 February 2014 - 02:37 AM

1. I have a texture with data (some color after clear or some data after previous pass) and I'm processing a pixel which already have some data. If I discard that pixel - what will happen? Will the existing data stay or it will be gone?

A pixel is just a small memory block. It contains some data. A pixel-shader have an input and output and some processing in between. If you discard the pixel in the shader, then the shader output (=pixel) will not be writen to the memory block. That means, the previous pixel content is still there.




2. I have a pixel which will be processed several times in render pass. If first process is successful and in the next one discard will be called - will the data from first draw stay or it will be discarded too? Will the next calls process that pixel or after killing it all subsequent drawings will be killed too?

See above, it will stay.




3. What is the best way to not to change a data in texture. Say, I have some condition - if it's true I'll write new data. If false - I want to keep an old data.

There are several ways and the best way depends on the concrete situation. Eg you can discard it in the shader, you can utilize the z-buffer, alpha mask or stencil mask. All of these methods are really useful, but which to use depends on the effect you want to archive.

#5132302 Double Dispatch errors

Posted by Ashaman73 on 18 February 2014 - 06:08 AM

You forward declare it, but if you want to use it (you access Data.ID), you need to define it first.

So, instead of writing the method 'Process(InstructionAdd& add)' already in the header file, move it to an according cpp file and declare only the method in the header.

#5132243 Useful things you might want to know about FBXSDK

Posted by Ashaman73 on 18 February 2014 - 01:07 AM

This might be quite useful. You should think about posting this as an article (Menu->Articles->Post an Article).
 Good work.

#5131957 RTS unit balance. Armour types?

Posted by Ashaman73 on 17 February 2014 - 02:19 AM

A very basic and common start setup for RTS games is a rock-paper-scissor setup. It has a basic balancing build in and you can expand from there.

Your example could look like this:

heavy armour >> light armour >> flying units >> heavy armour



heavy armour: your standard tank

light armour: some kind of mobile AA

flying units: chopper


From here on you can carefully add more units, all with a certain advantage/disadvantage, like:

- Artillery: can attack long range ground targets, but although weak vs flying units

- fighters: useful vs flying units, worthless vs ground units


But always take care to not make a single unit too powerful or too useless. Some light armour type which is weak vs all kind of units is worthless and nobody would buy them. Eg an infantry seems to be quite weak at first, but if they got the advantage to be quite flexible (anti-tank & anti-air weapons) and can hide in buildings, it would make them really useful.

#5131210 Blender for making Games?

Posted by Ashaman73 on 14 February 2014 - 01:24 AM

I too, use blender exclusivly as modelling tool for my game and I'm quite happy with it.



#5083766 No clue what to call this, any help welcomed

Posted by Ashaman73 on 06 August 2013 - 11:15 PM

There are two ideas coming to mind. A replication method and/or a command queue of single cells modifications. 


The replication method requires the syncronisation of the clients with the server. This will be more or less a must have in your case, e.g. in the case of that a client joins your server or if the client doesn't hold all of the terrain of the server in memory at once. This could be done by checksums of blocks. The client, when connecting to the client, sends all checksums to the server, the server will keep this saved for each client to compare it to the current state of the world around the client. If the server detects an invalid checksum it will starts to send a new block to the client. Just don't expect that all clients are always on sync, this will not happen and is often not necessary. Compare a multiplayer game (especially MMORPGs) with two players on two monitors side by side and you will see what I mean.


The second method (your number 1) helps to sync the replication faster by propagating modifications faster to the clients. Instead of replicating a whole block all the time, you could send only modifications of single cells to the clients as stream (if client is able to see it) and do reactivate the replication mechanism after the modification of a block stopped, in this case the replication by checksums will be reactivated and any error will automatically be corrected.


PS: in general, send the modifcation command to the server and execute it there,instead of modify the state on the client and replicate (merge!) it on the server afterwards.

#5081440 Use a existing game engine? or create it?

Posted by Ashaman73 on 29 July 2013 - 06:43 AM

I've seen Game Maker too and i liked. Can i make serious game with that kind of tools (Game Maker, RPG Maker, Unity...)?


I don't want an "automatic" tool type. I have good programming skills with Java (OO programming) and I like to write code. What languaje Game Maker uses?

When developing a game you have normally three programming categories:

- engine development

- tool development

- content/gamelogic development


Engines are often developed in more traditional languages like C/C++ or even java. Tools are often developed in languages which best suites the task and content is often developed in a scripting language (depends on engine support).


What way to go depends on what goals you are chasing.


1. I want to code a game and sell it:

The effort to develop a game from ground up is absurdly high. Therefor you should use as many tools/engines as possible to decrease the workload. The workload is not immediatly visible at the start, but it will increase exponentially over time.


2. I want to learn making a game:

Still use an existing engine and make a prototype with some placeholder art. If you are not really experienced in (game) development (I would recommend a few years), then you will refactor/throw away a lot of code. It is faster to learn by developing a quick game prototype first, then by maintaining a fragile code base over years.


3. I just want to code, best something to do with games:

In this case write a demo of some topic you are most interested in or a small useful tool (artists are really thankful about free, useful tools). This could be a render demo or a zombie simulation. Take care, that it have a small scope to ensure to finish it in time.

#5081373 Use a existing game engine? or create it?

Posted by Ashaman73 on 29 July 2013 - 01:42 AM

If you want to learn car driving, are you starting to construct your own car first ? Creating a game engine is an interesting and challenging task, but if you really want to create a game, you should start with an existing engine.


Other question : RPG maker is a game engine?

Yes, kind of. It sounds like a very good start for a 2d rpg !

#5080674 How to hide global functions from C files in C++ program?

Posted by Ashaman73 on 26 July 2013 - 01:14 AM

I would put all public declarations into the first header, let's call it CPublicAPI.h and include this header in Cheader.h which although contains the declarations of the internal functions. Therfore
 f -> CPublicAPI.h


g & h -> CHeader.h (which includes CPublicAPI.h)

#5080672 How to hide global functions from C files in C++ program?

Posted by Ashaman73 on 26 July 2013 - 01:08 AM

Just use two different headers, one containing the internal functions and one the public API. Then make only the external API header available.


PS: if you dont want to change a lot of code, do the following:

CPublicAPI.h (contains external declartions):

Cheader.h (internal )
#include "CPublicAPI.h"

#5080385 Terrain Collision and Bounding spheres?u

Posted by Ashaman73 on 25 July 2013 - 03:58 AM

I was just wondering why this may be preferrable to a bounding box or cylinder which could be closer to the size of the player then a sphere

A sphere has the advantage to slide better over small obstacles and steps, whereas a cylinder or box will get stuck more easily. An often used alternative to a pure sphere is a capsule which have the benefit of being a better approximation of a humanoid and still have the sliding advantage of a sphere.


I'm yet to decide between a static mesh, or a heightmap.

In a simplest case a static mesh is more easily done, whereas a heightmap is often converted into a static mesh (sometimes on-the-fly to save some memory). Nevertheless, every modern physics engine, and I recommend to use one (building a physics engine can be extremly frustrating !), can handle tri-meshes and heighmaps.

#5080053 Skeletal Animation Speed?

Posted by Ashaman73 on 24 July 2013 - 01:48 AM

How do skeletal animations fundamentally work? Are their runtimes considerably slower than keyfram animation? I mean, don't the vertex position data have to be "populated"/"generated"/"interpolated" at each render frame?

Yes, they are theoretically slower than vertex interpolation, but you often do the bone interpolation on the CPU (often only ~100 bones) and the vertex interpolation on the GPU (vertex shader). In this case you will have really fast and memory sparse animations.


Therefor, skeletal animations are the way to go in most situation (exceptions might be facial morph animations etc.).

#5079559 Can't delete a pointer that I declared in a constructor

Posted by Ashaman73 on 22 July 2013 - 06:58 AM

But for some reason, just this one entity "Blan" where I creates with "NewEntity()" it pop up a error saying that I can't access this memory when the program reach to the delete section of the code.

Your NewEntity method create the entity on the stack and not on the heap:

Entity testing;
	testing.name = name;

Once your NewEntity methods returns, the testing entity will be gone resulting most likely in a followup error once you try to access/delete it.


The correct way would be something like this:

Entity* testing = new Entity();
    testing->name = name;


I know, that a vector::push_back creates a copy of the data, but this does not prevent you from using pointers as type of the vector. Can you give more information, like the definition of TotalEntity.



It seems that I'm on the wrong track...

#5079094 How do you make an easy level builder?

Posted by Ashaman73 on 20 July 2013 - 12:05 AM

Best to use an existing, free map editor smile.png

e.g. tiled

#5078868 how to do "bvec4 & bvec4" in GLSL?

Posted by Ashaman73 on 19 July 2013 - 01:53 AM

How about using the step function ?


This checks if your testpoint is inside the limit.

vec4 result = step(limitA,testPoint) * step(testPoint,limitB);

This will check, if all 4 axis are inside.

bool is_inside = dot(result,result)==4;

More robust:

bool is_inside = dot(result,result)>3.5;