Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
MitiS1990

Кастомные локации.

Всем доброго...! Подскажите пожалуйста. Кастомные постройки могут нагружать процессор на стороне сервера? К примеру если их большое количество  по всей карте по не-многу! И как правильно их лучше всего добавлять на сервер, через init.c или с помощью каких то модификаций, что бы меньше создавалось нагрузки на сервер?!

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0
#include "$CurrentDir:mpmissions\dayzOffline.chernarusplus\CustomSpawnPlayerConfig\init_mod.c"
#include "$CurrentDir:mpmissions\dayzOffline.chernarusplus\Locations\Keycards_Buildings.c"
#include "$CurrentDir:mpmissions\dayzOffline.chernarusplus\Locations\CustomBridgePrison.c"
#include "$CurrentDir:mpmissions\dayzOffline.chernarusplus\spawnobject.c"

void main()
{
	
	SpawnTisyBuildings();
	SpawnNWAFBuildings();
	SpawnSkalistyBuildings();
	BridgePrison();
	PrisonStatic();
	SaveZone();
	TradersStatic();
	
	//INIT ECONOMY--------------------------------------
	Hive ce = CreateHive();
	if ( ce )
		ce.InitOffline();
	
// GetCEApi().ExportProxyData(Vector(7500, GetGame().SurfaceY(7500, 7500), 7500), 20000);

	//DATE RESET AFTER ECONOMY INIT-------------------------
	int year, month, day, hour, minute;
	int reset_month = 9, reset_day = 20;
	GetGame().GetWorld().GetDate(year, month, day, hour, minute);

	if ((month == reset_month) && (day < reset_day))
	{
		GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
	}
	else
	{
		if ((month == reset_month + 1) && (day > reset_day))
		{
			GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
		}
		else
		{
			if ((month < reset_month) || (month > reset_month + 1))
			{
				GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
			}
		}
	}
	
}

class CustomMission: MissionServer
{
	void SetRandomHealth(EntityAI itemEnt)
	{
		if ( itemEnt )
		{
			float rndHlt = Math.RandomFloat( 0.45, 0.65 );
			itemEnt.SetHealth01( "", "", rndHlt );
		}
	}

	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt;
		playerEnt = GetGame().CreatePlayer( identity, characterName, pos, 0, "NONE" );
		Class.CastTo( m_player, playerEnt );

		GetGame().SelectPlayer( identity, m_player );

		return m_player;
	}

	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		EntityAI itemClothing;
		EntityAI itemEnt;
		ItemBase itemBs;
		float rand;

		itemClothing = player.FindAttachmentBySlotName( "Body" );
		if ( itemClothing )
		{
			SetRandomHealth( itemClothing );
			
			itemEnt = itemClothing.GetInventory().CreateInInventory( "BandageDressing" );
			if ( Class.CastTo( itemBs, itemEnt ) )
				itemBs.SetQuantity( 2 );

			string chemlightArray[] = { "Chemlight_White", "Chemlight_Yellow", "Chemlight_Green", "Chemlight_Red" };
			int rndIndex = Math.RandomInt( 0, 4 );
			itemEnt = itemClothing.GetInventory().CreateInInventory( chemlightArray[rndIndex] );
			SetRandomHealth( itemEnt );

			rand = Math.RandomFloatInclusive( 0.0, 1.0 );
			if ( rand < 0.35 )
				itemEnt = player.GetInventory().CreateInInventory( "Apple" );
			else if ( rand > 0.65 )
				itemEnt = player.GetInventory().CreateInInventory( "Pear" );
			else
				itemEnt = player.GetInventory().CreateInInventory( "Plum" );

			SetRandomHealth( itemEnt );
		}
		
		itemClothing = player.FindAttachmentBySlotName( "Legs" );
		if ( itemClothing )
			SetRandomHealth( itemClothing );
		
		itemClothing = player.FindAttachmentBySlotName( "Feet" );
	}
};

Mission CreateCustomMission(string path)
{
	return new CustomMission();
}

На данный момент у меня прописано так в init!
К нему привязан этот, отдельным файлом .c

//Spawn helper function
void SpawnObject( string objectName, vector position, vector orientation )
{
    Object obj;
    obj = Object.Cast(GetGame().CreateObject(objectName, "0 0 0"));
    obj.SetPosition( position );
    obj.SetOrientation( orientation );

    // Force update collisions
    if ( obj.CanAffectPathgraph() )
    {
        obj.SetAffectPathgraph( true, false );
        GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( GetGame().UpdatePathgraphRegionByObject, 100, false, obj );
    }
}

 

Share this post


Link to post
Share on other sites



  • 0

Лучше всего пользоваться DayZ Editor Loader который подгружает файлы формата .dze. Он грузит постройки только тогда, когда игрок приближается к ним

Share this post


Link to post
Share on other sites
  • 0

@ZizionarD Через инит так же. подгружает при приближении. 
Максимум подключал около 10к объектов разными файлами, просадок фпс не было.  

Share this post


Link to post
Share on other sites
  • 0
1 час назад, Horus сказал:

@ZizionarD Через инит так же. подгружает при приближении. 
Максимум подключал около 10к объектов разными файлами, просадок фпс не было.  

Тогда вообще никаких проблем не должно быть с нагрузкой)

Share this post


Link to post
Share on other sites
  • 0

Скажите, а разве никаких подводных камней с редактированием init.c нет? Я настроил у себя все, но тут в один момент стим обновил клиента, и init.c стал по дефолту. Использую server monitor для запуска сервера. 

Share this post


Link to post
Share on other sites
  • 0

...вас расстрелять надо. Из рогатки. Крупнокалиберной. Дробью,а потом картечью.
Папка сервера дэйза не должна лежать в папке стима. И будет вам счастье с обновами, но не будет головной боли с патчами.

Share this post


Link to post
Share on other sites
  • 0
7 минут назад, paranoyk сказал:

...вас расстрелять надо. Из рогатки. Крупнокалиберной. Дробью,а потом картечью.
Папка сервера дэйза не должна лежать в папке стима. И будет вам счастье с обновами, но не будет головной боли с патчами.

 

Не надо меня стрелять, может пригожусь еще кому? Прошу, если есть желание и возможность помочь, буду в соседней теме, "init.c модификация". 

Share this post


Link to post
Share on other sites
  • 0

@ZizionarD @Horus Понял! Ну у меня были предположения что меня обманывают, что маппинг сильно жрёт фпс!) Спасибо за уточнение.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.