Jump to content

Marcousik

Members
  • Posts

    679
  • Joined

  • Last visited

Blog Entries posted by Marcousik

  1. Marcousik
    I'm just happy to get this work  here is a demo:
    This is actually better than driving in 4.3 because cars are now  able to jump or crash without experimenting crazy rotations or whatever  ?
     
     
    Here is the script to make this:
     
    > Here the values I used:
     

     
     
    > And here what changed: Is written in dark:
    -------------------------------------
    function Script:Start()
    -- [...........]
    -- Construit les amortisseurs: / suspensions
    local n
    local pos
        for n=0,3 do
            pos=self.entity:GetPosition(true)
            self.Axes[n]:SetMass(self.TireMass)
            self.Amortisseurs[n]=Joint:Slider(pos.x, pos.y, pos.z, 0,1,0, self.Axes[n], self.entity)
            self.Amortisseurs[n]:EnableLimits()
            self.Amortisseurs[n]:SetLimits(-0.25/2,0.25/2)
            self.Amortisseurs[n]:SetTargetAngle(-self.Amort)    --at the middle if 0
            self.Amortisseurs[n]:SetMotorSpeed(10000)    ------------- vitesse de la pompe/ suspensions speed
            self.Amortisseurs[n]:SetStrength(self.Force)    --defatul is 1000
            self.Amortisseurs[n]:EnableMotor()    

        end
    -- [...........]     
     
    -----  I removed the backward suspensions with 2* forces because this only depends on the positions of the suspensions on the chassis.
    ----- Making them symmetrical is ok to solve this.
     
    ----------------------------------------
    function Script:UpdatePhysics()

    if self.MyCar==1 and InCar>0 then
        
    -- Traite la direction:    
    local turning=0
        local direction=self.Volants[0]:GetAngle()
        if window:KeyDown(Key.Left) then
            direction=direction-5 turning=-1
        elseif window:KeyDown(Key.Right) then
            direction=direction+5 turning=1
        elseif window:KeyDown(Key.Left)==false and window:KeyDown(Key.Right)== false then 
            if Math:Round(direction)>0 then direction=direction-5
            elseif Math:Round(direction)<0 then direction=direction+5
            end
        end
        self.Volants[0]:SetAngle(direction)
        self.Volants[1]:SetAngle(direction)
    -- Traite l'acceleration:
    local Gas=0
            if window:KeyDown(Key.Up) then
                Gas=1
                self.currspeed = self.currspeed + 10
                if self.currspeed>self.SpeedMax then
                    self.currspeed=self.SpeedMax
                end
            
            elseif window:KeyDown(Key.Down) then
                Gas=-1
                self.currspeed = self.currspeed - 10
                if self.currspeed<-self.SpeedMax then
                    self.currspeed=-self.SpeedMax
                end
            end
            if Gas==0 then  self.currspeed=0
                for n=0,3 do
                self.Rouages[n]:DisableMotor()
                end
            else
                for n=0,3 do
                if self.Rouages[n]:MotorEnabled()==false then self.Rouages[n]:EnableMotor() end
                self.Rouages[n]:SetTargetAngle(self.Rouages[n]:GetAngle()+1000)
                self.Rouages[n]:SetMotorSpeed(self.currspeed)
                self.Tires[n]:SetOmega(self.Tires[n]:GetOmega()*Vec3(5,5,5))   ---------  make the car go faster
                end
            end
    --Smoothing:
    if turning==0 then
        self.entity:SetOmega(self.entity:GetOmega()*Vec3(-1,-1,-1))
    else self.entity:SetOmega(0,turning*Gas,0) end
        self.Axes[0]:SetOmega(self.Axes[0]:GetOmega()*Vec3(-1,-1,-1))
        self.Axes[1]:SetOmega(self.Axes[1]:GetOmega()*Vec3(-1,-1,-1))
        self.Axes[2]:SetOmega(self.Axes[2]:GetOmega()*Vec3(-1,-1,-1))
        self.Axes[3]:SetOmega(self.Axes[3]:GetOmega()*Vec3(-1,-1,-1))
        self.Axes[0]:SetVelocity(self.Axes[0]:GetVelocity()*Vec3(1,0.5,1))
        self.Axes[1]:SetVelocity(self.Axes[1]:GetVelocity()*Vec3(1,0.5,1))
        self.Axes[2]:SetVelocity(self.Axes[2]:GetVelocity()*Vec3(1,0.5,1))
        self.Axes[3]:SetVelocity(self.Axes[3]:GetVelocity()*Vec3(1,0.5,1))

    -- fake wheels update:
        
            self.Wheels[0]:SetMatrix(self.Tires[0]:GetMatrix())
            self.Wheels[1]:SetMatrix(self.Tires[1]:GetMatrix())
            self.Wheels[2]:SetMatrix(self.Tires[2]:GetMatrix())
            self.Wheels[3]:SetMatrix(self.Tires[3]:GetMatrix())
            self.Wheels[0]:SetPosition(self.PosWheels[0]+Vec3(0,self.Amortisseurs[0]:GetAngle()/6,0))
            self.Wheels[1]:SetPosition(self.PosWheels[1]+Vec3(0,self.Amortisseurs[1]:GetAngle()/6,0))
            self.Wheels[2]:SetPosition(self.PosWheels[2]+Vec3(0,self.Amortisseurs[2]:GetAngle()/6,0))
            self.Wheels[3]:SetPosition(self.PosWheels[3]+Vec3(0,self.Amortisseurs[3]:GetAngle()/6,0))
    end
     
  2. Marcousik
    Still researching a good car simulation script with LE 4.6, so what's new:
    I changed some important parameters of my car script to make the car more nervous, better responsive to the world, rapid and giving more feelings and more controls by driving it.
    Maybe it is not 100% what man can expect but it is now more  fun to drive and that's important.
    The car now calculates and integrates both the forces coming from the world and from the player commands, 
    That means it checks the slope movement of the ground, check its own rotation and adapt its own position depending on the results.
    The slider joints that simulates the dampers are now using SetSpring() combined with Motorspeed(),
    The frictions of the tires have a responssive adaptation to the controls,
    The dampers are now much more heavier than  I was used to use,
    Kynetic energie and inertia forces are integrated to the controls so the car has its own behavior too.
    I believe I can get it more smoother than actually it is, but it is a completly new way that awaits to be tested.
     
     
  3. Marcousik
    Using joints Hinge()
    Joints are funny and powerful to build machines. They allow to use mass (gravity), different masses on different part of the machine depends on what you need, frictions, and limits.
    By this machine, the only enabled motor is the first big oval cylinder, which is turning. The rest is articulated with disabled hinge joints.
     
     
  4. Marcousik
    January 2021, work progression showcase random generated world vegetation, FPS=30
     
     
     
     
    [I] -  THE TERRAIN; VEGETATION AND WATER:
     
    The map is 4096*4096
    The landscape is randomly cast: Painting & vegetation.
    At the end of the video, is a demo of the waves shader I could write using the leaves.shader on the water.shader.
    The shader is in the workshop for free to use. It is far not perfect but it adds a good animation for ocean water.
    https://steamcommunity.com/sharedfiles/filedetails/?id=2182253514
     
    [II] - THE CARS PHYSICS:
    In the game the player will have the possibility to drive different cars: Motos, Jeep, rapid cars,  heavy PIckup, trucks.
    All vehicles will have upgrades to buy or loot.
    That means not all vehicles will be able to cross a hill, depending on how heavy or how upgraded th car will be.
    So first challenge will be to find a way in the world.
    Here is a little showcase of a climb simulation for an heavy jeep (the model should rather be a heavy truck but that is not done yet), that fails to climb an abrupt mountain:
    You can see the speed of the vehicle depends on how straight the slope is be taken.
     
    thx for watching - feel free to comment, critic or advice.
     
     
     
  5. Marcousik
    That's what I obtained for driving experience with 4.6.
    For me it's ok, just the distance of the wheels to the cars are growing too much while getting speed.
    Sounds have to get upgraded too
     
    I add a video that show car driving possibilities in the down-scaled world I want to create with an own scaled character controller. The idea is to obtain with this a bigger world lol
    So everything is under scaled, the car too.
    It's not GTA 6 but it's very ok for what I expect because I like when the car you drive is shaking on the road, as too much polished is not realistic enough, as you could not feel the ruggedness of the world you are playing in . I think the cars in gta 5 are definitvly too polished as you cannot reverse them for example, making the game a way too sanitized.

     
     
     
     
    Progress of this update 02/2019:
     
     
     
     
     
     
     
     
  6. Marcousik
    I'm still spending hours of tests, changing and seeking properties to obtain the best balanced car driving experience possible.
    It's something between the mass used, the joints values, and the smoothing force. 
    This until now the best I get with a car, which is even performing a salto jump at 2.30 and other somersault crashing at 3.15
    The FPS are nice, I'm happy with this.
     
  7. Marcousik

    Offroad car simulation
    > This is defintely the best result I obtained with Leadwerks physics to build a car; I think this car is good enough so that it could be used in a game.
    > The car reacts depending on terrain, feeling different if climbing or driving down. The car allows speed driving until 140-160 kmh
    > The dampers became an upgrade that give me the possibility to construct car over 200 kg. That means simply that the cars drive now with much more stability and give for the player heavier feeling.
    > It approachs the feeling you get in games klike GTA 4.. Even if the car doesn't really get out of control like sometime it happens ingame when cars are drifting.
    > Car balancing and transmission could get more fine tuning, but this should be no problem.
    Here is the demo:
     
  8. Marcousik
    I'm trying to build a beautiful open world on map size 2048, where the player will have the possibility to play as a Street vendor, transporting and selling goods through the world.
    The world should be an unhabitable zone. Unless you have a shield.
    You will have manage your reccources between buying and re-selling goods, develop yourself with better vehicles, develop a little shopping industry, little bit enigm or fight to provide the shield.

  9. Marcousik
    I'm happy with this because I spent a long time in testing how to make rain without slowing the game too much.
    I wanted the rain to have "splash" effect on the ground and to stop correctly as the player could stay under a roof or hides under a big stone etc etc..
    I got big problems with collision testing and very low performances when using the shaped vegetation tool.
    Now that's fine, because I do not use the collision anymore, saving much performances.
    Here is a little demo:
     
    Here is a bit longer one with 2 rainfalls:
     
    Hope you enjoy !
  10. Marcousik
    This little game is here free to play:
    https://1drv.ms/u/s!AiVBgjDAyIXLs1khcglU6UKFbI_4?e=4oK8Sj
     
    1] First step:
    Adapting the Spline tool to build what we need: 
    I combined some of the possibilities that offers the Spline Tool (great thing) to obtain all this in one:
    - Cars align and follow the roads (rotation)
    - While using Physics, and so collisions
    - While using reverse travel (cars go back on the road)
     
     
    2] next step: 
    - We need speed cars in this game, beautiful , well smoothed, and challenging that can drive a few rounds on a loop racing road, here it is:
     
    I'm just thinking there is no way to overtake this car ! So we have here a nice challenging game.
    Next step will be build a playable race car, maybe able to overtake this.
     
     
    3] Playable speed car
    this video shows a little playable demo challenging 3 cars, here  I only get the second place:
     
     
    Last step should be adding Speed infos, Time needed, best time, the place..
    4) Here I managed a player interface to get informations like the speed and the place at which you are actually driving.
    A little bit car optimization, and here is a little funny challenging game. 
    Next step should be adding options like choose your car model and colors, sounds, music, how much players...
     
  11. Marcousik
    > Work in progress
    > The road tracer tool is  for now without bug; I added debug messages that prevent a bugged road to be generated - so it asks now to modify some values instead of generating the bugged road.
    > Water waves are smoother.
    > New feature: Driving in mud.
    > I'm thinking about adding a speed or friction penality if not driving on roads.
    > This little demo was recording on map 2048*2048
     
  12. Marcousik
    Hellö
    Here are a few thoughts about finding the best way to create  a dense forest, with different models, quickly, dense and allowing good performances by walking and driving.
     
    I first try with the vegetation tool. https://www.leadwerks.com/community/profile/15151-marcousik/?status=10763&type=status           I got good results but not by driving and I find that the collision checked causes the lost of 40 FPS (from 60 by to 20) making the game unplayable.
              Sure this depends on the view range and the density.
              I could get such a good beautiful looking map, allowing fast driving, but NOT allowing collision enabled, so that was sadly a no go.
     
    I tried on a another map to write a little script allowing a random generated forest with 2 colliding trees models and making the not colliding vegetation with the vegetation tool.           I obtained good results, possibly ok to be used in a game or a part of.
              The positive thing is that you can rotate the generated trees in x and z axes too, or changing the basis height easily, making a more realistic forest.
              There are performances limitations with this method too for sure: not the collision (setting collision to none didn't actually change very much regarding FPS, strangely?) but the density and the                      global range you wan't to be covered with trees. So it stays totally impossible to cover all the map (1024) with trees if you wan't a dense forest, like in the video here, with this method. The                            vegetation  tool should be better for covering all the map, if requested.
     
              But I found that I could create little dense forest allowing faster driving through. That's cool.
              I expected too much from setting the view range to medium or far. I thought that not rendering the trees that are far away would be equal to a none performance cost. Sadly it is not like this.
             So if the generated forest is big and very dense, even if invisible because far away from the player (by setting medium view range), the FPS are sinking drastically. Strange ? What/Where are the                 performances gone for?
             Another problem with this method is that the nav mesh will not be able to assimilate the trees as they are build in the start function. Except you generate the nav mesh after this from the script...
             Car lights are not supported, FPS sinking immediately under 20. Perhaps can here something be done with shadow disabling? Not tested. 
             Light are ok if the forest is not so dense. (but especially when the forest is dark and dense are the car lights really useful!)
     
    Conclusion, this tool script is ok for making little forests allowing fast movement and looking more diverse and realistic in my opinion... It is possible to add an if statement on the Terrain:GetSlope() and/or GetElevation() to choose if the trees should be summoned or not depending on the Height and Slope of the map, same options as in the vegetaion tool. The GetTerrain() function runs with the spline tool - but you can find the terrain using a selection with if GetClassName()=="terrain" on all entities on the map until it find it. You can summon all what you want with this, randomly, add more options... Rocks, mushrooms, flowers whatever. Using Terrain:GetElevation() is a much more powerful as with Pick() Script and video showcase following + beautiful screenshots done ingame with this tool:
     
     
     
     
     
     
     
  13. Marcousik
    Example:

     
    I could strangely find nothing about terrain generation from script except for LE5... 
    So here is an example that will run with LE4.6 on how you can generate 2 little  hills on a terrain and paint it from script. Can be usefull for games with random generated landscape.
    The script I modified is from here: https://www.leadwerks.com/community/topic/15715-minimap-generator/?do=findComment&comment=104697
    So first install the minimap shader to run this:
     
     
    You can only handle 4 layers from the script: 0,1,2,3. More will have no effect.
     

     
    > Add this to create vegetation:
     
  14. Marcousik

    Offroad car simulation
    This  an entry for a new completed feature:
    Wheels can leave a trace on the ground using decals.
    Here is a bit code on how to make that work.
    Here is how it returns ingame:
     
    Edit 19.01.2022
    First visual mud effect: 

    TEMP 2022-01-19 12-53-14.mp4  
     
    Enjoy!
×
×
  • Create New...