sfml engine thing I'm working on

The Partridge Family were neither partridges nor a family. Discuss.
codei
Posts: 8
Joined: November 2nd, 2017, 9:09 pm

Re: sfml engine thing I'm working on

Post by codei » November 6th, 2017, 2:59 am

chili wrote:Yeah, you will find that stuff at the entity level like that costs a lot less than you might originally thing. This is why I constantly scold people for premature optimization at that level. It often just isn't worth it, and it's better to write clean, scalable, idiomatic code at that that level, and save the optimized hacks for just the few portions where it really matters.
I've optimized it further just because It's fun to do. I've now made all the sprites in spriteanim shared and managed by texturemanager. Only using 10mb of memory.

Also, I will be adding NPC logic to the code (random walk patterns :P), so that will reduce the performance by a lot if there are tons of entities on screen.

I get where you are coming from, though. Micro-optimizing isn't always the best, and I really should be polishing last in most cases.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: sfml engine thing I'm working on

Post by chili » November 6th, 2017, 3:03 am

Yeah, if you're not worried about ROI, then optimizing for fun can *sometimes* be harmless fun.

However, if the optimized code has made any compromises wrt clarity, maintainability, robustness, scalability, etc., then you're likely doing more harm than good.

It all depends on the nature of the optimization.
Chili

codei
Posts: 8
Joined: November 2nd, 2017, 9:09 pm

Re: sfml engine thing I'm working on

Post by codei » November 15th, 2017, 5:18 am

Hi everyone! I haven't posted an update in a while but here are some of the things I've added since then.

Notable features:
- Tile selection based on mouse coordinates (even works correctly when zoomed in!) Right now all it's used for is spawning entities at that tile, but this will be used for tile editing in the future once I implement a proper map system instead of just a plain grid. :P
- More code optimizations/function reordering
- A (almost complete) menu system with animations! Menus can be in 4 positions on the screen right now: top, bottom, left, and right.
- Buttons that can be clicked! (obviously) I plan to add arrow key support soon.

Please give me any feedback, it is much appreciated! :D

Post Reply