30
By Justin Karneeb

Scripting Languages

Embed Size (px)

DESCRIPTION

Scripting Languages. By Justin Karneeb. What is a scripting Language?. Many people have different views It is not a High-Level language It has low functionality (innate abilities) It has minimal debugging tools It simplifies a complex task for another program So what is the answer??. - PowerPoint PPT Presentation

Citation preview

Page 1: Scripting Languages

By Justin Karneeb

Page 2: Scripting Languages

Many people have different views It is not a High-Level language It has low functionality (innate abilities) It has minimal debugging tools It simplifies a complex task for another program

So what is the answer??

Page 3: Scripting Languages

A scripting language, script language or extension language, is a programming language that controls a software application.

But that is a very vague response…… but because of the debate, I guess it has to be.

Page 4: Scripting Languages

There is one thing that everyone agrees on It is almost always used to solve a task for

another program

Scripting Languages are languages where there core use is to extend the use of another language or piece of software.

Page 5: Scripting Languages

There are two parts to a scripting language The Language itself

Defines syntax just like a High-Level language

The Engine/Interpreter A scripting language normally runs in a virtual

machine similar to Java.

Page 6: Scripting Languages

Most programming languages compile into machine code/assembly

Scripting languages mostly compile into what is know as a bytecode stream. It contains simpler instructions than the

language itself, but not as simple as assembly.

Page 7: Scripting Languages

Also known as a Virtual Machine or VM. The VM takes the bytecode stream and runs

it. This is generally slower than it running

innately, however it also has many positives as well. Since they are running independently from the

main program, the entire program will not crash if there is a problem.

Page 8: Scripting Languages

You can use a scripting language to do almost any task, however it is suited to some more than others

Anything which needs to be multiplatform Anytime in which non programmers need to

have direct access to the behavior of a program

When gluing different pieces of software together or to have them communicate effectively.

Page 9: Scripting Languages

Webpages are perfect places to utilize scripting languages.

Since they need to be multiplatform, their VM based compiling/running is extremely handy.

HTML, PHP, XML, SWF, these are all scripting language extensions.

Page 10: Scripting Languages

This allows developers to work on parts of the program that do not necessarily require the completed program.

This is also applicable in games, developers can begin work on mapping and scripting npcs while the game itself is still under development.

Page 11: Scripting Languages

Many NPCs in video games are completely scripted The path the walk, what they say and even

what they do is coded in a scripting language which communicates with the engine.

The infamous Half-Life Marines were scripted to move in a specific way

Page 12: Scripting Languages

Some games release scripting languages complete with API’s for the gamer community to use to “mod” their game. Unreal tournament allows users to make

custom bots The original Half-Life had many scripting

capabilities through programs like AMX

Page 13: Scripting Languages

As with everything, scripting languages have their upsides an downsides

Scripting languages seem to have more ups than downs, especially as technology gets better and faster

Page 14: Scripting Languages

Allows developers to work independently of the programmers

Easy to understand and use compared to languages like c++ and java

Does not crash program, less error prone Scripts can be put on hold Is multiplatform Has a data-driven design Allows a modding community to extend a

game

Page 15: Scripting Languages

Most do not have debugging tools Runs extremely slowly when compared to

fully compiled code Normally has less functionality, less

innate abilities Using scripts too much (in games) can

lead to boring gameplay Overdependence on scripting can lead to

horrible problems late in development (using too much processing power)

Page 16: Scripting Languages

We have dealt with what scripting languages are, when to use them and how they work, now its time to show some real examples of scripting languages in action. Far Cry Instincts Half-Life

Page 17: Scripting Languages

A console based FPS which takes place on several islands.

The game is made to be played by sneaking around, which presented a serious problem NPCs on the island needed to look as if they

had a purpose. How would you code hundreds of different

NPCs to independently do normal activities? Scripting Languages : )

Page 18: Scripting Languages

Originally, Ubisoft tried to code their behaviors directly into the NPCs behavior

They decided to take a new approach where developers could place “Anchors” on things in game. The anchor would tell the NPC what to do next

Page 19: Scripting Languages

At first they were simple, but they soon expanded their use.

An anchor can play animations, trigger events, issue commands and just about anything else an NPC would want to do

Page 20: Scripting Languages

The developers were not versed in programming, so they decided to go with XML It fit in well with their engine Was overall easy to learn

XML is a text based scripting language that is powerful enough to get the job done

Page 21: Scripting Languages

The developers needed to get used to the XML code Some picked it up fast, but not everyone

Because the coding is generally easy, the programmers were able to make a GUI interface which could be used to write the code for the developers.

Page 22: Scripting Languages

Because the developers were unfamiliar with the subtitles of programming, they ran into some problems Ignore All command lead to many problems Vehicles could not use anchors Physics issues

Page 23: Scripting Languages

I have personal experience with scripting for Half-Life, specifically counterstrike and some other mods.

Half-Life itself has been modded more times than I prefer to count.

My experience is with AMX, it makes minor changes to the games.

Page 24: Scripting Languages

AMX is a scripting language made specifically for Half-Life modifications. It starts as a text file which gets compiled into

a .AMX file AMX links with the Half-Life engine and while

in game runs “plugins” that are written by the modders.

When you combine AMX’s plugins with the already modded HL engine, there are millions of different gameplay options available.

Page 25: Scripting Languages

Ninja Rope Allowed you to swing from any surface via a

“rope” Slap

Allowed admins/users to “slap” (do 1 damage and knock the slapie around a bit) players

Predator Made one user invisible, gave them extra

health and speed. Defend Your Castle/Force Grab

Page 26: Scripting Languages
Page 27: Scripting Languages
Page 28: Scripting Languages

The plugin asked the engine who the user was currently looking at, and returned to it its x,y, and z positions in the plane

When activated, as the user moved his/her cursor, the x,y and z coordinates of the player being grab were updated to that new location (the distance between them remained constant)

Page 29: Scripting Languages

While we were able to achieve a very high toss into the air, which would kill players in impact, if you forcibly drove a player into the ground and he died while being grabbed, the plugin would crash. Half-Life was unaffected however AMX would

stop working until the server was restarted. We were never able to solve this problem,

there seemed to be no exception handling in AMX.

Page 30: Scripting Languages

I learned a lot about scripting languages back then even though I had no idea what I was doing. It was extremely powerful It was hard to debug It was easy to learn

I had never programmed before When it crashed, it did not ruin the game

It fit our definition perfectly.