This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk

Forum rules

ScriptAPI breaking changes in Alpha 1.2.0

Here you can find answered ScriptAPI topics.
Forum rules
By using the forum you agree to the following rules.
Locked
User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1887
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 36

ScriptAPI breaking changes in Alpha 1.2.0

Post by Gurt » Sun Jan 08, 2017 1:44 pm

This thread is only to highlight upcoming breaking changes to the ScriptAPI in Alpha 1.2.0 (so you can plan accordingly). The update is still work-in-progress and will take some time to complete.

"IPlayer.SetBotType()" and "IPlayer.BotType" will be removed in future versions of SFD and replaced with the new concept "BotBehavior" which will control how a bot will behave. BotBehavior can only activate the old BotType.TutorialA for the time being but will be built upon in future versions.

Code: Select all

// SetBotType is removed
// player.SetBotType(BotType.TutorialA);

// BotBehavior is the replacement
BotBehavior bb = new BotBehavior();
bb.Active = true;
bb.TutorialMelee = true;
player.SetBotBehavior(bb);

A new concept PlayerCommands will be introduced which can control a player in more detail. This can be done through the ScriptAPI or by chaining command triggers together in the editor.
Following commands will be available:
► Show Spoiler
"IPlayer.RunToPosition()" will be removed in future versions of SFD and replaced with the "MoveToPosition" command.

Code: Select all

// RunToPosition will be removed
// player.RunToPosition(new Vector2(100f, 0f), 1);

// PlayerCommand is the replacement
player.AddCommand(new PlayerCommand(PlayerCommandType.MoveToPosition, new Vector2(100f, 0f)));
Note that PlayerCommands will only be possible to perform while all input is disabled for the targeted player. While PlayerCommands can control a player the purpose is not to be able to create your own AI (even if you can do that to a certain degree) but rather to allow map makers to script NPC:s to create short action scenes or cutscenes in their maps.
 ! Message from: Gurt
Old maps using the old code will still run for some time after this update but you should update your maps as soon as possible after this update before the functions are removed permanently in future versions of SFD.
Other new content for the ScriptAPI for Alpha 1.2.0 will be listed in the patch notes once we release the update.
Last edited by Gurt on Mon Jan 09, 2017 6:11 pm, edited 1 time in total.
7 x
Gurt

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 530
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 27

Post by JakSparro98 » Sun Jan 08, 2017 3:11 pm

Well, even if PlayerCommand isn't designed for creating some AI sketchs, this will cover most of the problem I have faced with the attempt to make NPCs control the environment.

Maybe it's to early to ask but how do you think will be implemented the navigation mesh for the official bots? it will automatically scan every macroblock (4x4 as the default tile size) within the border area or there will be some kind of nodes the player have to place around the map, then will the game needs to compile the possible links to every node and save the network in the map or will be the path calculation executed in runtime?

Thanks for the clarifications and I hope not to be seemed intrusive.
0 x

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1887
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 36

Post by Gurt » Sun Jan 08, 2017 5:49 pm

It will be up to each map maker to create some kind of nav-mesh for each map in the future.
3 x
Gurt

Armadyl5
Superfighter
Superfighter
Posts: 119
Joined: Sun Mar 20, 2016 9:50 am
Started SFD: 1.2.1
Gender:
Age: 27

Post by Armadyl5 » Mon Jan 09, 2017 12:39 am

Player Commands Feature was what I waited so much to see , Gurt , your my hero *-*
2 x
Never Surrender !

Always Fight For Your Rights , and Don't Let Your Friends Down .

User avatar
Motto73
Superfighter
Superfighter
Posts: 316
Joined: Mon May 09, 2016 7:35 am
Title: Lazy ass
SFD Account: Motto73
Started SFD: Multiplayer Test Demo
Location: Sunny City
Gender:
Age: 26

Post by Motto73 » Mon Jan 09, 2017 10:41 am

This is AWESOME!

Awesomely awesome.

But i need to ask:

What if you kept the old commands too? For backwards compatiblity? There are so many mpas with RunToPosition() mehtods and others.

Please think of that before launching the update
1 x
Image

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 530
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 27

Post by JakSparro98 » Mon Jan 09, 2017 2:53 pm

I totally forgot to ask if the new RunToPosition method will include both X and Y check before to say it has reached the position.
I can explain better, when you currently invoke the method it will stop to walk to the goal even if only the X value of the goal is reached, it doesn't care about the Y position. So, will the new version of the command prevent this?
0 x

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1887
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 36

Post by Gurt » Mon Jan 09, 2017 6:14 pm

Motto73 wrote:What if you kept the old commands too? For backwards compatiblity? There are so many mpas with RunToPosition() mehtods and others.
Good point. Marking the functions as obsolete for this update. The functions will still be removed in future updates of SFD but just not this one. This should give all map makers plenty of time to update their maps.

The new MoveToPosition command acts just like the old RunToPosition. Y-coordinate is ignored. Updated the summary to reflect this better.
1 x
Gurt

Locked