Page 1 of 24

New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 04:44
by Ben
The name of the topic should make it obvious, but here is where we can give ideas for new Dynamic script codes.

For my first idea, I would like to be able to play a .mp3, .wav, or other sound files using Dynamic Script. If done correctly, this can add a lot of depth to a mission, such as brief dialog, or music for cut scenes.

What do you think? Is it a good idea?

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 05:18
by Lewin
Good idea making this topic :) I've made it sticky so it will stay up at the top.

We were slightly hesitant about letting you play sounds because that could be annoying/disruptive to the user if used incorrectly. Also there's currently no way to do a "cutscene" because you can't stop the user moving his view around (which is something we might add eventually).

I guess there's no big problem with playing sounds or doing cutscenes, it's up to the map author to use it correctly and obviously we won't accept scripted maps into the Remake if they play annoying sounds all the time or are poor quality.

Before someone asks, we plan to eventually have a command to change the owner of houses/units/other assets (so you could capture an enemy village and gain control over it). However this is complicated to implement, what if you are given control of an inn which has an enemy unit eating in it? That could cause all sorts of errors in the game. We probably won't have it implemented for this release, hopefully the next one.

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 05:30
by Ben
Thanks, Lewin. I'm honored to be the author of a sticky thread :D

I don't see it being a problem if authors spam noises and such. Nobody would play such an annoying mission anyway.
Plus, authors can still spam the same object on a map 1,000 times; which could be just as annoying. Everything must be in moderation! :wink:

I was just about to say that cutscenes could be possible (to an extent) if you changed his units to another player (of the same color) for the duration of the cutscene, but I see now that ownership changing isn't possible yet. I suppose that we could use slilent kill unit and replace it with someone elses, and then repeat the process again after the scene is done, but that would be a ton of work, tricky to do (unit positioning would need to be exact) and it would look very bad.

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 06:02
by Lewin
It would be possible for us to change which player the human is controlling, similar to when you press F11 and click the number radio boxes to select which player you control. That would be more tricky in multiplayer but should still be possible to implement (e.g. so allies could swap control to each other's stuff). We eventually plan to have spectators and allow users to control multiple "players" at the same time (maybe if your ally quits), but that's a fair bit of work and needs to be carefully designed. It certainly won't be implemented for this next release.

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 07:44
by Siegfried
Would it be possible to place game graphics at at a certain location? For example a flag? Or even an image from outside.

Also, a possibility to format text a little more would be nice. For example center it, or increase size.

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 07:45
by Ben
Another one: ObjectInArea. Whether it is a unit or building, I'd like to be able to have a state that checks if something is in a certain spot.

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 09:01
by Lewin
Would it be possible to place game graphics at at a certain location? For example a flag? Or even an image from outside.
Inserting graphics onto the map (or overlaid like the text overlay) is something we might add eventually, but probably not in this release. It would certainly allow some cool stuff :)
Also, a possibility to format text a little more would be nice. For example center it, or increase size.
Changing font size is not possible with KaM's bitmap fonts, but we could allow changing alignment (center/left/right) and moving it to a different place on the screen. We could also allow you to choose which KaM font you use.
Another one: ObjectInArea. Whether it is a unit or building, I'd like to be able to have a state that checks if something is in a certain spot.
Do you mean "is this unit within this area?" (you provide UnitID and area, true/false result) or "give me a unit within this area" (you provide area, it gives you unit ID). The first you can write yourself as a function, like this:
  Code:
function UnitInArea(aUnitID, Left, Top, Right, Bottom: Integer): Boolean; begin Result := (States.UnitX(aUnitID) >= Left) and (States.UnitX(aUnitID) <= Right) and (States.UnitY(aUnitID) >= Top) and (States.UnitY(aUnitID) <= Bottom); end;
Put that function at the top of your script, then you can do something like this:
"if UnitInArea(MyUnit, 10, 10, 20, 20) then"
where MyUnit is a variable storing a unit you created or found earlier (with Actions.GiveUnit or States.UnitAt or OnUnitTrained or something)

We're planning to add GetClosestUnit(Player, X, Y) (and same for house/group) eventually, which covers you other case.

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 09:14
by Siegfried
Also, a possibility to format text a little more would be nice. For example center it, or increase size.
Changing font size is not possible with KaM's bitmap fonts, but we could allow changing alignment (center/left/right) and moving it to a different place on the screen. We could also allow you to choose which KaM font you use.
You could double the size of that.
Would be perfect for King of the Hill-Maps. A double-size text in the middle counting "24 seconds to win".

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 09:23
by Lewin
You could double the size of that.
Would be perfect for King of the Hill-Maps. A double-size text in the middle counting "24 seconds to win".
It looks pretty pixely when you do: (that's 2x scaled)
Image
If we smoothly scale it, it looks blurry.

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 09:52
by Siegfried
Well, there are certainly some scalers that work good on text.
You're using GPU power anyway, so this could be even realized in a shader program at practically no extra cost.

For text, maybe the hqnx would be nice. It's a simple algorithm with medium cost. And it's a free algorithm.
hq2x -> http://hiend3d.com/hq2x.html
hq3x -> http://hiend3d.com/hq3x.html

OK, tbh that's not the scaler that I use with my DosBox, I use SaI for the lower cost. So we're already at the scaler-wars now ;)
And yes, it gives this nasty comic-style-look. But it's meant for the fonts only (and maybe my needed flags? ;) ) To make it double and triple size.

Re: New Dynamic Script Ideas

PostPosted: 13 Apr 2013, 20:26
by The Dark Lord
I agree with Ben, playing sounds should definately be possible. In Tower Defence, I would like to play the 'peace time is over'-sound every time a new wave approaches. That would be much more convenient than sending messages to the players.

Re: New Dynamic Script Ideas

PostPosted: 14 Apr 2013, 05:47
by Krom
Just on a sidenote, "playing sounds AND sending messages" is required. Many players (including me) play with sounds off for various reasons ;)

Re: New Dynamic Script Ideas

PostPosted: 14 Apr 2013, 06:16
by Ben
Sorry, Dark Lord, but Krom is right. Plus, it's a decent practice for accessibility reasons to always have multiple ways of getting information in case handicapped people are using the program, etc. For example, a deaf person could be playing Tower Defense.

This is also why it is important for games to have an option to display names or other captions over units to show which player they belong (in case a colorblind person is playing).

Re: New Dynamic Script Ideas

PostPosted: 14 Apr 2013, 09:22
by The Dark Lord
Hm, yeah. Point taken. (Although: how do you notice if there is a new message without sound?)

BUT!

Then I have a request: to be able to disable the usual message sound, so players who don't mute KaM sounds won't hear two sounds at the same time.

Re: New Dynamic Script Ideas

PostPosted: 14 Apr 2013, 13:18
by Bence791
An idea:

If there is "Actions.UnitKill", is it possible to make "Actions.GroupKill"? I mean not to kill only 1 soldier, but the whole group. I want to be able to do such evil things. Haha (6)