Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

geckoo

Moderators
  • Content Count

    2,802
  • Joined

  • Last visited

  • Days Won

    151

Everything posted by geckoo

  1. geckoo

    Seus Lens Flare

    Thank for sharing. Effect is really cool ++
  2. I have a project which I would share with you... in other case. I don't like your avatar. Good luck mein herr ++
  3. I saw a clone of GTA. Result don't really good, but with some money, time and a team, it's possible ++
  4. very cool mix, but sound not really good. Quality problem ++
  5. I know better web sites. Besides it's too expensive ++ for musics - http://www.nosoapradio.us for sounds - http://soundbible.com/blog/2013/100-war-sound-fx Google is our friend
  6. It's look good but... I have compared this code with mine and it seems to me very bugged. It's not a reproach because devlopper is very nice with us. He shares his code kindly. I have many clipping, network don't work fine and I have an annoying lag each time I shoot. What he used to create net relation between players? Photon or something like it?
  7. It's like CS. Weapons and body interest me ++
  8. Sure we can modify speed of our enemy. I can understand this fact - you don't know where are these values because you are a beginner, but with time and strong will it's possible to read code like a book. You must start with simple codes/sources. In the web it's very easy to find tutorials. After it, learn FPSkit and this code will seem to you really amazing ++
  9. geckoo

    Vector3.lerp

    Finally I use the easiest method It works fine. Thank you friends ++ private bool crouched = false; private float duration = 7.0f; (...) if (!crouched){ camHolder.transform.localPosition = Vector3.Lerp(camHolder.transform.localPosition, Vector3.up * 0.8f, Time.deltaTime * duration); // Vector3.zero; }else{ camHolder.transform.localPosition = Vector3.Lerp(camHolder.transform.localPosition, Vector3.zero, Time.deltaTime * duration); // Vector3.zero; }
  10. geckoo

    Vector3.lerp

    OK I understand. Thank for your suggestions ++
  11. geckoo

    Vector3.lerp

    I use a condition to create a smooth effect between idle and "crouch" positions. In fact I use function Vector3.lerp, but it didn't work and crouch is immediate. I forgot something? Thank you for help ++ if (!crouched){ // Create a breath effect in idle state/no crouch // DuckMov += Time.deltaTime * 5f; camHolder.transform.localPosition = Vector3.up * 0.8f; // Mathf.Sin(DuckMov) * 0.012f; }else{ timeToCrouch = Time.time; timeToCrouch += Time.deltaTime / duration; camHolder.transform.localPosition = Vector3.Lerp(Vector3.up * 0.8f, Vector3.zero, timeToCrouch); // Vector3.zero; }
  12. The wall is great. Thank for sharing ++
  13. geckoo

    new fps camera

    I don't know if you ask us a question or if it's just a comment. It seems to me you need help... OK. I use a method to directly disable material of my character if bool Local is true. I think my project is different, but maybe you can understand something. Code works like this : public void SetModelVisibility(bool visible){ // define material for each team if (theNetwork.gameSettings.teamBased){ if (thisPlayer.team == 1){ transform.Find("SoldierX/armorArms").renderer.material.color = Color.magenta; transform.Find("SoldierX/armorBody").renderer.material.color = Color.magenta; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.material.color = Color.magenta; } if (thisPlayer.team == 2){ transform.Find("SoldierX/armorArms").renderer.material.color = Color.cyan; transform.Find("SoldierX/armorBody").renderer.material.color = Color.cyan; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.material.color = Color.cyan; } } if (!visible){ //hide our player to himself transform.Find("SoldierX/armorArms").renderer.material.shader = oShadow; transform.Find("SoldierX/armorBody").renderer.material.shader = oShadow; transform.Find("SoldierX/head").renderer.material.shader = oShadow; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.materials[0].shader = oShadow; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.materials[1].shader = oShadow; // we know the material, but cache it if (gunMesh1.renderer){ gunMesh1.renderer.material = artillery.gunTypes[handGun].gunMaterial; gunMesh1.renderer.material.shader = oShadow; } if (gunMesh2.renderer){ gunMesh2.renderer.material = artillery.gunTypes[holsterGun].gunMaterial; gunMesh2.renderer.material.shader = oShadow; } }else{ //show the player to me transform.Find("SoldierX/armorArms").renderer.enabled = true; transform.Find("SoldierX/armorBody").renderer.enabled = true; transform.Find("SoldierX/head").renderer.enabled = true; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.enabled = true; if (handGun>=0 && gunMesh1.renderer) gunMesh1.renderer.material = artillery.gunTypes[handGun].gunMaterial; if (holsterGun>=0 && gunMesh2.renderer) gunMesh2.renderer.material = artillery.gunTypes[holsterGun].gunMaterial; } if (firstPersonGun != null && thisPlayer.local && firstPersonGun.renderer && handGun>=0){ if (!visible){ firstPersonGun.renderer.enabled = true; firstPersonGun.renderer.material = artillery.gunTypes[handGun].gunMaterial; }else{ firstPersonGun.renderer.enabled = false; } } } In fact I use a shader to create a shadow with a mesh without material, but you can change the method and only disable renderer : transform.Find("SoldierX/armorArms").renderer.enabled = true; transform.Find("SoldierX/armorBody").renderer.enabled = true; transform.Find("SoldierX/head").renderer.enabled = false; I can see the body and arms, but head is invisible ++
  14. Application.targetFrameRate = 60; http://docs.unity3d.com/Documentation/ScriptReference/Application-targetFrameRate.html The web page which Connor Gibson gave you is interesting to increase performances ++
  15. For a 7dFPS project a guy has created a strange game. ASCII characters fight against player and result seems to me really strange. I like to discover works which have been developed during these sessions 7dFPS. We can learn many things. This boy has smoked some illegal grass no? on Youtube ++
  16. For each value a RPC function? Ok I understand. I must rewrite this part of code. You're right - will be better. A last question. is there a means to see in Unity the bandwidth? We can use a tool? Thank ++
  17. I want to understand. In this code I use a RPCUpdate function only if one from five parameters has changed - camAngle, moveVec, crouched, yMove and health. I actualize all parameters in this case. OK I can reduce this, but I need actualize camAngle, moveVec, crouched, yMove. How I can keep a good relation clients/server if I change this? Sorry but I don't understand. Can I simplify this process if I use rpcCamtime = Time.time + 0.05 ? I need to read a simply code - an example. Do you have? Thank ++
  18. I don't know if this function will be better than this RPCUpdate method. In my project all players play simultaneously without problems. I am ready to change this part of code, but do you think I can save a importante network bandwidth or maybe difference will be not significant?
  19. if (camAngle != lastCamAngle && Time.time>rpcCamtime) sendRPCUpdate = true; if (moveVec != lastMoveVector) sendRPCUpdate = true; if (crouched != lastCrouch) sendRPCUpdate = true; if (yMove != lastYmove) sendRPCUpdate = true; if (thisPlayer.health != lastHealth) sendRPCUpdate = true; if (theNetwork.broadcastPos){ theNetwork.broadcastPos = false; sendRPCUpdate = true; } lastCamAngle = camAngle; lastMoveVector = moveVec; lastCrouch = crouched; lastYmove = yMove; lastHealth = thisPlayer.health; if (sendRPCUpdate){ theNetwork.SendPlayer(thisPlayer.viewID, transform.position, camAngle, crouched, moveVec, yMove, handGun, holsterGun, transform.up, transform.forward); sendRPCUpdate = false; rpcCamtime = Time.time; } (...) Sure friend! We need compare the last values and if we have some difference, sendRPCUpdate = true; In other case, we don't do anything - sendRPCUpdate = false; I think this functions work fine. What do you think about this?
  20. geckoo

    meta file

    Thank you for this explanation.
  21. //-------- Network gameplay stuff ---------- public void SendPlayer(NetworkViewID viewID, Vector3 pos, Vector3 ang, bool crouch, Vector3 moveVec, float yMove, int gunA, int gunB, Vector3 playerUp, Vector3 playerForward){ //send out a player's current properties to everyone, so they know where we are networkView.RPC("SendPlayerRPC", RPCMode.Others, viewID, pos, ang, crouch, moveVec, yMove, gunA, gunB, playerUp, playerForward); } [RPC] void SendPlayerRPC(NetworkViewID viewID, Vector3 pos, Vector3 ang, bool crouch, Vector3 moveVec, float yMove, int gunA, int gunB, Vector3 playerUp, Vector3 playerForward, NetworkMessageInfo info){ //received a player's properties, let's update the local view of that player lastRPCtime = Time.time; for (int i=0; i<players.Count; i++){ if (viewID == players[i].viewID && players[i].fpsEntity != null){ players[i].lastPong = Time.time; players[i].fpsEntity.UpdatePlayer(pos, ang, crouch, moveVec, yMove, info.timestamp, gunA, gunB, playerUp, playerForward); } } } Like this I think it's more understandable ++
  22. geckoo

    meta file

    What is utility of meta files which had been created when project compiled in unity? I erase it each time, but maybe I make a mistake. Must be conserved?
  23. I don't update animations by RPC. Why do that? I Use a simply correlation in LocalMode. But you need use Broadcast to distribute new pose/statut (in example a boolean) ++ if (thisPlayer.health>0f){ if (yMove == 0f){ if (moveVec.magnitude>0.1f){ if (crouched){ animObj.animation.Play("soldierCrouchRun"); }else{ animObj.animation.Play("soldierRun"); } if (Vector3.Dot(moveVec, lookDir)<-0.5f){ animObj.animation["soldierCrouchRun"].speed = -1; animObj.animation["soldierRun"].speed = -1; }else{ animObj.animation["soldierCrouchRun"].speed = 1; animObj.animation["soldierRun"].speed = 1; } }else{ oDead = true; if (crouched){ animObj.animation.Play("soldierCrouch"); }else{ animObj.animation.Play("soldierIdle"); } } }else{ if (yMove>0f){ // animObj.animation.Play("soldierLanding"); }else{ animObj.animation.Play("soldierFalling"); } } (...) ///////////////////////////////////////////////////// public void UpdatePlayer(Vector3 pos, Vector3 ang, bool crouch, Vector3 move, float yMovement, double time, int gunA, int gunB, Vector3 playerUp, Vector3 playerForward){ transform.position = pos; camHolder.transform.eulerAngles = ang; camAngle = ang; crouched = crouch; moveVec = move; yMove = yMovement; lastUpdateTime = time; handGun = gunA; holsterGun = gunB; transform.LookAt(transform.position + playerForward, playerUp); NonLocalUpdate(); }
  24. pinoykaiser - I understood RPC and NetCode in Unity through a little project which you can find here. Sure ! It's a FPS, but it seems to me not really different with your game. You need to link your objects with a NetViewer and distribute all info by Update. Your game is very pleasant with nice concept. Good luck ++
×
×
  • Create New...