OpenTTD | OpenTTD is an open source simulation game based upon Transport Tycoon Deluxe | Game Engine library
kandi X-RAY | OpenTTD Summary
kandi X-RAY | OpenTTD Summary
OpenTTD is a transport simulation game based upon the popular game Transport Tycoon Deluxe, written by Chris Sawyer. It attempts to mimic the original game as closely as possible while extending it with new features. OpenTTD is licensed under the GNU General Public License version 2.0, but includes some 3rd party software under different licenses. See the section "Licensing" below for details.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of OpenTTD
OpenTTD Key Features
OpenTTD Examples and Code Snippets
Community Discussions
Trending Discussions on OpenTTD
QUESTION
For the last few weeks, I've been trying to develop an isometric, tile-based tycoon-style crafting game in my spare time (and really only to see if I am capable) and I have run up against a design challenge that I am struggling with. I have successfully implemented ground tiles and drawing them, et cetera, using a Tile class (held inside a Map class), but I would like to now be able to add objects on top of tiles.
I have been able to create and render objects (like a table) using a fairly clunky debug class, contained within the Map class as a std::map
and giving Objects X/Y coordinates so the Map can render them in the right places. All of this, while maybe not being the best approach, works, until I try to subclass Objects to give them different functionality.
I had (wrongly) assumed that I would be able to have some sort of heterogenous container for all objects on the map, which I could loop through and run object-type-specific logic during the game loop. I haven't fully scoped out the game yet, so at the moment I was just giving different objects different member variables - such as a container object that has a capacity, a heater object that has an energy rating, and so on. My first test was going to be to be able to place items on the map and then be able to query the sum of, say, all of the capacities of the container objects - just to make sure it works before moving on to the next step.
I've been trying to use open source projects like OpenTTD and some of the Habbo Hotel emulators to figure all of this out, but to no avail. I'd love to hear what others would think the best way to approach this problem would be.
I've experimented with dynamic_cast
ing and using pointers in my map, but from other answers I've seen, this doesn't seem to be a particularly good way to do it. Should I be creating a pool of objects of the same type and then iterating over each pool during the game loop to keep things more simple?
ANSWER
Answered 2019-Aug-13 at 20:44std::map>
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install OpenTTD
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page