Rylec's Spawn Movement Guide

Discussions of the design and development of in-game content.

Moderator: Team Members

Post Reply
User avatar
Rylec
Team Member
Posts: 178
Joined: Wed Sep 04, 2019 7:48 am
Location: Qeynos Province District

Rylec's Spawn Movement Guide

Post by Rylec » Sat Oct 26, 2019 6:27 am

This is a guide to help budding and new Content Developers get started with Spawn Movement. The Wiki has a very good guide too, and this post can be seen as a companion to that article with a few additions of my own (mostly concerning how I handle movement variation). Disclaimer: Some of the views found in this post are my own and may potentially not reflect the opinion of the EMU Team as such (especially my view on movement variation).


Step 1 | I want to help with spawn movement, how do I get started

First of all you need to contact @Cynnar, @Jabantiz or @neatz09 and let them know that you want to help. They will be able to set you up with access to the editors that are used to change the game DB (in other words how we make changes to things in the actual game). They will also give your EQ2 EMU account GM powers so you have access to GM commands on the EMU server.


Step 2 | Read the Milestone post and select a Zone

The Milestone post details what the current content focus is. With that focus in mind, check out the parent forum to the List and see if there is a thread for the zones in the current milestone focus area. These threads will tell you the progress made to these zones (e.g. have the quests been put in, are all objects in the correct locations, have all spawns been set up with movement patterns etc.).

Pick a zone that needs more work. Please keep the zone thread up to date on your progress so everyone can see what has been done and what is still missing if you stop working on the zone at any point for any reason. If a thread exist for the zone just use that one, if not then make a new one - the easiest way to do this is to use 'edit' for the top post of one of the other threads and copy the post code to your new topic and edit it so it fits the new zone.

If you wish to use a Progress Map but lack the photoshop capabilites to make one just let @Rylec know and he will teach you how to make one or make one for you.


Step 3 | Spawn Movement

Now you need to decide on what type of content you want to focus on. The Wiki and @Jabantiz's post (you need Team member access to read this post) concerning LUA are excellent references that may inspire you.

This post is a guide that covers how to get started on Spawn movement, so if this is the area you wish to contribute to just read on.

Spawn Movement is simply put what makes the World come alive. Most spawns (mobs) and a lot of NPCs will walk around in the World, and each of these spawns need to have a script assigned to them that defines this movement.

There are two (actually three) main schools of thought when it comes to Spawn Movement, and they all have merit:
  1. All spawns in the World are stationary (this is how most spawns are currently on the EMU after a mass spawn was utilized to populate the World followed by a clean up - however, some spawns are missing or out of place so more clean up may be needed) - this is the bare minimum required for quests to be added, etc.) The World is playable but not necessarily very interesting.
  2. Random movement patterns. Some very clever movement scripts make it possible to add random movement loops to spawns. This is much better than completely stationary spawns, and the World is more alive. Random scripts are excellent as they are easy to set up, so a zone could (relatively) quickly be filled with moving mobs and NPCs.
  3. Unique individual movement patterns. Random patterns are great for speedy content development, but they have their limitations. You don't have 100% control of spawn movement, meaning that if the spawn is in close quarters it may walk into walls, rocks, water, etc. Random movement works best for spawns in large open areas, and less so for NPCs patrolling cities or spawns maneuvring down narrow tunnels etc. The alternative to random movements is to set up unique individual movement paths for each spawn. This is great as it gives a lot of control of the spawn's movements and its possible to mimic exact movement patterns gathered from the Live game (i.e. make a 'true' copy of Live). The draw back is that it takes a LOT of time and is VERY tideous. Be aware that it is also possible to combine these last two options and have randomness added to otherwise defined movement patterns, but that is for another guide.
As I said all these options have merit as they all make the World playable at different levels of 'polish'. I could easily see a scenario, where all zones goes through all phases (stationary spawns, random movement patterns and finally the last polish with unique individual movement patterns).

Personally I am almost exclusively working with the last option and slowly going through zones at a slow speed adding unique individual movement patterns to all moving spawns.

This is my guide to how I work:

Step 4 | The Movement Loop Generator 2.0

You will want to download this nifty parser. This parser will not only read your log files (from Live), it will also turn those parses into a spawn movement lua script! This is not only nice and fast - it also allows for code illiterates (like myself) to actually do serious content work.

Simply follow the instructions from the above forum post and get ready to head over to the Live server to collect some movement patterns.

Notice the '/loc_delay 5' command - this one is extremely useful for marking where the spawn stops for a break. Just add it to the hotbar next to /loc and hit it just before you hit /loc whenever the spawn pauses.

Step 5 | Collect spawn movement patterns from Live

Now its time to collect some movement patterns. Log onto a Live server and head to the relevant zone. Find an area that is a good starting point and sit down and simply observe. Count how many spawns are in the area, find out if any of them are grouped. Are they place holders for other types of spawns (e.g. rats, snakes, deers, etc.) Time how long their movement pauses are if they stop from time to time (its most likely different each time, so time it a few times to get an idea of min/max values). How long time does it take for them to respawn. Do they wear different equipment, etc. Everything you feel is important info to be able to replicate the scenario.

When you feel you have a good idea of everything (remember to keep notes - saves you time believe me) its time to track some patterns.

Select a spawn and type: /loc_start <name> (e.g. sewerrat_001 - something that is relevant and easy to remember). This is a flag for the parser to tell it that it should look for locations in your log from this point (don't mind that the game tells you that the command doesn't work). If you have not done so already remember to tell the game to log your chat channels (/log)!

Wait for the spawn to pause (if it pauses) in a good location (one that you can remember since most spawns will walk in a loop and eventually return to this location, and when that happens you will use '/loc_stop' to indicate that the pattern loop is complete) and hit the '/delay' hotkey and the '/loc' hotkey. That way you have assigned this point as the spawns first location in your future movement script, and you have also asked it to start with a pause - like most spawns do when they respawn on Live (but don't worry, you can always change this later if you change your mind).

Now you simply follow the spawn. Each time it changes course you hit '/loc' at this point (unless its following a clearly defined road it is not important that you hit it in the exact spot, just try to get as close as possible - no one will notice the difference unless you are way off. This becomes easier with practise). If the spawn pauses, stand on top of it (if possible) and hit the '/delay' followed by the '/loc' hotkey.

Continue doing this until the spawn completes it's loop and then end the collection process ('/loc_stop').

I usually collect all the patterns I need from an entire area before I start the parse/script creation process. Its just more efficient for me, but find your own routine.

Step 6 | Pattern variation

When you have studied a few movement patterns on Live you will notice that unless its a patrolling NPC, each time you kill a spawn it will most likely respawn in a slightly different location and use a different movement pattern than before. At first you may think its all random and each new spawn is assigned a new random pattern when it spawns, but after careful observation and a LOT of collecting patterns you will begin to notice that patterns will sometimes be repeated. My personal opinion is that they have a list of predefined patterns for each spawn location on Live and this is actually good as this adds variation to the World.

So how do I handle this for the EMU? Its tedious enough to collect patterns in the first place, so it would be a lot to ask people to sit and collect all possible patterns for a location, so I came up with an alternative - a system that allows for just enough variation to make an area appear to have pattern variation (like Live), but at the same time not make Content Devs insane after a few days. This is my system:

If an area has just 1 or 2 spawns (e.g. snakes) and its not a place holder of another spawn type (e.g. its not a place holder for rats or something), then I collect 3 different patterns for each spawn location (if there are 2 spawns up at any time I collect 6 sets of patterns - 3 for each).

If the spawn is a place holder I will collect 1 set of patterns from each spawn type (e.g. snake, rat, etc) - maybe 2 sets if there are only 2 different spawn types).

If the spawn location has a group that respawns in several different setups (e.g. 2-4 group members each time and they are in slightly different coordinates each time) I will typically collect locations of each possible setup (maybe 4-5 different sets total - or more if they vary a lot).

As you can see I have a general rule of thumb, but not a concrete plan when I make a strategy for a particular spawn area. The main idea is to cover most variations from Live and make it appear to players that they are experiencing a true copy, when in fact they are only experience a less detailed version. They will be well on their merry way before they notice any difference to Live, but there will still be just enough variance that they will not discover the 'illusion' over time (which might happen if the spawn in an area always follows the exact same pattern).

Step 7 | Create spawn movement scripts

After you have completed your collecting session it is time to parse your log and make the scripts. Start up the Movement Loop Generator, select 'Browse' and navigate to your Log folder (in the folder that EQ2 is installed in), select the right character log file, and the tool will list all the collected patterns. Double click one of the patterns and it will be shown as a finished script in the main area of the Tool. Make any edits you may want to do at this point (I usually don't) and click 'Save'. The script will now be saved as a lua-file in the directory where the Tool is located. I have the Tool on my desktop, so all the files are saved there for easy access.

Trouble shoot: sometimes a pattern will not work (nothing will show in the main field of the tool). Most likely this is because you have miss spelled a command (e.g. /loc-start instead of /loc_start). I have had luck with opening the /log file (use Notepad++ for this if the file is large - its a free download) and find the specific pattern in the log file. Copy it to another text file and parse this one instead - this sometimes fixes the problem or makes trouble shooting easier.

Step 8 | Assign scripts to spawns

Open 'EQ2Emulator Database Editor 1.5' and click the Spawns tab. Select the relevant zone, select NPC and the spawn type you want to assign a script to.

Open the lua script with the movement pattern you want to assign to a spawn. Now it becomes a bit tricky as you need to find a spawn that you can assign the script to. I usually use the following steps:
  1. Log onto the EMU server and go to the area you wish to add the spawn to. If you are lucky then there is already a spawn of the correct type in the correct area that may still be stationary. Target the spawn and type '/spawn details'. Note down the Spawn Location ID. This is a prime candiate for the spawn you could assign the script to. Make sure its not a part of a group (unless you want it to be).
  2. If there are no relevant spawns in the area on the EMU server, you can either spawn a new spawn directly in game ('/spawn <ID#>' - remember to save it to the DB: /spawn add new <name> (e.g.: ThievesWay_ASewerSlime) - or you can spawn one by using Migrate Zone (Admin tab in the DB Editor). This is a list of spawns that have been collected from Live but for various reasons they are not spawned on the EMU server. I usually look for one that has coordinates that are similar to the coordinates in the pattern I have collected as this usually creates less work (the Grid thing - see below), but this is not necessary. Just make sure its not in a group (unless you intend for it to be). NOTE: make sure to note down the spawn_location_id before you click spawn!
When you have found your spawn, click the Location tab in the DB Editor. Find your spawn (by using the spawn_location_id number) and update the x,y,z coordinates. I usually use the coordinates from my collected pattern, just use the first line in the movement loop. This will be your spawn's starting location when it spawns.

Click the script tab. I usually type in spawn_id in the first field next to 'new' in the table and update the lua_script field (e.g. SpawnScripts/QueensColony/areefturtle427247.lua) Remember to use the correct folder for the script and give the script name a relevant and easily identifiable name.

Click insert.

Before you do anything else click edit next to the new script and click 'create' at the very bottom - the script is not created until you do this.

Now you can copy the script from your lua file and simply paste everything in here (just replace the default script code in the new script with your movement script from the parser) and click save.

The last (but important) thing to do is to assign the script to your spawn. Click the Script tab again and find your new script. Click the drop down in the spawn_location_id column and find the correct spawn. Click update. If you do not do this all spawns in the zone of the same spawn type will use your script and before you know it your area will be full of spawns moving about. I found out about this the hard way (long story...)

Step 9 | Verify the movement pattern

Head over to the EMU server to observe your new creation! Type '/reload spawnscripts' and '/reload spawns' (you may have found out by now that option changes are not persistent on the EMU server, but macros are! Do yourself a favour and macro these commands as you will use them a LOT.

If you have done everything right you will have a nice spawn moving around in a nice loop - exactly as you intended it to do. Sit back and congratulate yourself for a job well done and head to the fridge for a nice cold beer...

...or it goes as it too often does... Unfortunately the Ghost in the server tends to make things hard for us. Verifying a movement script is sometimes the most time consuming part of the entire process!

If you feel that your spawn's movements are off somehow you may have to go back and correct the script. For example try to change troublesome coordinates until you are happy with the result. And sometimes the original patterns from Live are just crazy - feel free to correct that for a more believable experience. Remember that if you don't do this now it may never be done, so be patient and thorough.

When the spawn's movement is as perfect as can be its time to add the correct pause lenghts. This is where the time measuring from Live comes in handy - you did remember to do that right? :-) Else you can always go back and do it now.

From the parser your line may be something like this:

Code: Select all

MovementLoopAddLocation(NPC, -67.14, -14.81, 264.85, 2, 5)
Now change the last 5 using the math.random function:

Code: Select all

MovementLoopAddLocation(NPC, -67.14, -14.81, 264.85, 2, math.random(10, 20))
In this example the spawn will pause for a random number of seconds between 10 and 20 seconds (before you changed that it would simply pause for 5 seconds each time, which was nice for verifying the pattern, but not what you want the end result to be like). Just time a lot of spawn pauses on Live and note down the minimum and maximum pause lenghts and use those.

Step 10 | The Grid!

Every zone is divided up into grids. You can find the grid number of any location of a zone by using: '/grid' (again macro it!).

If the entire area the spawn will move around in has the same grid number you are golden. Just make sure that the correct grid number is listed for the spawn in the Location tab in the DB Editor and everything is fine.

If the spawn crosses a grid line you have to define the grid number change in the script. This can be done this way:

Add this to the end of your script (remember to update the grid numbers to the relevant numbers) :

Code: Select all

--------------------------------------------------------------------------------------
--			NPC Change Grid
--------------------------------------------------------------------------------------

function changegrid_Going_Up(NPC)
	SetGridID(NPC, 667331216)
end

function changegrid_Going_Down(NPC)
	SetGridID(NPC, 3049532766)
end
You can figure out exactly at what coordinate the grid line is by using /grid. Note down this coordinate (its usually either the x or z coordinate).

Look at your script and find exactly where the spawn will move across the grid line. Every time this will happen either add:

Code: Select all

"changegrid_Going_Down"
or

Code: Select all

"changegrid_Going_Up"
to the end of the relevant line (I add it to the line that makes the spawn move across the grid line) :

Code: Select all

MovementLoopAddLocation(NPC, -180.11, 0.17, 169.26, 2, 0, "changegrid_Going_Down")
or

Code: Select all

MovementLoopAddLocation(NPC, -179.71, 0.17, 172.33, 2, math.random(12, 22), "changegrid_Going_Up")
If you don't do this the spawn may behave in strange ways (usually it will flicker in and out of view suddenly).

Step 11 | Group Association

If you used my method for movement pattern variation you may end up with several spawns with their own unique movement pattern in the same area, and you may only want one (or more depending on how many were present on Live) of them to be up at any given time, you now want to use Group Association to create a spawn rotation (basically a Place Holder setup).

This can be done for single spawns or for groups, or even for a mix of both. You will first have to assign the spawns to a group (even if its a single spawn only) and then associate each group:

Target each spawn in turn and use the following command: /spawn group create <name> (e.g. TW002_ASewerSlime392028) - each with a different name. Each group will then be assigned a group id.

When all groups have been set up, note down the group id of the first spawn. Then type: /spawn group associate <Group ID of first group/solo spawn> and use this command on all the groups you want to associate with the first spawn. Finally hit /reload spawn and violá! Now only one of the spawn groups will be up at any given time. Hit '/reload spawn' a few times and see how it rotates.

The beauty of group spawn associate is that it allows for individual movement patterns for each member of the association. If this is not necessary (e.g. you have two (or more) stationary spawns that just rotate), you can use spawn combine:

Target each spawn and use '/spawn combine add' on each of them. Then target the combine and type: /spawn combine save <name> (name being something that is relevant). Again hit /reload spawn and if you have followed the instruction you have created a stationary place holder rotation.

Step 12 | Insanity

Using my method is VERY tedious and if you are not careful you are set for early retirement with an unhealthy portion of insanity. Make small short term goals and be happy with small victories (Yay! Finally that Trigger Fish worked as intended!). Take breaks when needed. Vary your work by exploring other areas of content develeopment (e.g. quests), etc.

Remember to see content work as a jigsaw puzzle. Everything you do is just part of a much bigger picture - but that one piece you just added to the full picture is a real and worthwhile addition to the whole that we don't have to redo (if done properly ;-) ).

Note: This guide only scratches the surface of Spawn Content work, but everyone can learn to do these simple (although tideous) steps and make a significant contribution to the project.

When you run into special situations, don't be afraid to ask questions on the forums or Discord.
Image

Somboo
Team Member
Posts: 5
Joined: Tue Jun 19, 2018 6:48 pm

Re: Rylec's Spawn Movement Guide

Post by Somboo » Tue Nov 26, 2019 8:48 am

Nice guide! Keep up the great work Rylec!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest