0% found this document useful (0 votes)
470 views19 pages

Enhancing EventScripts with Python

PyCon 2008 Slides The EventScripts plugin is the most popular scripting engine addon for Valve's Source games, running on ~10,000 game servers globally. Its most recent version, EventScripts 2.0, has added support for Python 2.5 scripts. ( http://python.eventscripts.com ) In this presentation, the creator of EventScripts will provide a behind-the-scenes look at the process, hurdles and considerations of embedding the Python engine into games like Counter-Strike: Source and Half-Life 2: Deathmatch.

Uploaded by

Mattie
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
470 views19 pages

Enhancing EventScripts with Python

PyCon 2008 Slides The EventScripts plugin is the most popular scripting engine addon for Valve's Source games, running on ~10,000 game servers globally. Its most recent version, EventScripts 2.0, has added support for Python 2.5 scripts. ( http://python.eventscripts.com ) In this presentation, the creator of EventScripts will provide a behind-the-scenes look at the process, hurdles and considerations of embedding the Python engine into games like Counter-Strike: Source and Half-Life 2: Deathmatch.

Uploaded by

Mattie
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Mattie Casper

March 14, 2008


PyCon 2008, Chicago

Counter-Strike and Source are registered trademarks of Valve Corporation. The author is in no way affiliated with Valve
Corporation, but is a fan of their work.
 Background
 Demo
 Goals and Results
 Future Possibilities
 Pain Points for Embedding
 More Information
 Special Thanks
Source engine and EventScripts
 Half-Life
• released by Valve in 1998
• Active modding community
 Counter-Strike
• First released in 1999
• Still popular: 70,000 players
 Source engine
• Half-Life 2, Counter-Strike: Source
• Vampire: The Masquerade Bloodlines
• Portal, Team Fortress 2
Source SDK-based C++ plugin
Initially a shell-like language
Philosophy
• Customize servers
• Friendly community
• Focus on ease-of-use for new scripters
EventScripts 2.0 with Python support
Used by a third of all Source servers
~12,000 servers and ~1,200 addons
Dedicated Server
Player1 addon1.py

Rented server instance


addon2.py
Player2 (Wild, Wild) EventScripts
Internet
...

Player3
Rented server instance addonN.py

Player4
Popcorn in Counter-Strike: Source
Embedding Python in EventScripts
 Goal
• Easy to read and learn
 Results with Python
• Already a good beginner language
• Dynamic nature allows complexity to be hidden

Before

After
 Goals
• Cross-compile for Windows and Linux
• Support rented game servers
 Results
• Library loading from a plugin shared object
 Delay loading on Windows
 RPATH on Linux
• Python path issues (/lib)
• Compilation issues
• Directory names with colons
 Goal
• Maintain game responsiveness

 Results
• Acceptable performance with shell language
• Python
 Bytecode is order of magnitude faster
 Psyco for native compilation of bottlenecks
 Goal
• Don’t feed the hackers. (Game servers are
attacked for sport.)
 Results
• No access to Python from the game console
• Scripters are warned against eval/exec
• Unrelated denial of service exploit found
 Goals:
• Many addons loading independently
• Addons should not impact one another
 Results
• Loading addons as modules (from packages)
• Register event listeners with central manager
• Continue after isolated exception
• Threading is not so hot
 Performance poor when multiple addons thread (GIL)
 Embedded apps have no real recourse
Improving Python and EventScripts
eXtensible Admin
es_install
EventScripts classic to bytecode
Lower level SDK wrapper
Auto-update mechanism
 Threading – GIL hurts
• Embedding apps can’t fork easily
• App users don’t write C extensions
 Embedding – Increase priority
• Improve documentation
• More examples, samples, tutorials
 API Documentation – Modernize
• Full pages for functions with examples
• Allow user comments
 Viper for SourceMod by Zach Kanzler

 EventScripts resources
• mattie.info/cs - Downloads
• addons.eventscripts.com – Addon Database
• python.eventscripts.com - Documentation
• www.eventscripts.com – Documentation
 Helen Casper, Glenn Davis, Ted Shroyer,
Don Lafferty, Michael Barr
 Awuh0, british.assassin, cagemonkey,
Cap’tain ta race, Chun, Colster, Einlanzers,
Errant, GODJonez, GoodfellaDeal,
HitThePipe, ichthys, Lobe, Mbchrono, McFly,
mikesrevenge, murpher, Nicolous, RideGuy,
Saul, sn4k3, SumGuy14, SuperDave,
TIM3PORT, Wonder, [NATO]Hunter,
[YG]Gordaz
Shoot ‘em up.

You might also like