# Engines - What to keep fixed and what not to

This topic is 1987 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys,

developers love to give the user the freedom they want, but sometimes, too much freedom is quite bad, as some things are just too complicated, or just not practical, or might mess stuff up if done wrong.

One example of this was where I had to decide whether to use fixed functions for normal mapping, or leave that to the user to do while editing their custom material. But normal mapping isn't just something that's done within a seconds (copy... paste...  ), so I decided to make it fixed, like: (And it's used so much, and if you mess it up, features like, ssao, lighting, just doesn't work!)

// Enable Normal Mapping
myMaterial->SetFlag(MAT_FLAG_NORMALS);

// Set the texture
myMaterial->SetNormalMap(myTexture);


So...

Is leaving the normal mapping to a fixed function the way to go, or not? What experiences do you have where you needed to decide whether making a feature fixed, or leave it to the user?

Thanks!

PS. I don't know if this is too specific, if so, please say!

##### Share on other sites

I would like to hear opinions on this subject as well. I personally think that it is completely up to you to decide. Some kind of "design" decision. But it is really hard to decide when you should really stop making things flexible.

##### Share on other sites

My take on this is to make the system as flexible as possible, and then if there are 'norms' that you want to include in the engine then you just implement them for the user in the flexible system.  This serves multiple purposes - they provide functionality out of the box, they serve as examples for others to use, and they force you to use your own system to implement something that you could reasonably expect your users to be able to do.  Sometimes that experience can be eye opening, and it will help you improve the usability of your engine.

By maximizing flexibility, this also lets you update things over time without breaking your whole engine.  Encapsulate your rendering code into logical chunks that are easily interchanged and supported by the structure of your engine, and you will be much happier in the long run.  Especially if you are the sole maintainer of the project, this will really be useful if you work on the engine for a long time (like I have with Hieroglyph 3!).

##### Share on other sites

From the example you gave, I would say you don't need the SetFlag( MAT_FLAG_NORMALS ) call. The fact someone calls the SetNormalMap should be enough for the lower level API to realise they want normals which reduces it to a single call and reduces the chance of someone making a mistake.

I actually think this should all be completely hidden at the high level, so no code outside the core renderer has an API like that at all. But I guess that's not really the direction your engine has taken and requires tool support. Consider for example, the high level code states 'I have a mesh that I render' and the game engine gives it a mesh along with the material. Suddenly the high level code can now render anything the designer wants it to with no code change. Anyway, that's a long discussion and a bit of a tangent so I will leave it as perhaps thought for the future.

n!

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 11
• 9
• 38
• 16
• ### Forum Statistics

• Total Topics
634128
• Total Posts
3015692
×