Jump to content
valentin2

Any questions about Arma 3

Recommended Posts

Hello guys,

First, I want to apologize for my english level, indeed, I'm a lil' frenchie you know !

I'm working on a "Sector Control" mission in WW2 RP (endless and multiplayer mission),

but i'm brand new in Arma3 development and I have some questions, I hope you guys, may answer.

 

1/ I'm working on a script to manage the slots access (to allow players to spawn with this slot, referring to their ID (slot will be linked with a military rank that allow access to some military supply).

My issue : the IDs database is a text file, and I would do this with a MySQL-like database.

Is it possible ? (Is there addons with an example of connexion and SQL query call ? (I know pretty well the SQL part, it will not be an issue for me).

Bonus : maybe a tuto for a graphic interface with an admin-only access ?

2/ Zeus : Is it possible for more than on person at time to be Zeus ?

3/ Manage AI : I'm using "ModuleSpawnIA" to automaticaly spawn AI to run the Objective. I can't control AI by using Zeus. Do you know why ?

Is it possible to do it ? And is it possible to disable AI spawn with a command, if I want, even if the mission is still running ?

 

Thank you for your help, If you have questions, please don't hesitate !

 

Valoche

Share this post


Link to post
Share on other sites

Hello sarogahtyp, thank you for your answer.

 

1/ For the script to manage the slots access : I'll use extDB3 + OO_EXTDB3 whit Mysql ( first test is OK) (Thanks @code34). I'll use too GUI EDITOR for the interface ( thanks @minipopov and @code34)

 

2/ Multiple Zeus : No solution currently.

 

3/ Manage AI :

This code works pretty well:

	_newUnits = [];
	_oldUnits = [];
	while {true} do {
		sleep 5;
		_allUnits = allUnits + vehicles;
		_newUnits = _allUnits - _oldUnits;
		{
			_x addCuratorEditableObjects [_newUnits,true]
		} forEach AllCurators;
		_oldUnits =+ _newUnits;
	};

 

 

Share this post


Link to post
Share on other sites
1 hour ago, valentin2 said:

 

This code works pretty well:

 

 

I doubt this very much!

 

1. missing semicolon in forEach loop

2. whats your intention of this?

_oldUnits =+ _newUnits;

3. what is this?

_allUnits = allUnits + vehicule;

Share this post


Link to post
Share on other sites
17 minutes ago, sarogahtyp said:

I doubt this very much!

 

1. missing semicolon in forEach loop

2. whats your intention of this?


_oldUnits =+ _newUnits;

3. what is this?

_allUnits = allUnits + vehicles; (typing error)

 

1 : No

2 : Update the array with new units

3 : (typing error) Create an array with all units and all vehicule

https://community.bistudio.com/wiki/allUnits

https://community.bistudio.com/wiki/vehicles

Share this post


Link to post
Share on other sites

1. why not?

2. will not work. this =+ is not an operator for something like that. see aasignment operators:

Quote

Example 1:

a = b

You might think that this operator compares a and b, but that is not the case. = simply sets the left value to be the right one. There don't exist any other assignment operators like +=, -= etc., that can be found in other programming languages.

 

Also + is the worst assignment operator u can use. use append instead and take a look at code optimization.

 

Last thing is that you should try to shorten your arrays as much as possible. do you really need all weapons on ground in your array? you could use this to exclude those weapons:

_allUnits = allUnits
_allUnits append (vehicles - entities "WeaponHolderSimulated");
_newUnits = _allUnits - _oldUnits;

Also idk if you need all units and vehicles of all sides or maybe something like this is enough?

_allUnits = allUnits select {side _x isEqualTo west};
_allUnits append (vehicles - entities "WeaponHolderSimulated") select {side _x isEqualTo west};
_newUnits = _allUnits - _oldUnits;

but this is a thing which idk cause i ve no experience with zeus.

Share this post


Link to post
Share on other sites
13 hours ago, sarogahtyp said:

1. missing semicolon in forEach loop

semicolon not needed at end of code.

 

13 hours ago, sarogahtyp said:

2. whats your intention of this?

should be

_oldUnits append _newUnits

 

13 hours ago, sarogahtyp said:

3. what is this?

_allUnits = allUnits + vehicule;

combining allUnits and all vehicles. Into a array that has both.

 

12 hours ago, sarogahtyp said:

Also + is the worst assignment operator u can use. use append instead and take a look at code optimization.

Not in this case, no, you don't have a variable to append to anyway. + is the right thing to use here right in this case. (probably not elsewhere tho)

Btw + is not a assignment operator at all.

 

  • Haha 2

Share this post


Link to post
Share on other sites
8 hours ago, Dedmen said:

Not in this case, no, you don't have a variable to append to anyway. + is the right thing to use here right in this case. (probably not elsewhere tho)

Btw + is not a assignment operator at all.

wrong!

 

 

multiple times I tested this:

_cnt = 0; 

while {_cnt < 100} do 
{
 _cnt = _cnt + 1; 
 _array = vehicles + allUnits;
};

// 5.76 ms

against this:

_cnt = 0; 

while {_cnt < 100} do 
{
 _cnt = _cnt + 1; 
 _array = vehicles;
 _array append allUnits;
};

// 5.6 ms

allUnits had 200 elements and vehicles 100 elements during test

Share this post


Link to post
Share on other sites

And for multiple elements in sum like:

configClassesA + configClassesB + configClassesC + configClassesD ....

Is there a faster code with append?

Share this post


Link to post
Share on other sites
34 minutes ago, pierremgi said:

And for multiple elements in sum like:

configClassesA + configClassesB + configClassesC + configClassesD ....

Is there a faster code with append?

should be:

configClassesA append configClassesB;
configClassesA append configClassesC;
configClassesA append configClassesD;

but I didn't test.

Share this post


Link to post
Share on other sites
18 minutes ago, sarogahtyp said:

should be:


configClassesA append configClassesB;
configClassesA append configClassesC;
configClassesA append configClassesD;

but I didn't test.

append modifies original array.
Appending to a temporary and then throwing it away doesn't make much sense.

  • Confused 1

Share this post


Link to post
Share on other sites
4 minutes ago, Dedmen said:

append modifies original array.
Appending to a temporary and then throwing it away doesn't make much sense.

idk which code u read but I just appended B, C, D to A... no temporary thing here

Share this post


Link to post
Share on other sites
21 hours ago, sarogahtyp said:

wrong!

https://community.bistudio.com/wiki/Code_Optimisation#Make_it_readable

 

You got 0.1ms faster, at 100! runs. That's not enough to ever matter. So one could say they are equal.

And if something has equal performance I'd go for readability.

 

1 hour ago, sarogahtyp said:

idk which code u read but I just appended B, C, D to A... no temporary thing here 

I assumed SuicideKing just used the names as a placeholder for a configClasses command call, which returns a temporary.

Share this post


Link to post
Share on other sites
3 minutes ago, Dedmen said:

https://community.bistudio.com/wiki/Code_Optimisation#Make_it_readable

 

You got 0.1ms faster, at 100! runs. That's not enough to ever matter. So one could say they are equal.

And if something has equal performance I'd go for readability.

 

did u read the page u linked at any time? did u see the differences in execution times which r compared there?

any code which has a better performance as another one matters! there is no need to use slower methods if faster methods exist. it doesn't matter how tiny the difference is.

https://community.bistudio.com/wiki/Code_Optimisation#Adding_elements

it's also in the wiki already. why? because its equal???

Share this post


Link to post
Share on other sites
39 minutes ago, sarogahtyp said:

 

did u read the page u linked at any time? did u see the differences in execution times which r compared there?

any code which has a better performance as another one matters! there is no need to use slower methods if faster methods exist. it doesn't matter how tiny the difference is.

https://community.bistudio.com/wiki/Code_Optimisation#Adding_elements

it's also in the wiki already. why? because its equal???

Going from 5.6ms to 5.76ms isn't that big of a deal, especially if it's a one time only thing.

Performance matters much more if you run that stuff multiple times per frame or over huge data sets.

It's most likely a no brainer if a command is 2-3 times as fast (and most likely changing the approach will yield better performance improvements than comparing the speed of two different commands),

but for a 2-3% speed difference? Personal preference I guess.

 

Cheers

 

Share this post


Link to post
Share on other sites

To have multiple Zeuses place a Game Master module on the map for each Zeus slot. Give the units you wish to use as Zeus a name and add each name to the Owner bit of each Game Master module.

 

Keep in mind that for some reason players need to respawn after joining before they can use Zeus. At least that's what I have experienced so far.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, sarogahtyp said:

did u read the page u linked at any time?

I was there when the page was rewritten recently, I checked every entry on that page and tried to make sure that people won't try to make idiotic changes in their code just because "muh performance", that's why the "readability first" section was added.

 

3 hours ago, sarogahtyp said:

id u see the differences in execution times which r compared there?

Yes I saw the whopping 3 microseconds. That is about one 20 thousandth of a frame at 144hz. woah!
Totally not worth the readability change at all. Especially for something that runs once every 5 seconds.

 

Share this post


Link to post
Share on other sites

append, a word, is less readable than a + sign?

 

readability is a personal thing and performance measurement is a fact. I prefer the fact.

 

another fact is that flooding this thread with such semi offtopic posts is rude to op.

I apologize and try to be quite.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×