I somewhat disagree with the approach of writing the engine first and then the game. You end up inventing a lot of features you don't need, while missing several you do need. Trying to extract and generalize components from a working game can be more organic, even if it comes with some refactoring. Plus, it won't leave you working for months on an engine without doing any progress game-wise.
Now how to get to a working game? You're talking about piling up features, which may bring you closer to your goal in terms of visible progress, but it comes at the cost of accumulating technical dept -- the messy code that you yourself don't understand after some time. At the risk of sounding obvious, you need to count in extra time that will be spent just on refactoring and cleaning up -- that is, functionality is kept
exactly the same, but code structure and organization is improved. If you're doing it for the first time, it can be helpful to be strict about this: don't try to add even the slightest game-related feature while doing refactoring; make sure that the playing/running experience is exactly the same.
Refactoring and robust code architecture is a huge topic on its own, and there are libraries full of books about it. Delving into some research would definitely give you a nice overview (there's also a bunch of Internet resources, e.g. about design patterns). Apart from that, you should probably investigate your own code and ask the question "why is it messy?". What are the patterns that make it hard to understand? Once you found that out, look for solutions about these problems, one by one. For example:
- Lots of duplicate code -> reuse code in functions, classes, templates
- Too many dependencies between different parts (e.g. graphics, game logic, input) -> split your application into modules, and limit interfaces between modules to a single class/interface
- Doing a lot of algorithms/data structures/for loops by hand -> check out STL and other C++ libraries
Having said that, there are some extensions to SFML that may make it easier to use certain features without starting from zero. I wrote the library
Thor, which contains particle systems, animations, vector algebra among others. There are other snippets and libraries listed on the
SFML Wiki.