Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - David

Pages: [1]
1
TNet 3 Support / Re: Set channel data at channel creation ?
« on: November 29, 2013, 02:29:09 PM »
Hahaha that's just me being stubborn  ;D I wanted to avoid the creation of a persistent game object just to store this data until next scene is loaded. But if I have to, I will do it ;)
Thanks for your help.

2
TNet 3 Support / Re: Set channel data at channel creation ?
« on: November 29, 2013, 05:17:12 AM »
Once your in the channel you can set your channel data by affecting a string in TNManager.channelData, but as said above it only works once you've joined the channel.

3
TNet 3 Support / Re: Set channel data at channel creation ?
« on: November 28, 2013, 05:23:04 PM »
Thanks for your answer. My problem is that I have a GUI where I can either choose a channel from the list of existing ones or type a new channel name then click the create channel button.

Can't I create and join a channel without loading the  scene, set channel data from my gui input field then load the game scene? I tried to do so but it seems the channel data stays null as if I didn't joined the channel after the create channel call.


4
TNet 3 Support / Set channel data at channel creation ?
« on: November 28, 2013, 02:16:57 PM »
Is there a way to set channel data at channel creation ? I wanted to set a channel name when creating a new channel and wanted to store the name in the channelData, but didn't find a way to do it.

5
TNet 3 Support / Re: Best pratices for lot of bullets/laser/shots handling
« on: November 22, 2013, 11:41:50 AM »
It seems to work great like this, thanks. I don't know why I tried so hard to keep a TNObject involved for each shot :o

For those interested here is how it works now :

As Aren suggested, from my starship's controller I now only synchronize the fire input (button state change or on/off value based on axis) with the other players. Each player will then process the input and use Instantiate (I'll add a pool system later) to create the laserShots locally. I just keep a bool in the laserShot manager script to know if the shot has been spawned by the current player (set with TNObject.isMine) so only one player computes and synchronize the damage done by his shots with others.

I will just need to keep a track of the currently "active" laserShots in my starship controller class to synchronize their position with a connecting player (but they don't live for a long time, maybe it's not really needed).

6
TNet 3 Support / Re: Best pratices for lot of bullets/laser/shots handling
« on: November 22, 2013, 01:53:14 AM »
Just thought about the pool system I suggested, it would be much more efficient to have only one "laserPool" prefab with its own TNObject, and send/receive updates about its currently active children. Feel free to comment if you have any other idea  ;D

7
TNet 3 Support / Best pratices for lot of bullets/laser/shots handling
« on: November 21, 2013, 03:30:21 PM »
Hi,

I'm currently trying TNet on a small prototype project I'm coding, a small multiplayer space shooter game. As the spaceships in my game can have some quite big shooting rates, I was wondering what's the best way to handle many "laser shots" per second.

I first tried the naive approach with TNManager.create from the player's starship control script, creating a laserShot prefab on the correct position/rotation. This TNObject is then moved locally by each player at a constant speed (so I don't need to sync position after initial creation), I check collisions with a raycast and I only apply damage to an enemy ship (via a RFC on the hit ship) if the laserShot "isMine" so the shot's result is always consistent. I only call RFC on this object when a new player is connecting so he can see the shots created before his arrival at the correct position. This seemed quite "elegant" to me but I have a small problem with this:

It seems that when I have a quite important ping (tried on an amazon ec2 server with 250ms ping) on the server that the TNManager.create is a little laggy and I can see that my ship's firing rate is not constant nor as fast as when I'm playing solo.

I tried to implement some pool system, with each player creating a pool of laserShots when connecting via a RCC call that adds the newly created laserShot in a pool, but it takes quite a long time and it "floods" the server with create calls each time a new player is connecting. And I suppose that having a lot of "pre-created" TNObject isn't that good performance-wise as there will be a lot of calls to OnNetworkPlayerJoin callback each time a new player connect with properties synchronisation (activated or not, position, rotation...).

Do any of you have any tips on how to handle this problem ?

Thanks !!!

8
Thanks for your answer, maybe a comment in the code would help those who'll try to do the same way as I did ;D

9
Not sure to understand your question. Why changing UISprite.sprite instead of UISprite.spriteName ? Because we can ;D No, I'm just joking  ;), the UISprite.sprite property was the first one I found and I tried to use it before finding that I can change UISprite.spriteName. It seems that I'm not the only one that tried (and failed to use it) this way if you search in the forum.

Or was it "Why I try to change a UISprite dynamically" ? In fact I have 6 action icons around my character and these icons depends of what the character has in his inventory, so I needed to change them dynamically. I thought it would be the best way to do it, or is there a better way ?

10
Hi, I don't know if it's the correct place to write a bug report but here it is :

I bought NGUI some days ago (thanks by the way, it's fantastic :)) ) and I just had a problem when trying to change dynamically the sprite used by a UISprite.

Changing sprite with UISprite.spriteName = ... works but UISprite.sprite = ... doesn't (the sprite image is modified then returns to its last value as soon as update is called).

The problems seems to come from the fact mSpriteName isn't updated in UISprite.sprite's setter, if I add mSpriteName = mSprite.name in UISprite.cs at line 146 it works as expected but I don't know if it has other side effects.

I hope it can be usefull.

Pages: [1]