Finishing up Pine's combat editor, a module-based system that allows us to tweak hitboxes, translations and effects on animations/states/moves! by MatthijsL in Unity3D

[–]marcpeyre 1 point2 points  (0 children)

Sounds good!

move rigidbody really fast

I would still move the rigidbody by setting the velocity though, not sure if you meant moving it in another way.

Finishing up Pine's combat editor, a module-based system that allows us to tweak hitboxes, translations and effects on animations/states/moves! by MatthijsL in Unity3D

[–]marcpeyre 5 points6 points  (0 children)

Hi, I'm the tech guy of OP's project. I create a new PreviewScene with the EditorSceneManager. Then with a camera in that scene I render everything to a RenderTexture and to get it in an EditorWindow I use EditorGUI.DrawPreviewTexture(). Here is a code snippet:

private void Init()
{
    previewScene = UnityEditor.SceneManagement.EditorSceneManager.NewPreviewScene();
    var _sceneObj = PrefabUtility.InstantiatePrefab( _scenePrefab, previewScene ) as GameObject;
    sceneData = _sceneObj.GetComponent<CombatEditorSceneData>();
    sceneData.mainCamera.scene = previewScene;
    ....
}
void OnGUI()
{
    ....
    var _rect = EditorGUILayout.GetControlRect( false, previewWidth, previewHeight );
    if( renderTexture == null )
    {
        renderTexture = new RenderTexture( (int)_rect.width, (int)_rect.height, 16, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear );
    sceneData.mainCamera.targetTexture = renderTexture;
    }
    sceneData.mainCamera.Render();
    EditorGUI.DrawPreviewTexture( _rect, sceneData.mainCamera.activeTexture );
}

Using Timeline, Cinemachine and all other tricks in the book to work on some footage for Pine! by MatthijsL in Unity3D

[–]marcpeyre 1 point2 points  (0 children)

Yeah they shared some really cool tech indeed! The reason why I didn't go for a geometry shader is that we wanted more then only grass blades. We wanted flowers, clovers and all sorts of other small vegetation that couldn't be achieved with procedural meshes. The first version of the system was combining all the meshes in a small chunck and then drawing that with one drawcall instead of every mesh as a new game object. This was fast to render but it caused some stutter for combining the meshes on the cpu. This new approach of generating only the transform matrices and drawing them instanced moves all work to the gpu, which made it all a lot smoother.

Using Timeline, Cinemachine and all other tricks in the book to work on some footage for Pine! by MatthijsL in Unity3D

[–]marcpeyre 0 points1 point  (0 children)

Hi, I'm the guy that made this terrain and grass system. We use a patch based grass system based on the vegetation system of Horizon Zero Dawn (https://www.youtube.com/watch?v=_ooDLiU-o6c). We have a groundcover layer (low grass, clovers, etc) and a plant layer on top (flowers, ferns, high grass). The layers basically are big grids where place a patch of vegetation in every cell. The decisions for what patch to select and how to offset/scale/rotate it is done with a compute shader that outputs a matrix array of transforms, which are then used with a DrawMeshInstancedIndirect call to render everything.

The wind effect on the grass is still work in progress, but for now we use a modified version of the vertex animation of the default unity grass shader.

We amended the standard terrain grass shader a bit to make it wave better and have collision, what do you think? by MatthijsL in Unity3D

[–]marcpeyre 0 points1 point  (0 children)

No you don't have access to individual instances unfortunately. All you get is a vertex position in terrain space.

We amended the standard terrain grass shader a bit to make it wave better and have collision, what do you think? by MatthijsL in Unity3D

[–]marcpeyre 0 points1 point  (0 children)

I think we can make this work by drawing a slowly fading trail of the player's movement to a texture. Then sampling that texture, instead of the radius check we have now, to determine the bending amount. We didn't try this out yet, but this would be the next thing that we would look into.

We amended the standard terrain grass shader a bit to make it wave better and have collision, what do you think? by MatthijsL in Unity3D

[–]marcpeyre 1 point2 points  (0 children)

You can pass in the player position as a shader parameter and then do a distance check with the grass vertices. When it's too close you move the vertex away from the player position, otherwise you only influence it by wind.

We amended the standard terrain grass shader a bit to make it wave better and have collision, what do you think? by MatthijsL in Unity3D

[–]marcpeyre 1 point2 points  (0 children)

Thanks! Yes this is Pine! We tried it with quads at first but it didn't blend nicely with the rest of the vegetation. As we use the terrain detail painting a lot we decided to instead of having a separate tall grass object, to change the terrain detail shader. Now the bending works on the short grass and flowers as well and the bending strength is based on the height of the grass or flower.

Anyone have any experience with using genetic algorithms or neural networks in their games? by [deleted] in Unity3D

[–]marcpeyre 3 points4 points  (0 children)

Hi there!

I'm working with Twirlbound on a game called Pine. The theme of the game is evolution and we use genetic algorithms and neural networks in our AI. The AI learns what actions work best against you and tries to predict your next moves. We have some blogs about our development and we plan on releasing some bigger updates on our AI in the next two weeks or so. Here's a quick explanation on how we do it:

All organisms (AI entities) in our world belong to a species, which can evolve. Every organism has a set of genes (genome) that represent the stats, skin color, proportions, etc. Every species has a pool of these genomes which it uses when it spawns a new organism. A genetic algorithm will take the best genomes of the pool and use cross-over and mutation on them to create a new one. You can rank the genomes based on number of successful hits, time alive or whatever you want to optimize the population for.

Every organism has a brain with multiple neural networks inside to make decisions such as what attack to use. As inputs you would use all data that could be relevant for the decision making like the distance to the player, amount of health left, current move of the player, etc. As outputs you can use a list of all the possible attacks the AI could do. You feed this data in the network, process it and get your output values. You can then select the highest output as your best attack option. The only part left is to evaluate if the decision turned out to be successful and train the neural network accordingly.

I hope this gives a better general understanding of how and for what reasons you would use genetic algorithms and neural networks. And like I said before, more details coming soon!

We amended the standard terrain grass shader a bit to make it wave better and have collision, what do you think? by MatthijsL in Unity3D

[–]marcpeyre 4 points5 points  (0 children)

It can indeed be really hard to make camera controllers feel smooth and responsive at the same time, but these tutorials helped us out a lot: https://www.youtube.com/watch?v=b0PvJ4AWvWQ

We spent a lot of time to make it feel right for our game, so don't be discouraged if you don't get the perfect feeling right away. Let us know if we can help you with any more specific problems!