Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411505 Posts in 69374 Topics- by 58429 Members - Latest Member: Alternalo

April 25, 2024, 09:40:08 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsApple and Worm: Patching Holes In Spacetime
Pages: 1 ... 18 19 [20] 21 22 ... 33
Print
Author Topic: Apple and Worm: Patching Holes In Spacetime  (Read 69290 times)
GamesInHouse
Level 0
***


View Profile
« Reply #380 on: August 13, 2019, 09:14:42 AM »

Very smart level design and cute little game!
Logged
JobLeonard
Level 10
*****



View Profile
« Reply #381 on: August 13, 2019, 09:35:46 AM »

Hyper Markos Cheesy
It is I, Markos!
Nobody puts Hyper Markos Down!
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #382 on: August 13, 2019, 11:44:00 AM »

Speaking of Hyper Markos, here's a creature from his world which is a completely original character with no inspiration from anything else in the world. I call it Lamboogly.



Here's how this character works in the game. I decided the game won't have hazards, like it does in the old demo. So no spikes, no enemies, etc. Lamboolier doesn't hurt you. And if you try to jump on this dude's head it just squishes until you jump out of it. Unless you happen to be much smaller than it, then you bounce and can reach higher up. Spikes and spring mushrooms are a bit overdone, aren't they?
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #383 on: August 14, 2019, 12:08:45 AM »

No-death puzzle platfomers are where it's at
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #384 on: August 14, 2019, 06:26:05 PM »

Here's something that never happened before in this project.

I decided to try using polygons instead of tiles because creating collider for tiles is tricky with how I set things up. I remember I once made a polygon system (it's the one in the demo), which creates a textured mesh, with another mesh strip around so you can have some grass around a block of stone for example. Then it used a polygon collider. I thought about using that version I did, but it was pretty crap, it worked but there were a million warnings in the terminal that I chose to ignore. Besides, Unity has its own 2D polygon solution now!!

So I spent the entire day fighting with this 2D polygon system. It doesn't work. I mean, it almost does but it's way too unreliable. Sometimes I hit play and the thing changes shape completely. It doesn't have basic parameters to position the corner and edge sprites. No parameters for snapping. I coded my own snap feature to try and fix it. But it's a struggle to accomplish the most basic things. When I finished my snap thing that does what the original snap should do I realized I was again doing that thing where trying to use a native feature is more work than doing my own.

So that's new. Get it? Because sarcasm.

In its defense, the sprite shape thing is a feature still in preview mode, and one shouldn't expect a reliable tool yet.

*sigh* I'll go dig up my old polygon maker thing. Christ I think it's in Java script... 
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #385 on: August 15, 2019, 05:35:31 PM »

AHA! I just noticed Unity has a 9-slice sprite thing implemented. AND IT WORKS! It's not as flexible as my previous solutions with tiles with all kinds of corners. It only makes quads. But do you know who has two thumbs and doesn't give a shit? THIS GUY  Hand Thumbs Up Left Grin Hand Thumbs Up Right (which is me).

Let me reiterate that. I am using a native feature from Unity. It is working. It is an actual solution to a problem I had. This is a happy day.

New development philosophy values quick and effective solutions. And I can layer the quads and it looks pretty nice. I can have quads with all grass on all sides, and others with only one or two sides etc. This totally works.



The whole tile vs polygon crisis, entitled Operation ground control to major pain in the ass, is now over. Despite loving the name I am glad it's done. Long live simple quads.

Next step: player controller needs some serious tweaking still. It's not presentable at all. And I'll also start working on the new demo, as that will also help decide all other things needed. All the other stuff that games need to exist, like level structure, save and load, dialog popups, etc. Sometimes you need to jump on the horse to realize all the things you still need to do before you can actually ride the horse. I just made up that analogy and it does not work very well; it would be very dangerous to do that with a real horse.
Logged

Superb Joe
Level 10
*****



View Profile
« Reply #386 on: August 16, 2019, 12:23:24 AM »

take it from me, a sega saturn owner, quads are perfectly adequate
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #387 on: August 16, 2019, 08:00:26 PM »

take it from me, a sega saturn owner, quads are perfectly adequate

True that!

I spent the day trying to iron out the camera farts. It took a lot more work than anticipated. I rewrote some of the code from scratch. It took a while to find all the fart scenarios, because they happen at moments hard to reproduce, near the intersection of rooms, and with specific angles, speeds etc. Here's an illustration of my day:



Make tiny change, compile, run, jump 30 times, examine printout, repeat.

But eventually I managed to get and fix all the cases that generated bad position and orientation. I think. But I was still left with some reasonable discontinuities. Reasonable because they are expected from the way I implemented, and are just small twitches. These were "solved" in the most gloriously hacky way: an if statement checks for changes in magnitude of a vector, if the new vector is too different from previous, I lerp between them... I know, I am not proud of it, but I'll be damned if it doesn't work flawlessly! look at this. Nice and smooth.



Don't mind the hyper jumps. Debug movement with infinite double jumps activated.
Logged

nova++
Level 4
****


Real life space alien (not fake)


View Profile
« Reply #388 on: August 16, 2019, 08:20:19 PM »

Maybe a dumb question, and maybe it's been asked before, but why not have the camera's rotation match/follow the player's rotation? The apple doesn't seem to do any sort of jittering like that. Or is that what you've been doing, and it was still freaking out?
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #389 on: August 16, 2019, 08:28:26 PM »

It's not a dumb question. The Apple you see there on the screen is a rendered version of it on a mesh, that's why it's so smooth. However to point a camera at the mesh I can't 'render to texture' the proper position and orientation, that needs to be fetched with lots of math.

Here's a look behind the curtains (old gif but same idea)



Above the textured mesh, below the actual objects and the cameras rendering them.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #390 on: August 17, 2019, 12:57:46 PM »

Very smart level design and cute little game!

Thanks :D I didn't see your comment before. This usually happens when the thread gets a new page.

Some landscape stuff



EDIT: fixed image url

« Last Edit: August 17, 2019, 08:59:01 PM by diegzumillo » Logged

oahda
Level 10
*****



View Profile
« Reply #391 on: August 18, 2019, 02:02:08 AM »

that face is mine when i look at this game!!
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #392 on: August 18, 2019, 03:32:39 PM »

Aw thanks!  Coffee I just hope the end result matches half your expectations.
Logged

ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #393 on: August 19, 2019, 03:22:34 PM »

I love this sun

Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #394 on: August 19, 2019, 03:34:32 PM »

lol

Quote
I love this sun

I think you have to be a president to be able to say that.
Logged

ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #395 on: August 19, 2019, 03:42:28 PM »

Well then I'll just have to get into an election.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #396 on: August 21, 2019, 02:09:53 PM »

I've been stuck on the grid problem for some time now. I think it's time for another wall of text of very little value to everyone else besides me. Hopefully writing about it clears things up.

In fact, I discourage you from reading any further into this post. Just stop. Go read other devlogs. I promise I'll come back with fun posts with gifs later.

The problem: The sole reason for giving up on this game for more than a year and eventually restarting development was visual communication. People would play the demo and even beat all levels without fully grasping the main gameplay element. So drawing a grid is not just simple cosmetic luxury, it's important as it is part of my main strategy for addressing the problem, together with making space actually deform. And it's giving me a lot more trouble than I expected.

Here are some possible solutions I thought in no particular order.

A very easy to implement solution, but that might be more time consuming in the long run, is like this: After finishing the level mesh I 'bake' the uvs to a texture, then I duplicate the level mesh and apply the uv texture to one of them. Simple. But I would have to do this to every level mesh. That could be fine but right now I don't have a fixed workflow for making level meshes, and currently I'm doing small tweaks to the mesh and its uvs inside unity using Probuilder, which messes up the idea of baking the UVs in a 3D editor. It sounds like a lot of back and forth.

Another solution would be a wireframe shader. I found one online and it's the one in the previous screenshots. But it's pretty bare bones and ugly. This is my strongest candidate so far. It works and requires very little effort, even if it's ugly and uninteresting.

I tried coding my own shader to make something prettier but gave up. I'll leave black magic to Prinsessa. I could shell out a few bucks for one of those paid assets but I had bad experience with paid assets and I usually end up not using any of it.

Eventually I decided to see what could be done with the shadergraph, so I switched the entire project to the lightweight rendering pipline, which converts every material in the project and makes the editor considerably more sluggish and unstable with an obvious memory leak that requires closing and opening the editor every 30 minutes. And of course I forgot to back up the project before doing that so if I want to go back now it's gonna be a long and boring afternoon. But anyway, I played around with the shadergraph thing. It can do some pretty nifty stuff with very little effort, but it can't do wireframe lol. I did however managed to make a shader that creates transparency ripples around a given position (which can be the player position) and that can be paired up with a grid texture. However, since parts of the level are not the same scale, the grid is not aligned by default and there is no simple way to achieve that.

So the above solution requires a grid texture that is aligned across all sections of the level mesh. A baked UV would achieve that. Another solution, which I tried and failed, is to rearrange the UVs of the level mesh (not the original, of course) to make all triangles have its vertices on (0,0) (0,1) (1,1) and the grid texture would be just a triangle. That might work but I didn't have any luck with my quick jabs at it.

Another possibility is to not use shaders at all. Instead I draw the lines of the mesh with something like LineRenderer, which creates billboards following a set of points. I haven't tried it but my gut tells me this isn't efficient. Besides, I don't really know how to define the lines. There are no 'lines' in the mesh definition, we have vertices and triangles (list of indices of vertices). But I'm sure there's a solution here, if I feel like taking a stab at this.

Yet another solution is to not do the grid on the 'real' space, not on the level mesh. I think some of the screenshots above are also using this method. The main difficulty with this approach is the the grid of each Room is a different object, so if I wanted to add ripple effects and the like I would have to face the problems of Room communication. You know, all those portals problems that made me wanna die for the past few months? yeah, I'm not eager to jump right back on them. They work and that's all that matters.

Jeez, I finished writing this wall of text without a single eureka moment. The main problem seems to be making it look pretty. If I lose the pretty requirement then the problem is already solved in two different ways. I guess I have to face the facts and just accept that I should move on with an ugly solution. At least not make beauty a priority, and continue to work on the game until another solution for this pops up.

Hey look, it wasn't an eureka moment but I did organize my thoughts and made a decision. Big wall of text works all the time.

Crap, I'm gonna have to roll back the render pipeline thing, aren't I? Doesn't look like it adds anything to the project, I tried just to see if I could do a decent wireframe and that didn't work. And since it's still in preview (I think) I'm experiencing a lot of crashes now. Maybe I did upload the project to the cloud.

I bet you thought the wall of text was about to end 3 paragraphs above. And by 'you' I mean me, who the hell reads this drivel? No, it's still going on. But I just want to organize the conclusions and next steps:

  • Wireframe won't be pretty for now
  • Roll back LWRP
  • Get back to the demo (which I didn't really start)

Oh yeah (wall of text not over yet) player controller is in a presentable state now. Not perfect by any means but decent.

OK, NOW wall of text is over. If you read this far, how could you? I asked so nicely. If you cheated and only read the final line that's better.
Logged

oahda
Level 10
*****



View Profile
« Reply #397 on: August 22, 2019, 05:19:33 AM »

OK, NOW wall of text is over. If you read this far, how could you? I asked so nicely. If you cheated and only read the final line that's better.

Oh, but I did read it all! Evil

I tried coding my own shader to make something prettier but gave up. I'll leave black magic to Prinsessa.

If it's not too much work, I'd be happy to do you a favour, no strings attached, and whip something up for you!

I had a look at wireframe rendering in Unity and I got sad looking at all the complex and potentially not cross-platform / mobile geometry shader stuff going on so I thought there ought to be a much simpler way, and I came up with this…

Code:
Shader "Custom/wireframe"
{
    Properties
    {
        _Colour ("Colour", Color) = (1, 1, 1, 1)
        _Thinness ("Thinness", Range(0.0, 1.0)) = 0.5
    }

    SubShader
    {
        Tags { "RenderType"="Transparent" "Queue"="Transparent" }

        ZWrite Off
        Blend SrcAlpha OneMinusSrcAlpha

        Pass
        {
            CGPROGRAM
           #pragma vertex vert
           #pragma fragment frag

           #include "UnityCG.cginc"

           struct appdata
           {
               float4 vertex : POSITION;
               float2 uv : TEXCOORD0;
           };

           struct v2f
           {
               float2 uv : TEXCOORD0;
               float4 vertex : SV_POSITION;
           };

           fixed4 _Colour;
           fixed _Thinness;

           v2f vert(appdata v)
           {
               v2f o;
               o.vertex = UnityObjectToClipPos(v.vertex);
               o.uv = v.uv;

               return o;
           }

           fixed4 frag(v2f i) : SV_Target
           {
            i.uv = abs(i.uv * 2.0 - 1.0);
            return ceil(max(i.uv.x, i.uv.y) - _Thinness) * _Colour;
           }
            ENDCG
        }
    }
}

Which looks like this:



It does have one prerequisite but a simple one: each face must be UV mapped correctly, but it's as simple as just selecting everything in Blender and resetting UV so that each face covers the entire map:



After that you don't really have to worry tho, and you can keep deforming things with Probuilder since the whole point is that each face should be UV mapped to a square and not deform with the mesh:



Only downside here is that if you scale the mesh, the thickness of the lines scales with it:



But I'm sure I can fix that if it's a big issue!

Since the basic shader is so simple, it's pretty easy to add additional effects without worrying about breaking it. c:
« Last Edit: August 22, 2019, 06:21:06 AM by Prinsessa » Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #398 on: August 22, 2019, 06:43:13 AM »

Prinsessa for the win!

I fiddled with the concept of collapsing the uvs, because then a simple texture with a cross in the middle would already work. In my laziness I made a small code the collapse UVs for me, but with triangles, which didn't work very well. Now, the advantage of doing it in a shader is that you have some more control over it and is expandable to make it pretty.

I'll try not abusing your kindness too much, but do you know if it's possible to do position related effects in this? I did it with the shadergraph thing using a "position" node (it looks like fragment position but I'm not sure what it is) and a vector3 property I have to update in runtime (with, say, a character's position).
Logged

oahda
Level 10
*****



View Profile
« Reply #399 on: August 22, 2019, 06:59:08 AM »

… Hahaha, ooooh wow, now I feel very thick for not realising I could just do exactly this with a texture instead of maths. Cheesy

Position stuff is no problem! I'd be very surprised if the nodes can do things hand-coded shaders can't. It's just material.SetVector("_Property", value) or something like that in C# after slapping on a vector in the Properties {} block at the top of the shader, then defining the uniform float3 _Position in the main block and then using that in the vertex or fragment function.
Logged

Pages: 1 ... 18 19 [20] 21 22 ... 33
Print
Jump to:  

Theme orange-lt created by panic