DrugCheese 0 Posted December 13, 2002 I've tried searching for this and didn't find anything. Hopefully I'm not cloning another thread, but it seems like everytime I use createUnit my game lags up for a millisecond. It's not a really big deal but at the same time it is a really big deal. I'm not sure if lag is the correct term, but each time the CreateUnit command runs my screen locks up for a split second. I have a unit on the map called 'commander' that I spawn officers into his group, then move him out and spawn the rest of the team grouping to the officer. I see the lag even with the first CreateUnit command even while the rest of the map is empty. Thought maybe because I was using the getMarkerPos each time so I put that position into the _bw variable but still same lag. I've removed all the arguments from the CreateUnit command too without any luck. When I spawn a whole squad at the same time it freezes for a couple seconds so I put a little wait between each one. But you still see that delay, anyone else experience this? Here's a couple lines that cause the lag. "OfficerW" createUnit [_bw, group commander, "Squad = this", .9, "LIEUTENANT"] [commander] join grpNull ~1 "SoldierWB" createUnit [_bw, group Squad, "", .8, "SERGEANT"] ~1 "SoldierWB" createUnit [_bw, group Squad, "", .8, "SERGEANT"] Any info would be greatly appreciated. Thanks - DC Share this post Link to post Share on other sites
hoz 0 Posted December 14, 2002 I get this too, not much you can do about it. Once the units are created the server needs to tell each of the clients about them. This all takes a sec. You could hide it in a cutscene or something Hoz Share this post Link to post Share on other sites
DrugCheese 0 Posted December 14, 2002 Well what I'm trying to do is set up this battle for one of the larger cities on Nogova. I have triggers set up to detect how many people are on each side, and when that number drops below a certain level, spawn a new squad to go out and join the battle. That way I can have a very long, very drawn out battle with 1000's of soldiers on each side while only showing 80 or so soldiers on each side at a time in the city. What I want to do is set up 'tickets' for each side. And take away a ticket for each soldier that spawns. So I can have a battle for the city where we are outnumber 2-1 and and it takes all day to hold off the attack. I know what I want is barely ever what I'll get. Just wondering why it lags up like that and if it can be helped at all. Thanks hoz DC Share this post Link to post Share on other sites
KeyCat 131 Posted December 14, 2002 I've also noticed this and it is as bad in SP as MP so it has nothing to do with the server sending out info to clients. All we can hope is that BIS take notice and find a way to improve the createUnit command in a future patch. I'm crossing my fingers they do since it's a neat way to make dynamicly and resource low maps! /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
bn880 5 Posted December 14, 2002 Yes, I have also noticed this in SP. What happens is the game actually pauses until the unit is created/registered etc. (if that's the right terminology) It might have something to do with memory reallocation in windows. ? Share this post Link to post Share on other sites
DrugCheese 0 Posted December 15, 2002 Yea it definetly happens in SP since that's all I've used it for. BIS hear our cries! CreateUnit is the way to go for larger dynamic missions. Guess I'll have to put these I'm making on hold. Thanks for all the info guys DC p.s. Chain Of Command is Awesome! Share this post Link to post Share on other sites
ralphwiggum 6 Posted December 15, 2002 it's the problem with OFP, not with internet connection. as ppl noted above, it happens in OFP regardless of SP or MP. and the subject is well outside of my computer knowledge, but i'd go with dynamic allocation of memory, along with group of threads related to AIs cause slight jerking. on the other hand, createvehicle(at least in SP) does not cause lag. but soldiers do not have AIs(brains, if you will) Share this post Link to post Share on other sites
Doolittle 0 Posted December 15, 2002 Dumb question, but can you use createVehicle to create people? Â I remember using createVehicle to create Angelina. Heh, kinda reminds me of the old computing days when a game would slow down because it was loading a monster & my brother and I would always say, "uh oh! Boss monster coming up!" Yeah, the AI and thinking and all that is big as far as resources. Â I remember for Quake3 you could turn off all the AI stuff and it would load up faster, but you'd have to restart the entire game if you wanted to use bots. Here's a question: why not just create all the units you'll need, in the hundreds, and then load them all up in buses or something way off in the map somewhere??? Â I dunno, but I think anything that is in a vehicle is not checked for some AI stuff because the vehicle is now doing the movement, not the people inside, so maybe there's less data to transmit. Â So when you need a guy you just pull him outta the bus. Doolittle Share this post Link to post Share on other sites
bn880 5 Posted December 15, 2002 No, createVehicle will not create AI properly (not designed for it). At least when I tried in 1.85 it did not. Share this post Link to post Share on other sites
KeyCat 131 Posted December 15, 2002 Tested createUnit some more and noticed that the pause for me is not in the ms range, rather the sim freeze for approx. 1-2 sec and it dosn't seem to matter if I crate 1 or 12 units. Just providing more information in hope that BIS will be able to improve this neat script command. /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
bn880 5 Posted December 15, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (DrugCheese @ Dec. 14 2002,19:20)</td></tr><tr><td id="QUOTE">Yea it definetly happens in SP since that's all I've used it for. BIS hear our cries! CreateUnit is the way to go for larger dynamic missions.<span id='postcolor'> Take it easy with the cries, it's not that serious. I am sure BIS will be aware of this small issue, and then it will be in their hands. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE"> Guess I'll have to put these I'm making on hold.<span id='postcolor'> Up to you, this should help make your mind up: We have already created an extensive stand-alone system to do just what you plan on making at The Chain Of Command a few weeks ago. I don't know about releasing it yet though or if it will be released separatly, it has not been converted to 1.91, just 1.85 and the tutorial still has to be written. (ps: it's called EnemyStack) </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">p.s. Chain Of Command is Awesome!<span id='postcolor'> I happen to think so as well. --------------------------- For once you people have something you can call a bug, even if it might be caused by windows. hehhe Share this post Link to post Share on other sites
KeyCat 131 Posted December 15, 2002 bn888, EnemyStack sounds cool could you elaborate a bit? Does it creat enemy units at start of the mission and does it work in MP? As far as I have learned (still a newbie) the CreateUnit command combined with triggers is a neat way to build resource low missions for co-op play in MP and still face lots of enemies on the island since they are created dynamicly where you go. Love to learn more about EnemyStack and other tricks to make a dynamicly/random combat environment in OFP. BTW, I'm only in it for the multiplayer /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
bn880 5 Posted December 15, 2002 You will have to wait for the details, I just wanted to make sure the task is not un-necessairly repeated. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">BTW, I'm only in it for the multiplayer <span id='postcolor'> EnemyStack is currently in it's first stage, Single mission single player, conversion to MP should be no extreme problem and not excessively difficult. Share this post Link to post Share on other sites
bn880 5 Posted December 15, 2002 What EnemyStack will offer when it is released: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">[*] Refills desired enemy side groups according to mission designer preference and game play events. [*] Works on all sides (East, West, Guerilla and Civilian) even in one mission. [*] Low CPU load thanks to all features in 1.85 environment (handlers, sqf, ~). [*] Wide range of setup error checking and reporting for mission designer. [*] Tracks editor placed units and removes them if there are not enough available. [*] Keeps track of how many units are lost or vehicles lost/stolen during mission. [*] Balances out spawning of units according to the number of each unit type available. [*] Supports every side to have units from any other side available if needed. [*] Supports the addition of custom unit types i.e.: HoverCraft through DB change. [*] Supports 0-x number of spawn points for each unit type per every configured side. [*] Every spawn point is placed on map and minimum distance from enemy to every spawn point can be assigned. [*] Allows for the specification of enemy side(s) for every single side using EnemyStack i.e.: WEST,GUER can be enemy for EAST. [*] Tracks latest battle position and refills as close as possible according to spawn points given. [*] Support for custom initialization for every unit type spawned of every side using EnemyStack. [*] Capable of deleting soldiers that have been killed according to number of seconds specified. [*] AI skill for every unit type per side can be specified from minimum to maximum i.e.: 0.6 - 0.9. [*] Driver, Gunner, and Commander soldier types can be defined for each vehicle type in DB (no cargo). [*] Minimum % before replenishing enemy and maximum % before stopping replenishing enemy can be configured. [*] 0 to 63 Groups to be excluded from replenishment can be specified for each side. <span id='postcolor'> Although it will most likely not be released before Christmas. Share this post Link to post Share on other sites
KeyCat 131 Posted December 15, 2002 Looks awesome! Looking forward to try it out when you are done! Still hope BIS do their magic on the createUnit command tho /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
suma 8 Posted December 31, 2002 There are several things that may cause delays when using createUnit or createVehicle. I would expect some delay if you are creating a unit or vehicle with model that was not present in the mission before (like introducing Chinook in the mission where only infantry was initialy). The reason for the delay in such case is vehicle/soldier model and texture needs to be loaded from the disk. How long the delay will be depends on the computer configuration, drive fragmentation etc. Other than that, there should be no reason why createUnit should cause delays, and especially there should be no reason why should it cause more delay than createVehicle does. If someone has some reliable small repro case showing significant delays when using createUnit, feel free to post it here. Share this post Link to post Share on other sites
uiox 0 Posted December 31, 2002 When u create big mission with a lot of units the time for loading and play is not good after 400 units on my PC. BUT if you create 126 groups with one unit you don't have problem. So I use this script </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;[[E1,E2,E3,E4],100,2,10] exec "Respawn\RespawnUnits.sqs" ; [[array of your groups to respawn], number of total respawn, number mini of the group for start respawn, max number of the squad] _ArrayGroup = _This select 0 ? count _ArrayGroup  ==0 : exit _MaxOfRespawn = _This select 1 ;? _MaxOfRespawn == 0 : exit _MiniNumberForRespawn = _This select 2 ;?_MiniNumberForRespawn > 12 : exit _SquadDimension = _This select 3 ;? ((_SquadDimension > 12) or (_SquadDimension == 0)) : exit _CurrentNumberOfRespawn = 0 #LoopOfRespawn _i =0 #Ingroup ~.2 _NumberOfCreate = 1 #RespawnUnit ? count units ( _ArrayGroup select _i)  >= _SquadDimension : goto "SkipRespawn" _pos = getPos leader ( _ArrayGroup select _i) _dir = getDir  leader ( _ArrayGroup select _i) ~.5 _dist = -30 _x = (_pos select 0) + _dist * sin _dir _y = (_pos select 1) + _dist * cos _dir ;nobody globalchat format ["%1, %2,%3",_CurrentNumberOfRespawn,_ArrayGroup select _i, count units ( _ArrayGroup select _i) ] ? _NumberOfCreate ==1 : "SoldierEMG" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"] ? _NumberOfCreate ==2 : "SoldierELAW" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"] ? _NumberOfCreate ==3 : "SoldierEMedic" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"] ? _NumberOfCreate ==4 : "SoldierEG" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"] ? _NumberOfCreate > 4 : "SoldierEB" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"] NouvelleUnité addEventHandler ["Killed", "[_this select 0] exec ""Respawn\RemoveKill.sqs"""] _CurrentNumberOfRespawn = _CurrentNumberOfRespawn +1 ? _CurrentNumberOfRespawn >_MaxOfRespawn : exit _NumberOfCreate = _NumberOfCreate +1 ? count units ( _ArrayGroup select _i) < _SquadDimension : goto "RespawnUnit" #SkipRespawn _i = _i + 1 ? _i < count _ArrayGroup : goto "Ingroup" ? _CurrentNumberOfRespawn <_MaxOfRespawn : goto "LoopOfRespawn" <span id='postcolor'> When the script begins to run lag during 2/3 second after not. For me it's not a big problem. Something relate to create unit: rank (how know) and waypoint (addWP) with this I don't need precreate group... 2003 Share this post Link to post Share on other sites
KeyCat 131 Posted December 31, 2002 I've only used createUnit in the Nam mission I'm working on. Maybe it's something with the NamPack 2.0 VC/NVA units that are causing the delays? After the holiday I will try using regular RUS/US soldier and see whats happen. Now I'm off to celebrate with a big bottle of single malt! BTW, Happy New Year to all OFP'ers /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
bn880 5 Posted December 31, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (KeyCat @ Dec. 31 2002,11)</td></tr><tr><td id="QUOTE">I've only used createUnit in the Nam mission I'm working on. Maybe it's something with the NamPack 2.0 VC/NVA units that are causing the delays? After the holiday I will try using regular RUS/US soldier and see whats happen. Now I'm off to celebrate with a big bottle of single malt! BTW, Happy New Year to all OFP'ers <!--emo& /Christer (a.k.a KeyCat)<span id='postcolor'> Hi, I don't believe the NamPack is the issue itself, I think it is like Suma said, I experience larger pauses when my first units are spawned, later I notice the pauses can go away, completely inline with Suma's explanation. Knowing this will be useful for me and possibly CoC in the future. BTW: KeyCat, Happy New Year! I can't promise 100.00% but the Multiplayer capable EnemyStack should be released within 12 hours. Unless Life comes up with some problem. Share this post Link to post Share on other sites
KeyCat 131 Posted January 1, 2003 Did some testing and yes Suma is spot on in his explanation and it has nothing to do with the NamPack units. If I dynamicly create a group with units that are already present in the mission there are no pause at all. If I dynamicly create a mixed group with different soldiers (not previously present) I get the ~1-2 sec pause I been seeing and thats (- now -) fully understandable since the new models have to be loaded into memory from the HD. This concludes that the createUnit command works just fine! Sorry for stirring things up and "blaming" it on the createUnit command but it's an easy thing to do when you not fully understanding how things work A workaround to prevent any pause is to make sure all soldier types that can dynamicly be created exists at least once in the mission. bn880: Have downloaded your EnemyStack and will take a closer look at it as soon I get a chance. Thanks for making it MP capable and thanks once more for sharing it! Suma: You (hopefully) already know how much we all greatly appreciate your dedicated work with OFP but I also wanted to say thanks for going that extra mile jumping in explaining things like this to script newbies like myself! /Christer (a.k.a KeyCat) Share this post Link to post Share on other sites
Doolittle 0 Posted February 8, 2003 I am having problems with createUnit. Â How do you reference your unit once it is created? Â All I can think of is this: _pos = getPos player _group = group player Unit = [] "SoldierWB" createUnit [_pos, _group, "Unit = this"] Unit setCombatMode "RED" createUnit does not return an object like createVehicle does. Â Also, this line does not work: "SoldierWB" createUnit [_pos, _group, "this setCombatMode ""RED"""] What I am doing with createUnit is deleting units already on the map and then createUnitting them based on their old position and group whenever a player gets close to where they are. Â I am finding this causes problems in MP. Â Specifically, there is a burp with players, they desync, and that is bad. Â Then they slowly come back to normal. Â This happens even when spawning in "SolderEB" over and over, so it's not a graphics cache issue. I am trying to think of ways to fix this. Â I was hopping to use creatUnit to make maps with large amounts of enemies without lag issues. Â Some things I'd like to try: Does having buses full of enemies and then setPos them wherever you need them on the map when the player gets close reduce lag? Does having 12 soldiers, 1 soldier per group for 12 groups total, cause more/less lag than 12 soldiers in 1 group?? I am wanting to create some big missions but am finding that having say 2 areas where the players fight it out is best scenario. Â (Like attack 2 bases or free 2 cities or something with 2 seperate spots with enemies.) Â But trying to do more than that is not good. Â So even though the game can support 63 groups per side, it is really more around 20 or so, depending on how full each group is, when you start running into lag and desync. Does having your AI in trucks and stuff, and then having them disperse when the player is near, would that make lag less?? Â Perhaps that might work. Doolittle Share this post Link to post Share on other sites
Little Blue Assassin 0 Posted February 8, 2003 Yes, although I have recently learned that you can create units at markers using [getpos markerone,alphablack] I still have trouble with the "getpos" command. I mean, how do the coordinates work? Is 0,0 the center of the map or is it the lower left corner? Could someone clarify? Share this post Link to post Share on other sites