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 - pahe

Pages: [1] 2 3
1
Thanks for the advice! I'll try it out and see if it will solve my problem. Seems to be a good one though.

The 500 ms lag is definitely too much and was just for describing the problem. I hope to see lags in maybe 10-50ms, but have no good results yet. Currently I have the problem that my clients to out of sync at some point and I need to compensate that.

2
You should not be sending local time. You have TNManager.serverTime to work with. Use that instead. It's going to be the same across all clients.

I'm not sure if I understand correctly. Please let me resummarize my problem, maybe it was not clear enough.

The scenario is:

1. Player A (host) triggers a skill (fireball) and sends the RFC request all players.
2. Player A gets the response instantly (as its the host) and triggers the skill.
3. Player B gets the RFC 500 ms later and triggers the skill.

Now they are out of sync. That's why I would like to send the time when the skill was triggered with the RFC.

How can I use the TNManager.serverTime to know when Player A triggered his skill for Player B?

3
Hi guys.

I have the problem that I want to synchronize my game action (for a real time strategy game) by sending a DateTime with the response from the server, so each client will later know when the server had send it to everybody. As I don't have the possibility to add the server DateTime to RFCs, I'm wondering how I can do this:

  1.         internal void SendReleaseSkill(BattleSide battleSide, BattleSkillBase skill)
  2.         {
  3.             tnObject.Send(12, Target.All, TNManager.playerID, (int)battleSide, (int)skill.SkillName, DateTime.UtcNow.ToLongTimeString());
  4.         }
  5.  
  6.         [RFC(12)]
  7.         void OnTriggerSkill(int playerId, int battleSide, int skillType, string triggerDate)
  8.         {
  9.             battleView.battleLogic.ReleaseSkill((BattleSide)battleSide, associatedPlayer, (SkillName)skillType, triggerDate);
  10.         }
  11.  

I don't think that this would be a good solution to send the clients DateTime.UtcNow with it, as I think this will be very prone to cheating by the client. Would the solution be here to change from RFCs to own packets where I have more control over what the server sends to the clients?

Rough gameserver response code example:
  1.             case Packet.TriggerSkillRequest:
  2.             {
  3.                 var packetWriter = BeginSend(Packet.TriggerSkillResponse);
  4.                 packetWriter.Write(playerId);
  5.                 packetWriter.Write(battleSide);
  6.                 packetWriter.Write(skillType);
  7.                 packetWriter.Write(DateTime.UtcNow.ToLongTimeString());
  8.                 EndSend(true, player.channel, null);
  9.                 break;
  10.             }
  11.  

Thanks for advice.

4
TNet 3 Support / TNet 3.0 upgrade guide
« on: January 07, 2016, 04:55:58 AM »
Hi.

I'm currently developing with an older version of TNet (2.0.6), but would like to update now. Now I've got some questions:

1. Will the update from 2.x to 3.x cost something?
2. Should I upgrade first to the latest 2.x (2.1.1) version before updating to 3.0?
3. Will there be major changes I should keep in mind when updating?


5
NGUI 3 Support / Re: Rigidbody on UIPanel still needed?
« on: July 24, 2015, 08:52:54 AM »
Good question. I' currently experiencing that the rigidbodies are reacting on gravity in my UIScrollList. I'm not sure if it is related to Unity 5.1.2, but we hadn't had that problem before.

6
TNet 3 Support / Re: Suggestion: rename "Application" class
« on: June 18, 2015, 09:23:50 AM »
Sure I did. I simply extracted it into the TNet folder (haven't thought about it), so it was clearly my fault here. But I can imagine that other (unexperienced) developers may do the same as me and I think it doesn't hurt to rename it?

Well, anyway, just a suggestion :)

7
TNet 3 Support / Suggestion: rename "Application" class
« on: June 18, 2015, 02:27:22 AM »
Hi.

I updated yesterday the TNet plugin and also extracted the server zip. After that, I got several compiler warnings, that "Application" has no XYZ function. I started to wonder what was happening, as these were simple UnityEngine function which always worked. After an hour or so, I realized that the server class is called "Application" without a namespace (doh!). I simply renamed the class then to TNetApplication and it worked fine.

Could you rename that one or move it into a namespace, so that problem wouldn't reoccur again?

8
NGUI 3 Support / Re: Two color fill (possible)?
« on: May 26, 2015, 04:45:28 AM »
Ok, so a background sprite and two filled sprites (one for both ends). Sounds pretty easy. Thanks!

I also created a shader for this, but that was more a try out :)

9
NGUI 3 Support / Two color fill (possible)?
« on: May 16, 2015, 08:29:47 AM »
Hi folks.

I would like to achieve a filled sprite, which should be filled with two different colors (well, actually three 'cause the background should be grey) and I wonder how I can achieve this.

The situation is, that there is an energy cable (without energy) and from both ends could be energy inserted, which then fills the cable with its energy (red from one side, blue from the other side). You can see an example of it in the screenshot, I've done with a normal and two filled sprites, but this leaves some problems.

Has anyone a suggestion how to solve the problem? Maybe the sprites aren't the right solution and I should check out if I can achieve something like that with a shader?

Any help is appreciated!

10
Hey.

I know that I have to create seperate assetbundles for the different platforms and I already do. Though I agree with you, that this question is not only related to NGUI (the question would be when assets from an assetbundle are unloaded), I hope that someone else had a similar problem and maybe has a solution for it.
I'll try to create a test project to show you what I mean, but this may take some time.

11
NGUI 3 Support / Replacement atlas is disappearing after scene load
« on: July 23, 2014, 02:44:06 AM »
Hi.

I have currently a strange problem and though I have a workaround already, I'm not sure how to really fix that:

I have a preloading scene and load my UIAtlasses via assetbundles from a webserver. After downloading, I assign the UIAtlasses as the replacement atlasses and also make them DontDestroyOnLoad. This all works fine in the editor, but when I'm testing on mobile, the replacement atlasses aren't shown anymore. I debugged some and see that the atlas is present and loaded, but it is not shown.

Now the workaround is, to have a script referencing all reference atlasses. But as far as I understand, this would also mean, that the loaded UIAtlasses are always loaded into memory, right? This isn't something I want to have on mobile. Has anyone else encountered this problem and knows a better solution for that?


Cheers,
Patrick

12
TNet 3 Support / Misleading error message on null ref in game code?
« on: April 06, 2014, 08:33:11 AM »
Hi.

I was testing a new piece of code and I received the error message:
"Exception has been thrown by the target of an invocation." followed by "Unable to execute function with ID of '11'. Make sure there is a script that can receive this call."

Since this worked before I changed my game code I was confused why this function couldn't be executed then. I found then that I had a null reference exception in the function I was calling. After fixing that I not received the error message anymore.

So as a suggestion, the error message could be extended to: "Unable to execute function with ID of '11'. Make sure there is a script that can receive this call and it could be executed without errors." to make sure that the error may in the executed function itself, instead of not only not finding it.

13
Ok, I got it nearly working, but I still have a problem:

If I'm creating the players prefab with the TNManager.Create function it's working, but I have to set the battle side later. If I use the TNManager.CreateEx function, it doesn't work, though I don't know why.

  1.     private void Awake()
  2.     {
  3.         TNManager.AddRCCs(this);
  4.         instance = this;
  5.     }
  6.  
  7.     private void OnGUI()
  8.     {
  9.         if (leftPlayer == null && GUI.Button(new Rect(100, 150, 100, 50), "create left"))
  10.             CreatePlayer("Left");
  11.         if (rightPlayer == null && GUI.Button(new Rect(100, 200, 100, 50), "create right"))
  12.             CreatePlayer("Right");
  13.     }
  14.  
  15.     private void CreatePlayer(string side)
  16.     {
  17.         //TNManager.Create(playerPrefab, false); // working
  18.         TNManager.CreateEx(10, false, playerPrefab, side); // not working
  19.     }
  20.  
  21.     [RCC(10)]
  22.     private void OnCreatePlayer(GameObject prefab, string sideString)
  23.     {
  24.         var player = Instantiate(prefab) as GameObject;
  25.         var newPlayer = player.GetComponent<TestPlayer>();
  26.         if (sideString.Equals("Left"))
  27.         {
  28.             newPlayer.InitPositions(leftSide, sideString);
  29.             leftPlayer = newPlayer;
  30.         }
  31.         else
  32.         {
  33.             newPlayer.InitPositions(rightSide, sideString);
  34.             rightPlayer = newPlayer;
  35.         }
  36.     }

This is a bit confusing to me, as I thought both functions would do similar things, except that the CreateEx function could be used for more parameters. Any guesses why the CreateEx function may not work for me?

Update: Ok, I think I forgot the GameObject as return value. Yeha! Now it works!!! :)

14
It is a GameObject. I meant that in the CreatePlayer function the property is used:

  1. TNManager.CreateEx(1, true, playerMarker.cachedGameObject, side, characterName, );
  2.  

Maybe I should try a same approach as in the "Create Cube" example. I'll try that at the weekend to change it.

15
Ok
I' having a prefab "playerMarker" which gameObject I pass to the CreateEx function. Also this prefab is known to the TNManager that it should be known to the server then aswell.
Could it be that the prefab has to be of the type GameObject? Currently the prefab is of the type PlayerMarker which has a property cachedGameObject that I'm using in my function. Haven't thought about that.

TNet is able to create the prefabs, but I think the problem is more that the created objects are not set correctly to their owners. That's the reason why I first tried to assign the playerId by myself.

Pages: [1] 2 3