Multiplayer on the SAME Computer/Device?

Like in some games i played on Android google play store,1941:Frozen Front and 1942:Pacific Front, you can play a 2 player mode there but on the same device, was just wondering how can i do that also in my game? :slight_smile:

Two players in the same device is the same as one player, but with more controls (or conditioned ones), for example two players in Sonic 2/3 just use extra controls to move Tails (just one camera), a racing game will surely use two cameras, each one following an object.
There is an example in the examples folder called “3DRacingGame2Players.gdg”, it has two cameras with a proper render zone, and controls for two players :wink:

If you need help with something more specific, just ask here :slight_smile:

Thx :slight_smile: ,Ok i think i’m beggining to understand the 2 player on 1 device thing and the turns,but theres another thing i don’t understand much how can i make units have armor types, like when a Soldier attacks a Tank it would surely deal very low damage,because the armor type of the Tank is Heavy and the attack type of the soldier is Bullets,would doing those things be hard for a newbie like me? and also another question do i need to create like alot of variables to handle alot of units,or do i only need to create some?, like a variable named “Ground_Force” it would handle all ground units in the game and a variable named “Air_Units” would handle all air units in the game,would that work? or is there another way? thx in advance :smiley:

There are surely a lot of ways to do it, for example add two object variables (variables inside each object) for each unit type, one called “DamageType” and other “ArmorType”, of course set them with the unit damage/armor types.
Finally, at damage step, compare the values (maybe you’ll have to save the damage and armor type in temporary variables, because GD can get the variables from two different object of the same kind in the same event):

[code]Condition: If “DamageType” = “Bullet”
…Condition: If “ArmorType” = “Heavy”
…Action: Do Variable(Damage)*0.3 to the variable Damage

…Condition: If “ArmorType” = “Light”
…Action: Do Variable(Damage)*1.5 to the variable Damage

Condition: If “DamageType” = “Missile”
…Condition: If “ArmorType” = “Heavy”
…Action: Do Variable(Damage)*1 to the variable Damage

…Condition: If “ArmorType” = “Light”
…Action: Do Variable(Damage)*0.5 to the variable Damage[/code]
This way you modify the damage in function of the damage and armor types :wink:

You don’t need variables for handle objects, the variables containing objects are used internally by GD, and you get the objects from the conditions/actions related to objects (GD makes all the iterations, selections, memory management, all the hard work for you) :smiley:
If you want to work with multiple type of objects of different kind you can use object groups, for example you can make an object group “Air_Units” and attach all air unit objects (Airplane, Jet, etc.) :slight_smile:

  • Yes, it will be extremely hard. But you can do it after some months of learning.
  • You need to understand how variables works in GD. Read the wiki, study the examples.
  • You’ll need to use lots of variables for each unit.
  • You will have to declare them recursively:
    [list][*]Every time you load a unit .
  • As object’s variables.
  • At runtime.
    [/:m]
    [
    ]Once you understand variables you can handle the damage/armor stuff in them. [/*:m][/list:u]

For example: the value (quantity) of “damage” a soldier can do is, erhmmm… 3 and the value of “armor” of the tank is 2; then you can apply this formula (or any other formula you design):

Then the quantity of damage a soldier can inflict to a tank is 1. Now, let’s suppose the “damage” value of a tank is 5:

In this example, the quantity of “damage” a tank can do to another tank is 3.

And then how will he manage the target, rute, IA data, energy, lives and whatever another kind of data it will be needed for EACH unit?

Maybe I didn’t explain it very well, GD select the object for you (makes the iterations and selection) from others condition you set in the events, far away from the real C++ variables and iterations :slight_smile:

Yes it does.

Now, without the use of custom variables, as you suggest before, how will he manage the target, rute, IA data, energy, lives and whatever another kind of data it will be needed for EACH unit?

Well… that’s extremely comfortable,i thought i needed to do alot of variables and variable indexes like what i do in Warcraft 3(to make custom missiles/projectiles), now the only things that will probably be hard for me is the Sprites,campaign/story scenes ,but i think i can manage that :slight_smile:,.Thx guys for all of your help :smiley:

Calm down :slight_smile: , I never said that he shouldn’t use custom variables, one of the first things I said was “add two object variables (variables inside each object) for each unit type, one called DamageType and other ArmorType”.
I just said that he doesn’t need variables to store objects, he wrote something like:

Do you get it? I was explaining that you don’t need array variables or vectors to store the objects (wow, we are going too far from the topic :laughing: )

I’m not sure the user that creates this post understand that, in that way. Technicaly it’s true, you don’t need to store objects in an array, but it’s necessary to keep an index in each object to identify it, like in a sort of array. Also, it’s necessary store some data in custom object’s variables.

See? I’m not sure if we can say it’s not necessary to keep variable indexes and data. For example, if you have an enemy unit touching 2 user units (and let’s suppose that means loose some unit’s “life”) you need to know the index of that units to perform a coherent reaction. GD is easy, compared to other options, but you CAN’T skip some kind of algorithm and data structure “programming” if you want some advanced gameplay features. Like multiple units in a campaign style gameplay, like a tower defense or tactic game.

That’s what I’m saying. Everything cool :wink:

:question: So i’ll just clarify things, so variables/arrays or indexes aren’t needed in GD?,and btw i’m making a war map with ALOT of units, so those variables/arrays/indexes will not be needed? or will those be needed?

You can use an object variable to store an unit’s health. With object’s variables, each units can have its “health” variable for example.

So if there is an object named “Tank” and there is more than 2 of those same objects in the game,it will still work? :confused:

Yes, each unit instance will have his own variable (actions and conditions for object’s variables are in > All Objects > Variables not in > Variables)

Each unit need it’s own “health variable”, in fact each unit need it’s own complete set of variables to manage all the “unit data” your game requires. And well, as you don’t know the exact number of units you’ll use during a campaign (that number change constantly, new user/enemy units being created or being killed at any moment) you’ll need to create this units along with its own set of variables during the gameplay. That’s what you need to do for the type of game you’re planning.

And think economical! Example: If every thank has the same “armor” value, then you only need 1 global-variable to store that value (let’s call it, ehrmmm… thank_armor). But for values that change with each unit, for example health, you need an object-variable in each unit containing the specific health value.

GD manages variables in a very particular way; but what you need to understand by now is there are:

  • Global variables
  • Scene variables (or just variables)
  • Object variables

And yes! For the type of game you’re planning you’ll need LOTS of variables more than the few ones you need to make a new weapon in Warcraft 3. Warcraft 3 it’s an already-do game. You just fill some fields and tell warcraft how to manage that new object. But here you’re creating a game from scratch… how many variables do you think will be needed to create an entire tactical game? The answer is a HUGE quantity of variables and algorithms expressed like events and actions. I don’t know why nobody here want to tell you that. Maybe they think you’ll run away but I know you don’t because you’ll not find a more easy way to create videogames and because the little effort is worthy.

SO PLEASE! Read the wiki and absolutely every tutorial that exists about GD, see videos, study the examples that comes with your copy of GD. You’re getting confused trying to understand everything from the forums. Learn the basics from the tutorials and the examples.

GDevelop the more easy way to make games, but it still don’t read your mind :wink:

Well yeah i already got that,i just put a variable in the object called “Unit_Health” and i set its initial value to 250 and i also made a object variable called “Unit_Attack” then i make global variables like “Attack_Bullets”,“Armor_Heavy”,“Attack_Explosion”. Though i have another question,what if i want to make a game similar to this game in this Video(one of my favorite games) will it be super easy,easy,hard or super hard? :neutral_face:

If you apply armor by doing unit attack - unit defense, you need to add a condition that the value is not below zero !

That game you mentioned is a very long and quite difficult project to implement louie. I would bet it was probably done by a small team rather than 1 person (although it’s perfectly possible for one person to do all that if they don’t mind spending lots of time).

Even a newbie like me could be able to do that? :neutral_face:

No.

Do a bunch of smaller projects first.