LAN gameplay

I’m about to tackle adding multiplayer to a simple 2D tank game, which will hopefully run on 4 different PCs at the same time. Does anybody have any suggestions for tutorials or places to start, where I won’t be sifting through lots of unnecessary information about internet servers and complicated networking techniques, considering I only want the game to work on LAN?

Or is LAN no different, in which case I should just start at square 1 with the available networking tutorials?

Thanks.

edit: I am also trying to figure out how to add a projectile function to a player object (ex. spacebar=shoot gun). I’m using the tutorial scripts. I’m trying to do this by altering Lerpz’s punch attack. My specific question is, within the following script, where does it define that Lerpz’s punch attack is spherical, and how would I make it long and box shaped? (effectively making it like a ray gun)

ThirdPersonCharacterAttack:

var punchSpeed = 1;
var punchHitTime = 0.2;
var punchTime = 0.4;
var punchPosition = new Vector3 (0, 0, 0.8);
var punchRadius = 1.3;
var punchHitPoints = 1;

var punchSound : AudioClip;

private var busy = false;

function Start ()
{
animation[“punch”].speed = punchSpeed;
}

function Update ()
{
var controller : ThirdPersonController = GetComponent(ThirdPersonController);
if(!busy Input.GetButtonDown (“Fire1”) controller.IsGroundedWithTimeout() !controller.IsMoving())
{
SendMessage (“DidPunch”);
busy = true;
}
}

function DidPunch ()
{
animation.CrossFadeQueued(“punch”, 0.1, QueueMode.PlayNow);
yield WaitForSeconds(punchHitTime);
var pos = transform.TransformPoint(punchPosition);
var enemies : GameObject[ ] = GameObject.FindGameObjectsWithTag(“Enemy”);

for (var go : GameObject in enemies)
{
var enemy = go.GetComponent(EnemyDamage);
if (enemy == null)
continue;

if (Vector3.Distance(enemy.transform.position, pos) < punchRadius)
{
enemy.SendMessage(“ApplyDamage”, punchHitPoints);
// Play sound.
if (punchSound)
audio.PlayOneShot(punchSound);
}
}
yield WaitForSeconds(punchTime - punchHitTime);
busy = false;
}

function OnDrawGizmosSelected ()
{
Gizmos.color = Color.yellow;
Gizmos.DrawWireSphere (transform.TransformPoint(punchPosition), punchRadius);
}

@script RequireComponent(AudioSource)

I feel like I understand this script, but I’m missing where the gizmo was defined as spherical.

Or perhaps there is a better way to have a character “shoot”. Can somebody help me?

Thanks

To make a object shoot a projectile … add a script like this to the object …

var theProjectile : transform;

function FixedUpdate(){
    if(Input.GetKey(KeyCode.Space)){
         var bullet = Instantiate(theProjectile, transform.position + Vector3(0, 0, 1), Quaternion.identity);
         bullet.rigidbody.AddForce(Vector3.forward * 100, ForceMode.VelocityChange);
    }
}

Hope i didnt forget nothing. Note , you would need a rigidBody attached to the gameObject.

this helps a lot thank you

The punch attack is sending a message. Which means another script is receiving it.

For all intents and purposes, LAN multiplayer requires the same amount of work to implement as Internet multiplayer.