soundmud / soundrts

A real-time strategy audio game
http://jlpo.free.fr/soundrts
Other
44 stars 32 forks source link

Buildings created via the summon effect now behave as expected. #79

Closed ParadoxiKat closed 6 years ago

ParadoxiKat commented 8 years ago

That is, unless it's buildable anywhere, it consumes the meadow or blocks the exit targeted, and can only be summoned to a meadow or exit.

soundmud commented 8 years ago

Summoning buildings, interesting. I haven't tested this feature before. Does it work? I couldn't summon a wall on an exit with a modified a_summon_dragon spell.

ParadoxiKat commented 8 years ago

Yes it does work, though it's obviously incomplete!

It only works when target is supplied, so the ability would need effect_target ask... and the summon_dragons ability doesn't have this.

For cases where a mod designer forgets or chooses to leave out effect_target ask, this needs to be handled more gracefully.

I see two solutions:

  1. spit out some kind of error message, only allow effect summon BUILDING to work if target is ask.
  2. Try to select a free meadow for normal buildings, or unblocked exit for walls/gates. Complain only if there are no free meadows or exits.
soundmud commented 8 years ago

Forgot about "effect_target ask". I'll try again.

ParadoxiKat commented 8 years ago

There we go it should now work as expected for all of the effect_target types.

ParadoxiKat commented 8 years ago

Though as it is now, only the actual building fails, the summon order still executes properly even if you do something silly like try to summon a wall onto a meadow or a castle onto a goldmine. In both cases the building shouldn't actually get created. But the casting unit will still lose the mana, and if a sound were assigned to the ability it would play. Possibly leading a player to think it had worked, when in fact it didn't.

To make the order actually fail as impossible in those cases would be preferable. But I think this would require modifying effect_target to accept targets such as land, exit, or landexit for either.

sanslash332 commented 8 years ago

A question.

IF a building have a time_cost asosiated with it, and you summon it with a spell, the building is instantly builded? Or you have to wait the cost time of the building to it will be builded.

With the soldiers, it are instantly summoned, But… At the time, all summoned units, have a lifetime. ¿Is possible summon units without lifetime?

Respecting the buildings, I ask for the time_cost, for know if is possible with this modification, create a build system like the protoss’s system. All of their buildings are summoned, without the intervention of the peasants. Theyr only start the summon of the building, and the building builds itself until it’s will be done.

Currently you can do it having a base building, and next, all the other buildings for your race are a update for the base building, but. That isn’t the idea :P

Well, that is. Thanks for all :3

From: Kat [mailto:notifications@github.com] Sent: jueves, 26 de mayo de 2016 17:15 To: soundmud/soundrts soundrts@noreply.github.com Subject: Re: [soundmud/soundrts] Buildings created via the summon effect now behave as expected. (#79)

Though as it is now, only the actual building fails, the summon order still executes properly even if you do something silly like try to summon a wall onto a meadow or a castle onto a goldmine. In both cases the building shouldn't actually get created. But the casting unit will still lose the mana, and if a sound were assigned to the ability it would play. Possibly leading a player to think it had worked, when in fact it didn't.

To make the order actually fail as impossible in those cases would be preferable. But I think this would require modifying effect_target to accept targets such as land, exit, or landexit for either.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/soundmud/soundrts/pull/79#issuecomment-221981694

ParadoxiKat commented 8 years ago

Currently the time_cost isn't respected. Building construction sites seem to need workers to complete them into the target building. So a summoned building just appears fully formed. I'm using this ability in my mod to have races like the undeads be able to summon a fog bank that is a gate. It doesn't make any sense for a bunch of workers to go build a fog bank with saws and hammers! But it makes perfect sense for a magic user to summon a fog bank to block an exit. Obviously the summoned fog bank has a life span, it will vanish shortly. But it can be upgraded to a building that does not vanish, if the upgrade completes before the summoned building times out.

ParadoxiKat commented 8 years ago

Ok so here's what I've changed.

  1. if the target of the summon spell is not a building site, such as a meadow or unblocked exit, and is not a square, it will try to find the nearest meadow to the target. This fixes the case where effect_target is set to self, it will just try and find the nearest building site to the caster. Same if you target a goldmine. It will just try and find the nearest meadow to the goldmine.
  2. If the target is a square it will try and find the first available meadow or exit. This fixes the case where effect_target is worldrandom.
  3. Summoned walls and gates will find exits and not meadows, and will block them.
  4. In all cases, if there are no available building sites, no building is created.
  5. If multiple buildings are summoned, each successive one will try and find the exit or meadow nearest the previously created one until there are no meadows or exits available.

You can test this by loading a single player game and typing a 20 castle on a square with only 2 meadows. Only 2 castles are created, and they take up the available meadows. Where as previously you would have received 20 castles, likely all at the center, and the meadows would still be available. You can do the same with walls,a 10 wall should at most only add 4 walls, exactly one for every available exit, and they should all be blocked.

This reduces the issue of incorrectly targeting the summon, i.e. trying to summon a castle onto a goldmine. The nearest meadow will be sought out. But if you target a square with no available meadows the caster will still expend the mana and think it has successfully cast the spell, though nothing will have been created.

soundmud commented 6 years ago

If I remember correctly, this part of the code of SoundRTS is already a bit tricky, as you might have noticed, so I prefer not to add another feature there. Maybe later.