Map Database  •  FAQ  •  RSS  •  Login

New scripting ideas for KaM Remake

<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 05 Oct 2012, 09:00

New scripting ideas for KaM Remake

Here we can discuss what kind of scripts we need in next KaM Remake to make possible these new gameplay modes:

1. Tower Defence (player repells AI attacks and gets resources after each wave)
2. Castle Fight (two competing players that can only hire troops, but cant control them)
3. Other ideas?

Here's our discussion with TDL about 1st idea:

Comment by TDL
Hi Krom and Lewin, I haven't used any of these events yet so this is all new to me. Fortunately it's not hard to understand so I will be fine, yet it is confusing that events are stored in a .evt file and not in the main script. I'm now thinking of some triggers and actions that I would need. Here are some:

- First of all, I need to start the AI attack wave. I can do this with the TIME trigger. - Then I can use the ATTACK action to start the attack wave. I will need more parameters for this, I need to specify exactly which troops have to attack. We should also discuss the behaviour of the soldiers when they go attack. For example, I want the AI's melee units to walk straight to the target, but archers and crossbowmen should fire at anything in their range. I suggest some different attack types. Last but not least, the ATTACK needs one more parameter to identify the attack. Just a number will do. - Then I need a trigger that triggers an event when the attack is repelled, something like ATTACK_DEFEATED. Now the 'id-number' from ATTACK is required to specify which attack has to be stopped in order to activate the event (GIVE_WARES in this case!). - I migt need AND/OR/THEN, like DEFEATED 1 AND DEFEATED 2 AND DEFEATED 3 THEN VICTORY 0. - Then I would also need specific DEFEAT conditions, in this case the destruction of a watchtower. You could specify this watchtower by the X and Y coordinates of the building, or Remake should scan around those coordinates and assign the closest watchtower to it. Something like DEFEAT_CONDITION (Player number) (Condition number) (optional parameters, in this case building type) (and here the X-coordinate) (and Y-coordinate here) Condition number should refer to a list with all possible defeat conditions, for example: 1: Destroy all important buildings 2: Kill all enemy military units 3: Kill all enemy units 4: Destroy a specific building 5: etc. For example: DEFEAT_CONDITION 0 4 17 20 30. So player 0 loses when the watchtower closest to X=20, Y=30 is destroyed. Winning conditions could work the same way, although you would need an extra parameter to indicate the player of whom this building needs to be destroyed. You would need only either winning conditions or defeat conditions if AND/OR/THEN is implemented though.

That's it for now, I might come up with more later. :)
Comment by Krom
For now events are very primitive, there are even no AND/ORs.

The way you outline it it seems we need a full-blown scripting engine to meet listed and possible features. Something like HeroesOfMightAndMagic?, Starctaft1, Warcraft3 had.

I see 2 routes from here: A. we plug-in something that is already out there (Lua?), B. We invent our own clumsy bicycle. And of course we will need to figure out how to rig internal events (how to know attack should occur now, or was repelled, or anything else)

I would also like to be able to visualize most of it, so that you could script in our MapEd? and not care for Ids and Types, just selecting values from dropboxes and pointing houses with a mouse.

Let's try to outline TD game scripting in simplest terms, how would it look within MapEd? point of view: We open map, place towns, add resources, etc. Now we need attack waves setup in global script (cos it cant be tied to any visual marker on map). We can instruct AI to prepare troops (TIME 0 MAKE_ARMY type amount), then AI will need to hire recruits and equip em. Say AI town has 10 schools and unlimited supply, that will take 3-4min? Second command should send them to attack (but we dont have guarantee the army is ready?) ... That sounds like too much micro really. Maybe the command should be TIME 0 ATTACK_WAVE id params and let AI work it out on its own. Then next script line could be ATTACK_WAVE_REPELLED id ADD_WARES params. Yeah, I like it better, it seems current scripting system could handle it that way )
Comment by TDL
The AI won't require to train troops from a barracks. My plan was to provide all troops from the start, together with a storehouse, inn and serfs to keep everything alive. An event to give the soldiers a full health bar might be useful as well. So we are guaranteed that the AI is ready to attack. Lewin said something about creating armies with a command. Not with a barracks, they would just 'magically appear'. That's fine with me too, it would both work I guess. I'm not sure if 'ATTACK_WAVE' would be a good name, as attack waves are typically used in game types like tower defence. What's wrong with just 'ATTACK'? Or do you intend to make ATTACK_WAVE different from ATTACK? I'm just wondering.

I could work with Lua too, I've used it for Settlers: Heritage of Kings. But I'm not really good with it, I think 'normal' scripts are easier.

I'm not sure what you mean with visualizing everything and how I should take part in that. Could you please explain? :P
Comment by Krom
The thing is - I want to envision it before starting to code.

Troop from the start is a weak option because that limits playtime and requires a lot of space on map. We need a more convenient way of having "army on demand". It should be both plausible in KaM universe and reusable in different script ideas. Either spawning (how to make that trigger display in MapEd??) in open field or hiring from Barracks (we can make a command to spawn army at Barracks entrance - player wont be able to check if there really were 144 recruits and armaments). I prefer second way, it's more natural. 3rd option - let units walk in from outside map boundaries.

ATTACK as I see it orders an existing groups of units (1st or 2nd defence line) to attack. Where ATTACK_WAVE does not only that, but also takes care of spawning the troops.

Okay, lets try homebrew scripts idea first, we will still need all the triggers and handlers if we switch to Lua and I plan to keep our scripting engine as simple as possible.

Visualizing means placing scripts onto objects where appropriate to avoid Id usage. E.g. creating an army formation (several groups) and editing its script right there, not in Notepad. Another example - placing a script on ground that is triggered by unit walking on it. The MapEd? will take care of substituting proper group indexes (which is handy if you move armies around and delete/add them).
Last edited by Krom on 05 Oct 2012, 09:22, edited 1 time in total.
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 05 Oct 2012, 09:02

Re: New scripting in KaM Remake

Castle Fight idea can be implemented with least effort like this: Map has 2 AIs and 2 players separated by a wall. Players can't see or attack each other, but their actions are translated to AI. F.e. if player makes 5 axes they are given to his allied AI. And AIs are scripted to fill defence positions with archers and constantly attack each other with all remaining troops. Player gets defeated if his ally AI is defeated.

In script that would could look like just 2 more commands:

HAS_WARES player ware_type SEND_WARES player ai ware_type
DEFEATED ai DEFEAT player
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

pawel95

Castle Guard Swordsman

Posts: 1912

Joined: 03 Oct 2008, 22:00

KaM Skill Level: Skilled

Location: "Pawel95" on Youtube.com

Post 05 Oct 2012, 18:22

Re: New scripting in KaM Remake

Castle Fight idea can be implemented with least effort like this: Map has 2 AIs and 2 players separated by a wall. Players can't see or attack each other, but their actions are translated to AI. F.e. if player makes 5 axes they are given to his allied AI. And AIs are scripted to fill defence positions with archers and constantly attack each other with all remaining troops. Player gets defeated if his ally AI is defeated.

In script that would could look like just 2 more commands:

HAS_WARES player ware_type SEND_WARES player ai ware_type
DEFEATED ai DEFEAT player
Not a script idea, only want to say, that maybe MORE AI players. SO that maybe later one AI player will only manage ranged tropps/2nd AI horses, etc. SO you can make better attacks/scripts!?
One AI will have still hard work to handle all?!
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 06 Oct 2012, 19:16

Re: New scripting ideas for KaM Remake

Number of AI players and their setup completely depends on mapmaker, we are just discussing scripts that are needed to let them make it ;)
Scripts that are versatile and easy to implement and use.
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 07 Oct 2012, 02:19

Re: New scripting ideas for KaM Remake

Number of AI players and their setup completely depends on mapmaker, we are just discussing scripts that are needed to let them make it ;)
Scripts that are versatile and easy to implement and use.
I think he meant can we allow more than 8 players in singleplayer so you can use more AIs. It's often useful to divide the enemy up into many AIs, one for the initial attack, one village inside another, etc. I guess we could do that eventually.
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 07 Oct 2012, 08:30

Re: New scripting ideas for KaM Remake

In that case that has nothing to do with scripting ideas we discuss.
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 08 Oct 2012, 14:13

Re: New scripting ideas for KaM Remake

Sorry for delay

We can write defeat trigger in a way "HOUSE_COUNT player_id tower 0 DEFEAT player_id". What will be the "Tower" though?

Victory in KaM works in a way that to get it you need to defeat all enemies. Once everyone is defeated - you win. So my proposed algo is just wait till all enemies are defeated (see above paragraph).

Since we only support one trigger and one action per event we need to plan them to fit into this limitation. So WAVE can handle only one group of warriors, thats ok, but it needs to have a cue to timer as well (or invent a new display_countdown event, which is a good idea as well).

Lets move on to forum - unread messages notifications are better there.
"Tower" could be just "17" like it is in normal KaM script (!SET_HOUSE 17 X Y). Defeat will work fine that way, indeed. :)

Victory will work too, but what about a draw result? When more than one player sustains every attack? Nothing will happen in that case. Bus as I said earlier I might use messages for that.

I want all attacks to happen simultaneously for every player, so I should use TIME triggers to trigger the countdown; in other words: in this case the countdown should not be activated as soon as the attack is repelled, because not all players defeat the enemy equally quickly. The countdown for the next attack must start right away when the current attack is carried out.
Something like this:

TIME 0 SHOW_MESSAGE (The first attack wave will reach us in five minutes.)
TIME 0 DISPLAY_COUNTDOWN 300

TIME 300 ATTACK_WAVE blablabla
TIME 300 SHOW_MESSAGE (The enemy is here! The next attack wave will reach us in 10 minutes.)
TIME 300 DISPLAY_COUNTDOWN 600

TIME 900 ATTACK_WAVE...
Etc.
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 08 Oct 2012, 14:39

Re: New scripting ideas for KaM Remake

TD is not MP game in a true sense, it's more solo, right? So we try to adapt it to MP as good as we can. Lets make each next wave bigger and see who remains last.

That looks neat. Maybe we can skip the ATTACK_REPELLED trigger then, just use TIME blabla GIVE_WARES blabla. If player was defeated he gets nothing, if he repelled enemies he gets his bonus allright. What do you say?
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 08 Oct 2012, 16:52

Re: New scripting ideas for KaM Remake

TD is not MP game in a true sense, it's more solo, right? So we try to adapt it to MP as good as we can. Lets make each next wave bigger and see who remains last.
Well not necessarily, It's more like 'players vs AI' although it's not a co-op map (I might make a co-op version as well if this turns out a success). Players fight against the AI but also indirectly against each other because the last survivor wins.
That looks neat. Maybe we can skip the ATTACK_REPELLED trigger then, just use TIME blabla GIVE_WARES blabla. If player was defeated he gets nothing, if he repelled enemies he gets his bonus allright. What do you say?
Hmm no, I would still like ATTACK_REPELLED to give wares. Otherwise I would have to guess when a player repels an attack and I might be way too early or way too late. ATTACK_REPELLED would be much more professional and also gives a bonus to the player who sustain the attack first: they get resources faster and can prepare better for next attack. So a player who decides to build some towers at the start will first be at a disadvantage because other players may decide to go for iron weapons first. But because the towers kill some units too, that player will kill the attack wave much faster and gets his resources first.
I can't really imagine a smoothly working TD without ATTACK_REPELLED, it's quite essential.
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 08 Oct 2012, 17:28

Re: New scripting ideas for KaM Remake

About victory conditions, I think I see what you mean, but now we need to express that in single line trigger that proclaims Victory for the player (without using ANDs).

Okay, you right, ATTACK_REPELLED added to plan. I have updated MissionEvents wiki.
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 09 Oct 2012, 09:54

Re: New scripting ideas for KaM Remake

...I guess we're done then? I think that's all I need. :)
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 20 Oct 2012, 18:10

Re: New scripting ideas for KaM Remake

How do I use the MESSAGE event? It says I must use the index number from messages. Does that mean I should edit the .lib files...? :|
EDIT: just checked the TSK files and I understand how it works now. I'll see if I can get it working.
EDIT 2: Okay I got it working, but I guess this means that every single message has to be translated to every other language, otherwise people won't receive the messages... Am I correct?
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 21 Oct 2012, 13:29

Re: New scripting ideas for KaM Remake

EDIT 2: Okay I got it working, but I guess this means that every single message has to be translated to every other language, otherwise people won't receive the messages... Am I correct?
It should work like our other translation systems, it loads the English text first then loads the user's translation over the top of that. So any missing text in the user's translation will come from English. Some languages like Czech/Slovak use each other as fallbacks as well (since they're 90% the same), but that's not really relevant since it still all defaults back to English if there's no translation. So basically just provide .libx files for whichever translations you can, the others will see English :) You can use the Translation Manager from the main directory for editing libx files or just open them in Notepad.
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 18 Nov 2012, 07:19

Re: New scripting ideas for KaM Remake

I was researching the subject lately and there are some good news.

I was looking for Delphi scripting languages (thats the kind of thing when you write Pascal code in a text file and ask KaM Remake to execute that code within itself). There's a good choice of freeware alternatives (PascalScript, DWScript) and shareware (TMSScripting, PaxCompiler, and some others). What that means is that we can scrap the homebrew system and switch to a professional one. Mission script will look like a simple Delphi program:
  Code:
program MissionScript; begin if Time = 400 then ShowMessage(0, 1); //Show message to player_0 if HouseBuilt(0, 5) then //player_0 has built Tannery GiveWares(0, 8, 100); //Give player_0 100 Coal if ((Time = 100) and UnitCount(0) >=30) or (WareCount(0,8) < 100) then //If player 0 has more than 30 units after 10sec or has less than 100 Coal Defeat(0); //Proclaim player_0 defeated end;
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 18 Nov 2012, 13:25

Re: New scripting ideas for KaM Remake

Awesome! With OR/AND I can make Tower Defence much more diverse :)

Return to “Ideas / Suggestions”

Who is online

Users browsing this forum: No registered users and 11 guests