TeamPorcupine / ProjectPorcupine

Project Porcupine: A Base-Building Game...in Space!
GNU General Public License v3.0
484 stars 279 forks source link

Effects (fire, fog, etc..) #1487

Open bjubes opened 7 years ago

bjubes commented 7 years ago

Currently there is no system to add what i'm temporarily calling "effects" into the game, such as fire #1462 which is like a furniture in the sense that it occupies a tile, but also coexists within the same tile as an existing furniture. As a result fire is hard to implement, because it is not a furniture despite having many similar qualities.

I propose that we add a separate class for objects of this nature which either inherits from furniture or is very similar, but has a separate property in tile where it exists so a piece of furniture and a fire can exist in the same tile.

Here is a quote on the issue from @TomMalbran

I think that it makes no sense to add [fire] as a furniture. We can make a PR that is not as big that just adds a new type of "Buildable" called Effect or something like that, and the Fire implementation. The Effect class can start as a copy of Furniture or Utility were we remove everything that is not needed for effects, a manager that can be a copy of the UtilityManager, and a reference in tiles.

We can later add another PR that can deal better with fire and other effects, if that is required.

At some point we can grab the buildables, and maybe their managers and think about using subclassing.

Please give feedback on what you think is the best implementation for "effects", good names for "effects" or anything else before this is implemented

koosemose commented 7 years ago

What other things might fall under this category?

If it's just bad things like fire (maybe noxious gas [though perhaps that would be handled as gas in a room?] or a plasma field) then Hazard might make a reasonable name. Or would it include things like... I don't know, a puddle of water (which I suppose could be argued as a very low grade hazard).

Should multiple Effects (or Hazards if you choose that route) be allowed in the same tile (could you have a fire and a plasma field in the same tile?) if so, then you may want to look at Utilities, it uses a similar base to furniture but allows multiple different types in the same tile.

bjubes commented 7 years ago

Yes I think mulitple hazard/effects for tile should be allowed, and yes I feel that water spills would be included in this category so hazard might not be the best name, although more descrpitive than effect

TomMalbran commented 7 years ago

I have no idea what to call them, and I am not sure what will be included in it, and what would make sense to add in this class vs another one. For now we have fire. Maybe we could even use this class to add a fog of war for mining, or maybe it could be another class? We could figure a better name once we get to know better what could be added to this class. For now something generic will work and we can split it when we realize that it wont work for all.

koosemose commented 7 years ago

Maybe something like Naturals, since it seems fairly consistent that it seems to be things that specifically aren't built. Though I think, in general, Tom is right that as long as we get some name, we can always change it later... though what the name is to start with may affect what people choose to use to implement in it.

@TomMalbran And as far as fog of war goes, I think that would probably be best done as a system completely separate from the per tile sorts of things like furniture... maybe have it basically as an overlay (separate from the overlay system, at least somewhat, since we presumably don't want it easily toggled off (perhaps with a dev mode cheat)), generally something that's just going to be a single image/gameobject.

mikejbrown commented 7 years ago

From a more mechanical perspective: TileModifier, TileState, TileStatus, TileEffect, ... From a more descriptive perspective: Environment, EnvironmentModifier, ... From a cutesy short names are always better perspective: Effect, Stuff, Goop, Miasma, ...

koosemose commented 7 years ago

oooh Environment is pretty good (or if one is feeling wordsy, EnvironmentalEffect).

TomMalbran commented 7 years ago

I really don't like the Tile prefix in the name. We will be changing TileType soon. I also don't like the suffix, since it could be either a visual, a modifier or something else.

For now I think that this will be "things" that will mainly be causes of game events, or caused by some action of a character. They will not be allowed to be built (In dev mod we could spawn them) or set for destruction (they will get removed and destroyed by some other type of action/effect).

For now Environment or Natural may work.

Fog of War, could be a layer, but i think that it can slo work as a simple Effect per tile, since I am only thinking at the one for mining (similar to RimWorld) and not one for the map. It could work for an initial simple implementation. If it doesn't, we can add another system. Eventually we can create single images to collapse multiple game objects for certain types of Furnitures and Environments.

GamerGeeked commented 7 years ago

@TomMalbran That's not a suffix --- Thaat's a prefix

TomMalbran commented 7 years ago

@ComputerOverlord I know. I was thinking of prefix, but wrote suffix thinking on the next things I was going to write.

f-montanari commented 7 years ago

I'm up for Environment :+1:

As for the Implementation, I think that a separate class would be ideal, along with adding an extra layer for some special effects...

dusho commented 7 years ago

I'm not sure with Environment.. under environment I imagine some grand things around you. EnviromentalEffect does sound good and fitting, but is a bit too long, I guess. What about Phenomenon ? Does sound weird and spells strange, but thank god for code completion. I imagine these effects will spread in similar way as gases in Room.. So I think refactor Room to have instances inside like Atmospheres, Temperatures and then EnviromentalEffects (Phenomenons?) with their functionalities. And then of course some some another overlay display layer that would render all things from all tiles.

koosemose commented 7 years ago

I really don't think per-room is the proper way to track this, with our current use-case of fire, you're not going to have an entire room be on fire, may end up with walls on fire (which aren't part of any room... until they burn down)

dusho commented 7 years ago

was thinking about Room.cs because room knows its atmospheres, and O2 percentage will impact fire spread. I think in future, there will need to be some room-to-room reference and maybe even wall information. Or it can be level above (some portion of RoomManager)

koosemose commented 7 years ago

In the case of fire needing oxygen, it's more akin to the GasConnection component on furniture, though perhaps slightly more complex (in that it would need to check gas for adjacent tiles in the case of non-room tiles such as those containing walls