Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Games Unnamed Street Racer - Devlog

Discussion in 'Projects In Progress' started by SamohtVII, Jun 28, 2022.

  1. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    368
    Hi all,

    UPDATE: Name: World Racing: Online

    Play Store: https://play.google.com/store/apps/details?id=com.UndividedGames.Racer2022
    App Store: https://apps.apple.com/us/app/world-racing-online/id1529222598


    Platforms: Mobile iOS, Android
    Description: A free roam multiplayer driving sim. The idea is there are "games" scattered throughout the level that players can pick up.
    Traffic: Urban Traffic System
    World: Classic City, Countryside
    Networking: PUN2
    Cars: Fantastic Race Cars
    Discord: TBA
    Demo: TBA, recommendations on distributing a demo to the public?

    Here's an outline of the games you can pick up.

    Bounty: A bounty is placed on a car at random and the others have to smash into it and pin it down for a few seconds to capture them. Picture the old Need for Speed games. If they can escape they for the whole time the bounty wins.

    Point to Point Race: A simple checkpoint race. Drive through each checkpoint and be first to the end.

    The Car That Couldn't Slow Down: The minimum speed will begin at 1kph and tick up each second. Be the last person to stay above the ever increasing speed limit or explode into flames.

    Many more to come....




    Devlog #1
    I am back into game dev and have picked up a project that has been on and off for a while. Just something to play with when I have free time.
    I've made some nice progress and would love to start the feedback process and generate some interests.
    Also, it's a multiplayer game and would you believe it's pretty hard to debug a mobile game as a solo developer.
    Anyway, I'll work on getting some beta versions up so people can have some fun and provide some criticisms.

    I have used Urban Traffic System to simulate the traffic. I have recently got 2 loops of traffic working. Each path has several cars looping around a part of the road. They are connected through a PhotonView so everyone's traffic is synced at the same spot. It isn't incredibly smooth as a connected person but so far it's the best I have.

    I feel the games are working well together although I think some issues can arise when players connect/disconnect mid game. I have tried to account for all scenarios but I think it will be an ongoing battle.
     
    Last edited: Dec 22, 2022
  2. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    368
    Hi All,

    Creating some socials that I will post here and you can keep up to date.
    Here are some screens of the latest progress.
    - Traffic Sync'd between all racers.
    - Traffic fills the whole world now.
    - Custom rooms can be made to play with friends easier

    Instagram: @MomasGameDev
    Youtube: MomasGameDev
     

    Attached Files:

  3. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    368
    First devlog post is up. Check it out and give it a like if you want to see more. THanks
     
    kallais likes this.
  4. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    368
    Who wants a free keyboard!
     
  5. kallais

    kallais

    Joined:
    Jun 3, 2019
    Posts:
    11
    Great physics.
    But i think the environment needs to be popped up.
    Anyway, how did you make the damage system? Did you purchase it on asset store or something?
     
  6. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    368
    I can't remember where I got it but it is free. Here is the script:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class DeformationMeshesPack : MonoBehaviour
    6. {
    7.     public MeshFilter[] meshFilters;
    8.     public MeshCollider[] colliders;
    9.     public float ImpactDamage = 3f;
    10.     public float radiusDeformate = 0.7f;
    11.     public float maxDeformation = 0.16f;
    12.     public float minVelocity = 5f;
    13.     private Vector3[][] originalVertices;
    14.     private float nextTimeDeform = 0f;
    15.     private Vector3 sumPosImpacts = Vector3.zero;
    16.     private Vector3 sumVelocityImpacts = Vector3.zero;
    17.     private int sumImpacts = 0;
    18.  
    19.     private Rigidbody rigidB;
    20.     private CarController carC;
    21.  
    22.     void Start ()
    23.     {
    24.         rigidB = GetComponent<Rigidbody>();
    25.         carC = GetComponent<CarController>();
    26.  
    27.         originalVertices = new Vector3[meshFilters.Length][];
    28.  
    29.         for(int i = 0; i < meshFilters.Length; i++)
    30.         {
    31.             originalVertices[i] = meshFilters[i].mesh.vertices;
    32.             meshFilters[i].mesh.MarkDynamic();
    33.         }
    34.     }
    35.  
    36.     void FixedUpdate()
    37.     {
    38.         if (Time.time - nextTimeDeform >= 0.2f && sumImpacts > 0)
    39.         {
    40.             float invCount = 1f / sumImpacts;
    41.             sumPosImpacts *= invCount; // same sumPosImpacts / sumImpacts
    42.             sumVelocityImpacts *= invCount;
    43.             Vector3 impactVelocity = Vector3.zero;
    44.  
    45.             if (sumVelocityImpacts.sqrMagnitude > 1.5f)
    46.             {
    47.                 impactVelocity = transform.TransformDirection(sumVelocityImpacts) * 0.02f;
    48.                 float myImpact = impactVelocity.x + impactVelocity.y + impactVelocity.z;
    49.                 carC.health -= sumVelocityImpacts.sqrMagnitude / 50;
    50.             }
    51.  
    52.             if (impactVelocity.sqrMagnitude > 0)
    53.             {
    54.                 Vector3 contactPoint = transform.TransformPoint(sumPosImpacts);
    55.  
    56.                 for (int i = 0; i < meshFilters.Length; i++)
    57.                 {
    58.                     DeformationMesh(meshFilters[i].mesh, originalVertices[i], meshFilters[i].transform, contactPoint, impactVelocity, i);
    59.                 }
    60.             }
    61.  
    62.             sumImpacts = 0;
    63.             sumPosImpacts = Vector3.zero;
    64.             sumVelocityImpacts = Vector3.zero;
    65.             nextTimeDeform = Time.time + 0.2f * Random.Range(-0.4f, 0.4f);
    66.         }
    67.     }
    68.  
    69.     private void DeformationMesh(Mesh mesh, Vector3[] originalVerts, Transform localTransfrom, Vector3 contactPoint, Vector3 contactVelocity, int i)
    70.     {
    71.         Vector3[] vertices = mesh.vertices;
    72.         bool isDeformate = false;
    73.  
    74.         for (int j = 0; j < vertices.Length; j++)
    75.         {
    76.             Vector3 localContactPoint = localTransfrom.InverseTransformPoint(contactPoint);
    77.             Vector3 localContactForce = localTransfrom.InverseTransformDirection(contactVelocity);
    78.             float distance = Vector3.Distance(localContactPoint, vertices[j]);
    79.  
    80.             if (distance <= radiusDeformate)
    81.             {
    82.                 isDeformate = true;
    83.                 Vector3 damage = localContactForce * (radiusDeformate - distance) * ImpactDamage;
    84.                 vertices[j] += damage;
    85.                 Vector3 deformation = vertices[j] - originalVerts[j];
    86.                 vertices[j] = originalVerts[j] + deformation.normalized * maxDeformation;
    87.                 //vertices[j] = vertices[j] + deformation.normalized * maxDeformation;
    88.             }
    89.         }
    90.  
    91.         if (isDeformate)
    92.         {
    93.             mesh.vertices = vertices;
    94.             mesh.RecalculateNormals();
    95.             mesh.RecalculateBounds();
    96.             if (colliders[i] != null)
    97.             {
    98.                 colliders[i].sharedMesh = mesh;
    99.             }
    100.         }
    101.     }
    102.  
    103.     private void OnCollisionEnter(Collision collision)
    104.     {
    105.         if (collision.relativeVelocity.magnitude > minVelocity)
    106.         {
    107.             int impactCount = 0;
    108.             Vector3 impactPosition = Vector3.zero, impactVelocity = Vector3.zero;
    109.  
    110.             foreach (ContactPoint contacts in collision.contacts)
    111.             {
    112.                 impactCount++;
    113.                 impactPosition += contacts.point;
    114.                 impactVelocity += collision.relativeVelocity;
    115.             }
    116.  
    117.             if (impactCount > 0)
    118.             {
    119.                 float invCount = 1f / impactCount;
    120.                 impactPosition *= invCount; //same impactPosition / impactCount
    121.                 impactVelocity *= invCount;
    122.                 sumPosImpacts += transform.InverseTransformPoint(impactPosition);
    123.                 sumVelocityImpacts += transform.InverseTransformDirection(impactVelocity);
    124.                 sumImpacts++;
    125.             }
    126.  
    127.             //here you play crash sound
    128.         }
    129.  
    130.     }
    131. }
    132.  
     
  7. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    368
    Here are some recent screens I took:
     

    Attached Files:

  8. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    368
    And here is the app icon: icon512.png
     

    Attached Files:

  9. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    368