Jump to content

Slastraf

Developers
  • Posts

    705
  • Joined

  • Last visited

Everything posted by Slastraf

  1. About the turn, I haven't used it as I needed to "snap" rotation in my case. Alternatively, have you tried adding a simple box collision to the bone, that dont ollide with each other, make the bones a joint of some sort, and then apply gravity to make it a ragdoll ?
  2. This is a really hard thing to do and unfortunately it only ever works with upright bone models. I made spider legs but modeled them like this place bone, do not rotate scale etc extrude it to the top Then it is possible to rotate them, but also only tested with setrotation()
  3. Personally I would use leadwerks stream and make my own parser and file system depending on what I need for example names.data foo bar then loop trough all the lines and read all the data into an array
  4. 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. 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
  5. 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: If you wanted to add roads for instance you can generate a ridged fractal 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.
  6. 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.
  7. 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
  8. I see, but I talked about actual roads to drive on, that can be placed in the terrain.
  9. Hey that looks really good. Do you want to collaborate on a procedural road decal ?
  10. I also had trouble in the beginning with the default project settings
  11. I had this happen so often to me over years on random applications and feels like this has bugging me ever since.
  12. can we "crossfade" models into the terrain as found in unreal engine ?
  13. Theres always risks not running everything correctly in the browsers. Opera offers anti tracking, free unlimited vpn and addons and built in whatsapp twitter etc.
  14. It seems to be very small at 4000 aswell. In this scene I put the size to 4000 in the editor and did the same thing from before but the player still disappeared. This is a major issue to the game I want to develop, and even still this should not be the limit to this engine. 2021-05-22 19-06-11.mp4
  15. this is enough for collision but to maek your actual wayve more interesting you could add smaller noises at higher frequency than the big wave. https://www.shadertoy.com/view/MtsXzl
  16. I see. You don't need a displacement map. This can easily be calculated this is basically a cos function in the range of [0, 8*pi] pixel(x,y) = cos((y/height)*3.1415926*8) Just to give you a headstart. To get the color information you would use the function from above like this disp = (pixel(x,y)*0.5+1)/255 because cos goes from -1 to 1 and if we add one it goes from 0 to 2, then multiply by 0.5 to get from 0 to 1 and divide by 255 to get the color intensity.
  17. The shader still calculates the height of the wave trough a function. It must contain sin / cos. If you copy that function to lua with the same parameters, it will have mathematically the same result. Which parameters would need to be converted from leadwerks global space to whatever space the shader operates.
  18. Slastraf

    Introduction

    This looks very exciting. Every finished game should have some sort of combination of post effect shaders, because these add just something to the game. Really looking forward for 52 shaders !
  19. You would need to get the surface of the model. Not tested here I will give you a tip: local model = Model:Load("Models/Grass/grass01.mdl") local surface = model:GetSurface(0) local smallest = nil for v=0,surface:CountVertices()-1 do local position = surface:GetVertexPosition(v) --multiply by scale (you mentioned 1500) local vertDistance = self.entity:GetDistance(model:GetPosition()+(surface:GetVertexPosition(v)* 1500)) if smallest == nil or vertDistance < currDistance then currDistance = vertDistance smallest = v end end local posOfNearestVert = model:GetPosition()+(surface:GetVertexPosition(smallest)* 1500) This probably wont work on the first try, but is an example on how to approach this. Also you cannot directly get the vertex, but the position as presented
  20. You might use https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_SetOcclusionCullingMode SetOcclusionCullingMode to true or false and look at the results. For this you need to add a script to each decal, or make a "decal handler" that sets this for every decal entity.
  21. I have newest gfx drivers .. And some more files: FPSPlayer.lua start.map
  22. Update, in the video even an empty project with the fps player and high movement speed, I can get to the "edge". In this case it seems to be at z + ~1503 and 1513 How come this happens ? 1020164982_2021-05-1413-46-07.mp4
  23. I have not come closer to the issue, but it might be that I am setting the camera position by SetPosition and the player does not "move", I also place him with SetPosition. Maybe some kind of vector doesnt update the position ?
×
×
  • Create New...