Giter Site home page Giter Site logo

nmrih-l4d2-dynenter's Introduction

What is this?

This script searches through cordons you define, and automatically creates 
    VScript spawn functions for them. 
These function may then be used to dynamically spawn or despawn dynamic entities in your source map.
It also creates a copy of your vmf, removes the found entities, and feeds this precompiled vmf 
    to vbsp for full compilation.

Why:

- performance
- shorter initial load time
- free edicts and circumvent engine limits
In depth why Source has low limits when it comes to dynamic entities count. If one can have dynamic entities unloaded, and load them at points on the map where they are needed you can circumvent these limits. Another benefit is potential performance increases, for clients as well as for servers and shorter initial loading times. One negative is possible lag from ingame loading of assets, as i havent implemented precaching at mapload as an option yet.

HOWTO:

1. Install the following:

    This precompiler, DynEnter   - 
    [optional] CompilePalX           - Easy compile and precompiling
            https://github.com/ruarai/CompilePal/releases/tag/v027.30
    [optional] Plugin for CompilePal - Easy precompiling
            included in this repo
    Copy the DynEnter directory to your nmrih/bin directory
    Copy the parameters directory to your nmrih/bin directory

    -requires Python >= 3.3 : https://www.python.org/downloads/

2. Setup the VMF

Cordons

Make cordons around areas you want to have entities be dynamically loaded.
    It is not mandatory to cordon everything. Un-marked areas are simply skipped in the precompiler and will load at map start.
Name these cordons something descriptive and give their name the prefix 'DynEnter_',   to mark them for the dynamic spawner.
cordoning example image

Script_Logic

Place a script_logic somewhere in your map, with name DynEnter_Overlord. 
Create a new keyvalue (disable smartedit, press add) with name 'vscripts' value 'DynEnter/mapname/DynEnter_Overlord.nut'
mapname will be the second word/title in your map's filename:
    eg: nmo_newyork_v21 would be newyork
overlord example

Trigger

In transitions betweens map areas, such as corridors or elevators, create a trigger. 
Have it output the following:
OnTrigger DynEnter_Overlord SpawnEnts_<areaname>()
areaname will be the descriptive cordon name you have made earlier, without the prefix:
    eg: dynspawn_garage would be garage
trigger example Note: picture has incorrect prefix: should be SpawnEnts_

3. Run precompiler, and compile map

    Use the provided CompilePalX plug-in in the compile steps -before- vbsp. 
    It launches DynEnter precompiler which creates a new vmf with entities in areas removed. 
    The entity data is stored into vscript scripts which may later be called ingame to load the entities. 
    The modified vmf is then passed into vbsp and the compilation is continued.
setupplugin example
You may also manually precompile the map and then compile the processed VMF. It will be
    located in this script directory's vmfoutput folder.

If there are problems in the precompiler please submit a bug report!

4. Test your map ingame.

    Trigger your defined triggers. If all goes well you will see 
    entities being loaded in. If nothing happens check if the paths in the trigger output are correct.
Results example image

Some last things worth noting are: You can destroy the entities in the area by calling DestroyEnts_areaname() on the DynEnter_overlord entity. Open vscripts/DynEnter/mapname/DynEnter_Overlord.nut , for a list of the generated VScript entities

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.