-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit feature requirements #70
Comments
I'm noticing that several different types of units need the destroy themselves when health == 0, would it be possible to put the "destroy self when health == 0" code in the unit class or are there some units that this doesn't fit for? |
This behavior would apply to most units, so it's certainly okay to make it a general rule. The few exceptions could be still overridden in their own subclass. On the other hand though it could be neat to assign the health property only to specific unit classes which can be attacked and then check on the existence of Both approaches seem fine to me. |
I have a fork where I added a health property to the unit class and also added a function to be used later to check and destroy the unit if it's health is reduced to zero when it takes damage. Would this be enough for a pull request? |
Make a pull request and I will look over it. |
I'm looking at implementing marking the occupied tiles, I'd just like to ask some questions. How would you like me to visually mark them? Could I look into some kind of modulate to make the tile temporarily lighter in color for example? Also, for some of the other requirements for the unit it seems like you would want me to store something about the unit occupying that cell so that it can be accessed and pushed later if another unit tried to gain access to that tile. I was just wondering if you had any thoughts about how you would want me to implement that. |
Modulate would be sufficient for now. The how-to is still pretty much open, so you're free to provide a possible approach and I'll happily check it out to see where to go from there and identify potential drawbacks. Speaking of the tiles, it would be useful to have a set of debugging tools set up for visualizing the gridmap with all cells and the current state on each of them and the path all ships are following when moving. |
While I was testing some things out, I ran into some issues. I was trying to find a way to change a Mesh at a cell index but couldn't find one. I then tried out this code, but it seems that the water tiles aren't valid in the world_to_map()? This code is called whenever a unit's move_vector changes, and it does change tiles, but only tiles on land, not the tiles under the actual ship I'm moving around(the ship in the WorldTown map). `
|
Requirements for each unit type to reach feature completeness. Each check box can be seen as a single task. Some tasks are compounds of a more comprehensive logic and may depend on each other. The descriptions contain pseudo code to give an idea on possibly relevant data to be implemented code-wise.
If a task involves interaction with another unit, the kind or subset of units is explicitly specified in there. In case it is not obvious, see the definition part below.
Balancing aspects like explicit values for ranges etc. are deliberately omitted to keep focus on the actual mechanics.
Definition:
Feel free to share your thoughts and add suggestions or point out edge cases to be taken into account.
Unit behavior to be implemented
General behavior for all units
occupied_tiles
= prevent units overlapping with each other.Player-controlled land units
Land merchant
health == 0
.User actions
warehouse_in_range
.Melee unit
Ranged unit
Player-controlled ships
Huker (transport ship)
defensive
|offensive
. Defensive = Hold position when attacked. Offensive = Chase opponent to a certain extent and return to original position.health == 0
.User actions
warehouse_in_range
.cooldown
timeout whenhostile_target.is_in_range()
, make the target (Ship
|LandUnit
|Building
) take damage.Frigate (military ship)
Currently identical to Huker. The main differences lie in the values for
storage_slots
/storage_capacity
andamount_of_cannons
, which are not discussed here.defensive
|offensive
. Defensive = Hold position when attacked. Offensive = Chase opponent to a certain extent and return to original position.health == 0
.User actions
warehouse_in_range
.cooldown
timeout whenhostile_target.is_in_range()
, make the target (Ship
|LandUnit
|Building
) take damage.Player NPC ships
Fisher
required_steps
and start fishing, increase resource +1 perinterval
timeout until max ofstorage_capacity
has reached.hostile_unit.is_in_range()
.current_storage
so far.owner
(fisher building) regarding the reason of return (storage_full
,in_danger
, ...).owner
(fisher building) gets destroyed, destroy itself as well.Neutral NPC ships
Free Trader
trade_posts
from the closest to farthest warehouse and start a new trading journey to sail for those harbours until everyone has been visited and the journey ends. New warehouses built in the midst of a running session will be added in the next run.trade_posts
.trade_posts
contains another element, rinse and repeat.interval
of "being abroad", return to the map at a random edge tile and create a new trading journey as described above.Hostile NPC ships
Pirate
hostile
|neutral
, ranging from0.0
-2.0
.hostile_unit.is_in_range()
waypoints
, randomly created within a subset of the entire GridMap. The subset consists of all GridMap tiles with an appropriate distance to civilized area (settled islands and player territory in general). That said, the more the player expands, the farther the pirate has to retreat to stay in "calm waters".hotspots
. Those spots are determined based on where general ship movement has been most frequent recently. Each tile on the map has aweight_of_interest
which becomes "hotter" the more often it is passed by a ship and "cools down" the longer any activity is absent.hostile_unit.is_in_range()
, attack.minimum_health_threshold
, retreat.health == 0
.The text was updated successfully, but these errors were encountered: