Timeline for Given a base class and many derived classes with additional features, what's the best practice for accessing those features?
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 30, 2021 at 6:42 | answer | added | Vorac | timeline score: 0 | |
| Mar 25, 2021 at 21:00 | history | tweeted | twitter.com/StackGameDev/status/1375190787508613130 | ||
| Mar 24, 2021 at 15:45 | answer | added | Casey | timeline score: 1 | |
| Mar 24, 2021 at 15:36 | comment | added | Vaillancourt♦ |
The best practice is the one that works for your own specific situation. As highlighted by DMGregory, it seems you're doing some kind of "premature optimization". Do you have thousands of objects of a few hundreds? How long does it take to simulate the physics, render the scene? The time taken to updating your objects may be insignificant compared to other tasks, so whether you dynamic_cast or shove a type property to your Animal class may be completely irrelevant right now and not that useful when trying to address actual issues.
|
|
| Mar 24, 2021 at 15:08 | comment | added | DMGregory♦ | That sounds like a Code Review question then, if you can exhibit a specific implementation. On GDSE, I generally find questions asking about future problems that could occur don't get very definitive answers. We've got a better track record for solving specific problems you can exhibit. So my usual advice is to try a prototype of your idea, and see if any problems arise for your game's particular use cases. If not, you're golden, even if another solution might be "better" for someone else. | |
| Mar 24, 2021 at 14:15 | comment | added | Tminator | Especially the "good practice" part. A lot of things that seem "natural" or intuitive at first glance aren't optimal in the long run. (for example blob-classes etc.) So I want to know if that approach/way of thinking may be a red flag for more experienced people and why. Or in that case what a better way to achieve it would be. | |
| Mar 24, 2021 at 13:44 | history | edited | doppelgreener | CC BY-SA 4.0 |
copy edit for clarity. poisonous =/= venomous. (venomous = it bites you, you die. poisonous = you bite it, you die.)
|
| Mar 24, 2021 at 13:02 | history | edited | Tminator | CC BY-SA 4.0 |
added 38 characters in body
|
| Mar 24, 2021 at 12:44 | comment | added | DMGregory♦ | It sounds like you have an idea for how you want to handle this situation already. Have you observed a problem with handling it that way? What specific aspect can we help you improve? | |
| Mar 24, 2021 at 12:43 | review | First posts | |||
| Mar 24, 2021 at 15:21 | |||||
| Mar 24, 2021 at 12:39 | history | asked | Tminator | CC BY-SA 4.0 |