Git Product home page Git Product logo

ghostfire90 / py-source-sdk-2013 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sandern/py-source-sdk-2013

0.0 1.0 0.0 649.73 MB

A Source SDK 2013 fork with automatically generated bindings for Python 3.

License: Other

Python 2.23% Shell 0.01% C++ 93.95% C 2.81% Perl 0.21% Makefile 0.07% Objective-C 0.41% Assembly 0.01% Objective-C++ 0.01% Batchfile 0.02% Protocol Buffer 0.02% GLSL 0.28% Perl 6 0.01%

py-source-sdk-2013's Introduction

PySource

A Source SDK 2013 fork with automatically generated bindings for Python 3. The aim of these bindings is to have a (semi) safe Python environment of Source Engine to play around with. For a better idea of what these bindings offer, check out the examples directory.

These automatic bindings were originally made for Lambda Wars mod. Also see the Python folder of this for more examples of what is possible (most game code is written in Python!).

Please let me know if you have any issues. Pull requests are welcome too!

Quick-start

Currently tested on Windows (VS2013 Community Update 5) and OSX (XCode 7.3) only:

  1. Run mp/src/createpysourceprojects

  2. Open games.sln or games.xproj and compile. For OSX, you might need to change the projects sdk.

  3. Start mp/game/PySource and load a map

  4. Test Python by entering one of the following commands:

     spy print('Hello Source')
    
     spy print(UTIL_PlayerByIndex(1).GetPlayerName())
    

Examples

Examples can be found in the Python game directory examples. These examples cover the Your First Entity page from VDC among others.

Commands

    spy - Evaluates a Python string on the server

    cpy - Evaluates a Python string on the client

Generating new modules

PySource makes use of castxml, pygccxml and pyplusplus to generate Boost Python bindings. You can find instructions in mp/src/srcpypp.

Disabling modules.

Open mp/src/srcpypp/settings.py and uncomment the unwanted modules. Then run in the same folder:

    python3 generatemods.py -a

An updated vpc file will be generated, so after this step you need to rebuild your project files.

Most of the modules can be disabled, but the example modules will fail to import. Also the srcbuiltins module exposes Msg and Warning functions to Python, which is used to redirect stdout and stderr.

List of binding modules

  • _animation: Exposed functions from - animation.h
  • _entities: Exposes most base entity classes (CBaseEntity, CBaseAnimating, etc)
  • _entitiesmisc: Exposes miscellaneous bindings related to entities, like the entity list
  • _gamerules: Exposes Gamerules classes. Allows creating and installing custom Gamerules on the fly.
  • _gameinterface: Exposes game engine interface, user messages, ConCommands and ConVars among others.
  • _input: Exposes client IInput interface and key defines.
  • materials: Exposes materials related functions.
  • _ndebugoverlay: Exposes NDebugOverlay functions.
  • _particles: Exposed Particle system related functions, like DispatchParticleEffect.
  • _physics: Exposed IPhysicsObject and related.
  • _sound: Exposes sound engine interface and related.
  • srcbuiltins: Exposes debug Msg functions, used for redirecting output of Python
  • _steam: Exposes steam api related classes.
  • _te: Exposes temporary effects/entities, client side effects and FX_ functions
  • _utils: Exposes utils functions and related (e.g. UTIL_TraceLine)
  • _vgui: Exposes client VGUI related classes and functions.
  • _vguicontrols: Exposes client VGUI base Panel classes.
  • _vmath: Exposes mathlib
  • vprof: Exposes VProfiling

Note: Most of these modules are complemented by Python modules (e.g. entities)

py-source-sdk-2013's People

Contributors

alanedwardes avatar alfred-valve avatar bruced-valve avatar joeludwig avatar jorgenpt avatar jstasiak avatar mikesartain avatar narendraumate avatar neico avatar nephyrin avatar plesiecki avatar psychonic avatar sandern avatar sortie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.