Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


menyo

Member Since 09 May 2010
Offline Last Active Today, 05:13 AM

Posts I've Made

In Topic: [Mobile] Controls for 2D space combat?

11 March 2015 - 12:35 PM

Hmm... That's more difficult then, I feel.

 

I'm not really an expert in this field, so I may bow out of the thread at some stage.

 

However, for now: are you targeting 'phones or tablets? I ask because this affects the amount of screen-space available for touch-controls, and perhaps how the user is likely to be holding the device and thus what controls are likely to be comfortable.

 

Well, i'd like to target pretty much all mobile touch devices but I probably have to go with the larger phones and up since yeah, screen space. The orientation of the device will be based on what is practical, with some kind of virtual analog stick the most practical seems to be landscape orientated.

 

Currently I'm experimenting with basic click movement, locking on a target and fire weapons. This is practical but not really how i'd like the gameplay to be and if I want to have somekind of turning mechanism then the play cannot really control these turns.

 

It pretty much appears this is to much to ask from a mobile device but I'm still open for suggestions.


In Topic: [Mobile] Controls for 2D space combat?

06 March 2015 - 04:51 AM

Sorry, forgot to mention the maps where free to roam. It's not going to be 100% linear so I have to implement rotation and speed.


In Topic: first players problem with 1vs1 network game.

22 January 2015 - 01:11 AM

Can you give me an example of what your definition of friend discovery? I mean how should this work? Just a button to post on your wall?

In Topic: first players problem with 1vs1 network game.

21 January 2015 - 08:52 AM

It is a basic turn based board game. Adding AI is going to be problematic, it will take a ton of code to make it interesting and even then it is probably easy to beat it once you get to know the pattern.

Yeah I need to implement google play services and Facebook sdk so people can find eachother more easy.

In Topic: Turn based multiplayer game

19 January 2015 - 09:32 AM

So with the knowledge gained above I started fiddling around and am wondering if this is a proper way of doing it. The server player and the client can in turn press a button that get registered by the server. It possibly also works with many clients but not tested that yet. Everything coded within the if (myTurn) statement is only executed when it really is the clients turn. Everything outside still works.

 

Still wondering if this is a good approach. Would love to have some feedback.

	//server fields
	private NetworkPlayer player;
	private NetworkPlayer[] playerPool;
	private int currentPlayer;

	//player fields
	private bool myTurn = false;


	// Use this for initialization
	void Start () {
		player = Network.player;

		if (Network.isServer)
		{
			playerPool = new NetworkPlayer[Network.connections.GetLength(0) + 1];
			playerPool[0] = player; //Adds server player to the pool
			//Put all clients in the pool
			for (int i = 0; i < Network.connections.GetLength(0); i++)
			{
				playerPool[i + 1] = Network.connections[i];
			}
			//give someone the first turn
			currentPlayer = Random.Range(0, playerPool.GetLength(0) - 1);
			networkView.RPC("GiveTurn", RPCMode.All, playerPool[currentPlayer]);

			//list players in pool
			foreach (NetworkPlayer p in playerPool)
			{
				Debug.Log("Player (" + p.ToString() + ") added to pool");
			}
		}
	}

	void Update () 
	{
		if (myTurn)
		{
			if (Input.GetMouseButtonDown(0))
			{
				if (Network.isServer)
				{
					EndTurn();
					myTurn = false;
				}
				else
				{
					networkView.RPC("EndTurn", RPCMode.Server);
					myTurn = false;
				}
			}
		}
	}

	[RPC]
	private void GiveTurn(NetworkPlayer player)
	{
		if (Network.player.ToString() == player.ToString())
			myTurn = true;
		Debug.Log("Player (" + player.ToString() + ") is ready to act.");
	}

	[RPC]
	private void EndTurn(NetworkMessageInfo info)
	{
		Debug.Log("Player (" + info.sender.ToString() + ") ended his turn.");
		currentPlayer++;
		if (currentPlayer >= playerPool.GetLength(0))
			currentPlayer = 0;
		Debug.Log(currentPlayer + ", " + playerPool.GetLength(0));
		networkView.RPC("GiveTurn", RPCMode.All, playerPool[currentPlayer]);
		
	}
	private void EndTurn()
	{
		Debug.Log("Player (" + Network.player.ToString() + ") ended his turn.");
		currentPlayer++;
		if (currentPlayer >= playerPool.GetLength(0))
			currentPlayer = 0;
		networkView.RPC("GiveTurn", RPCMode.All, playerPool[currentPlayer]);
	}

PARTNERS