I'm writing a game with a SDL, OpenGL, a physics engine and an embedded scripting language.
The thing I have been doing in the last weeks: Abstracting. I have written abstraction classes representing the program itself, textures, fonts, physics objects, and more.
- Am I abstracting too much, or how can I know if I am?
- Is this good practice at all to abstract all libraries first before getting into the actual developme开发者_StackOverflow社区nt?
Take a look here: how much abstraction is too much?
Basically you need to do some sort of cost-benefit analysis. If you can easily understand the abstraction and it makes tangible benefits to your game, then go for it. If it starts to make things unnecessarily complicated and it makes it hard to understand what it being abstracted, then its probably not worth it. There's a point of diminishing returns, but finding it and justifying whether another layer of indirection is a good idea or not is a difficult art.
Is this good practice at all to abstract all libraries first before getting into the actual development?
If you are the only developer then its going to revolve largely around your personal preference. If you are familiar with the library and can tell what's going on easily, then you're fine. If others are involved, then it depends on how easy your abstraction is to use and if learning it better than using the actual library without any addition layers.
Since your goal is to create a game, then I would recommend you to get rid of all layers of abstraction you have created so far. Use whatever libraries you have directly.
Spend all your time on getting stuff moving on the screen so that you can try out your game ideas and designs as quickly as possible. Having extra layers of abstraction will slow down this process.
When you have reached some part goal, then spend a fixed amount of time to clean up the code. This is where you add abstractions to solve your concrete problems. But don't overdo it.
Then continue creating your game. In the end abstractions will have very little to do with how fun or addicting the game is.
精彩评论