Jump to content
  • entries
    39
  • comments
    81
  • views
    12,066

New offroad speed jeep car crossing desert mountains


Marcousik

2,051 views

 Share

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.

 

 

  • Like 3
  • Upvote 1
 Share

12 Comments


Recommended Comments

Yes I'm misin gthat too. 

I begun tracing png decals on the ground under the tires but I became difficulties by calculating the curve the tires do when drifting so it waits to be continued.

Here is the thread about this:

 

Link to comment

You should add AI to the game that follows you really fast and shoots guns and stuff at you
and you will be able to get revenge by upgrading your car + weapons

  • Haha 1
Link to comment

 

You mean that..

There is the spline tool from AggrorJorn somewhere that is very nice too, only that it cuts the hill instead of placing the road on them.

Link to comment
11 hours ago, Slastraf said:

You should add AI to the game that follows you really fast and shoots guns and stuff at you
and you will be able to get revenge by upgrading your car + weapons

Yes nice the problem with adding complexity and features like this is at the end FPS = 10

For this we need LE 5 or a powerful engine.

With LE 4.6 you can really make everything but by setting all features together on one map you will encounter big performance problems

I think Avalanche made such good games like mad max or just cause. They could have continued with such off-road pursuits game but now they make games like Generation zero or Jurassic Shooter

 

 

Link to comment
2 minutes ago, Marcousik said:

Yes nice the problem with adding complexity and features like this is at the end FPS = 10

For this we need LE 5 or a powerful engine.

With LE 4.6 you can really make everything but by setting all features together on one map you will encounter big performance problems

I have gone from 15 fps to 130 fps by optimizing my code about terrain generation and procedural textures.
Chances are if it runs at 15 fps in LE 4 it will also run at 15 fps in LE 5
There are many things that cannot be done in LE 4 without many workarounds such as transparency shaders, geometry shaders etc.

Once the first run-able instance of the new engine is out I will start to write my own plugins for procedural stuff and do the things that right now are hard.
 

Link to comment

A procedurally generated map could be the only way I could recover a bit more FPS.. So that means a lot.

But in open world like I want to keep for such cars games, the view distance is most important in balance for both quality and optimization.

Occlusion culling is not sufficient to keep a game fluently, the not rendered objects in the world should be hidden() to get a really positive effect and get the possibility to add so much things in the world as you want without having performance issues.

But there are things in an open world that have to remain persistent or your world will become nonsense. Nothing for the player that can be recognized is nothing good.

How do you handle persistence?

 

Link to comment
8 hours ago, Marcousik said:

But there are things in an open world that have to remain persistent or your world will become nonsense. Nothing for the player that can be recognized is nothing good.

Well for one, have an engine that allows you to walk more than 10 minutes into one direction with my character controller without despawning the camera.
__________
(alternative answer)
__________
There is a huge difference between random generation and procedural because the latter adds many rules to your liking.
Procedural noise such as Perlin allows you to make height maps. The more "octaves" you add ( 0.5*perlin(frequency)+0.25*perlin(frequency)+) essentially (for i<n do  (i/2)*perlin(frequency) + (i/2*n)*perlin(frequency) ). Octaves = detail

This looks something like this:
a.PNG.c790ebee8e6b95c644c0c1887aaba462.PNG

If you wanted to add roads for instance you can generate a ridged fractal

b.PNG.5d1f1250895f41ae77bb0c7ba7809371.PNG
and you see where this is going. You would check for the "whiteness" and if it is above a threshold, generate a road texture. Alternatively, use line detection algorithms.

Same thing for the textures, but this is a whole different topic.Blender has good content on procedural textures e.g. Eevee procedural textures.
This looks pretty persistent to me, and if scaled up on a map you have roads and detail. Maybe you can think of rules to generate villages ?
It would require there to be a "straight" road patch, then make a origin in the center of that road, then generate some houses / npc's along the road and perhaps generate smaller "alleys" from the dot or orthogonal vector of the road.

  • Like 1
Link to comment

Very interesting ...

I never thought about this.

So you are generating the terrain depending on the height map, is that correct?

Would this run with an open third person cam game typ?

Quote

You would check for the "whiteness" and if it is above a threshold,

How do you do that???

 

 

1 hour ago, Slastraf said:

Well for one, have an engine that allows you to walk more than 10 minutes into one direction with my character controller without despawning the camera.

what do you mean exactly? I never had problems with cam and player.

I know the terrain is not infinite and over the choosen map size, things become to disappear. BUt 4096x4096 is big enough if performances stay ok, isn't it

Link to comment
12 hours ago, Marcousik said:

Very interesting ...

I never thought about this.

So you are generating the terrain depending on the height map, is that correct?

Would this run with an open third person cam game typ?

How do you do that???

 

 

what do you mean exactly? I never had problems with cam and player.

I know the terrain is not infinite and over the choosen map size, things become to disappear. BUt 4096x4096 is big enough if performances stay ok, isn't it

First you need some kind of noise funciton in lua.
https://github.com/Auburn/FastNoiseLite/releases/download/v1.0.3/FastNoiseLiteGUI-Win64.exe
this is an example program to make differnent kinds of noises (-> https://github.com/Auburn/FastNoise_CSharp)
This is perlin lua noise : https://gist.github.com/kymckay/25758d37f8e3872e1636d90ad41fe2ed
Here an explaination. http://adrianb.io/2014/08/09/perlinnoise.html

I have already implemented a noise generator in c++. 
This is the most important part :
 

    int roundedPosX = std::round(playerPos.x/tileSize)-offset;
    int roundedPosY = std::round(playerPos.z/tileSize)-offset;

	// skip calculations if player moved in the same chunk
    if(lastUpdatedPlayerPos.x==roundedPosX&&lastUpdatedPlayerPos.y==roundedPosY)
        return;
    else
        lastUpdatedPlayerPos = Vec2(roundedPosX, roundedPosY);

    const siv::PerlinNoise perlin(seed); // new chunk generation
    for(int x = roundedPosX; x<roundedPosX+chunkRows; x++)
    {
        for(int y = roundedPosY; y<roundedPosY+chunkRows; y++)
        {
          /**code skipped here */
            for(int i = 0; i<surface->CountVertices(); i++)
            {
                Vec3 xy = surface->GetVertexPosition(i);
              
                float xPos = (x+(xy.x*.5)); //the vertex position ranges from 
                float yPos = (y+(xy.z*.5));

                float height = 0.5*perlin.accumulatedOctaveNoise2D(xPos/(frequency), yPos/(frequency), octaves);
                height += 0.25*perlin.accumulatedOctaveNoise2D(xPos/(frequency)*2, yPos/(frequency)*2, octaves);
                surface->SetVertexPosition(i, xy+Vec3(0,height,0));

            }
          
            surface->Update();
            // enable physics
            //c->chunkModel->SetShape(Shape::PolyMesh(surface));
               
            c->chunkModel->UpdateAABB(Entity::LocalAABB | Entity::GlobalAABB);
            activeChunks.insert({Vec2(x, y), c});
        }
    }

It takes the player position , converts it to chunk coordinates and spawns chunks around the player.

For each vertice of a flat plane base we put the height of the vertice at the height of the perlin noise function. Thats it.
All other things, e.g. chunks, loading, unloading is up to you because you wanted to make a third person game so you want to load bigger chunks with more vertices so you can look further.
Honestly if I could go back I would do more reasearch for leadwerks plugins and write these things to the leadwerks internal terrain.
 

12 hours ago, Marcousik said:

You would check for the "whiteness" and if it is above a threshold,

How do you do that???

 

You look for each point on xz, the noise function returns for example -1 to  1. So if above 0.9 then generate road .

//edit

 

  • Thanks 1
Link to comment

Thx a lot for this.

Well this would change completly the structur and concept of what I wanted to do but I see the enorm positiv effect that it only generates what is needed.

The map 4096x4096 is big enough for a car game but a way to heavy to be filled correctly - I mean no way to have a game at 60 FPS.

With this technic of procedural it could be possible to have infinity, persistence and performance.

If we could generate more than one terrain on a map you could use this perlin noise function on little terrains used as chunk, it woulld allow you all terrain functions.

Maybe it is possible to load many little maps with little terrains and make this?

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...