Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1372181 Posts in 64711 Topics- by 56847 Members - Latest Member: SaysKez

January 29, 2020, 01:43:33 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsApple and Worm: Patching Holes In Spacetime
Pages: 1 ... 16 17 [18] 19 20 ... 28
Print
Author Topic: Apple and Worm: Patching Holes In Spacetime  (Read 38438 times)
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #340 on: July 29, 2019, 09:30:36 AM »

Player Controller

The original demo of the game uses a rigidbody. I think I did a good job with it because it really doesn't feel like a rigidbody. It's very precise and responsive. Occasionally you can get stuck here and there, so it's not perfect but it was promising.

Naturally I would like to make my new player controller a physicsbody but my physics implementation isn't as malleable as Unity's. I experimented a little and made some progress. It might be doable but it would require a lot more work to get a decent result. So I set out to make a more traditional implementation, where one checks for intersection at each displacement and corrects the displacement and slides along walls, but using my physics for checking intersections, so it uses a physicsbody as trigger thing. The physics body trigger is ignored in the collisions processing stage but it's still detected and the relevant functions are called when there's overlap.

Already expecting another crisis for when everything starts breaking down. But that never happened! The thing is working and I'm still super skeptical about it. The code makes sense and is small and good.

It took a few tweaks to the physics loop. I had a couple of loops comparing all bodies against each other, so I made a new function that compares one against all. It's the same code organized differently, and this new function is public so anyone can call it specifying which object it wants to check.

The reason for this is because the physics loop runs at specific time intervals and the trigger controller thing needs to be independent of that. So every time you move the trigger it calls this function to check for intersection and if it finds any, it rolls back the displacement along the normal of intersection.

That was the theory. I'm just surprised it worked in practice as well.



Needs some tweaking to prevent the jittering that occurs sometimes. The flags are working (I haven't implemented the walls yet, so those boxes don't change).

I'm calling this class that handles this displacement TriggerPawn. It handles the flags and MoveAndSlide(). So I can use this for the player controller or AI with additional scripts.
Logged

Prinsessa
Level 10
*****


Ava Skoog


View Profile WWW
« Reply #341 on: July 29, 2019, 09:46:16 AM »

Looking good! Kiss
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #342 on: July 29, 2019, 01:08:59 PM »

The reason for this is because the physics loop runs at specific time intervals
The irony of this is lost on everyone who hasn't studied Special Relativity and how clocks work in that context
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #343 on: July 29, 2019, 03:09:24 PM »

It was lost on me as well lol

Speaking of relativity, the idea of actual spacetime distortion (emphasis on time) crossed my mind. Unfortunately it's all kinds of paradoxical when space is connected like this, but it's a cool idea. I remember seeing a game based on spacetime distortions. Speed of light was reduced to something mundane, and the character would move and everything would contract, and you had to use this to cross through beams of light. Hard to explain.

Easier to just link the game. Here it is Velocity Raptor
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #344 on: July 30, 2019, 02:09:29 AM »

You got it now though, right? There is no universal clock in special relativity Wink

Oh, I remember that. You can also do fun stuff IRL if you play with slitscan photography:
https://blindedcyclops.neocities.org/pano/1.html

(I made that)
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #345 on: July 30, 2019, 04:57:53 PM »

Those videos of yours are absolutely mind boggling.

Anyhow, I continued to work on the trigger thing and also on a simple player controller. Still a bit twitchy but not bad, but integrating this with simulated physicsbodies is a problem I don't even know how to begin tackling. I might give physicsbody controller another try.

I also made the inevitable code that takes position from the room and returns equivalent position on the level mesh. This is important for positioning the camera. That was kinda tricky. It requires interpolating position inside triangles using 'barycentric coordinates'. Good thing I wasn't the first to try to do this, otherwise I would still be cracking my head to solve it.



Almost looking like a game again! Soon I will re-import apple to the project.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #346 on: July 31, 2019, 11:50:56 AM »

I  just spent the whole day trying to make a simple shader. That was time not well spent. Shader remains one of the hardest things for me to grasp. Even basic stuff, like I wanted to get the screen space position of the object. It took a million years but I finally learned that there is a variable that already contains it called screenPos, you just need to add it inside the input part of the code. All right then, I did that, then Unity rejected my shader anyway. But not just "that shader doesn't work" error message in the console, oh no no no! How could Unity stand idly while this unworthy code that doesn't work exists? So it modifies my shader adding a line that excludes this shader from dx11 blah blah, making any subsequent changes to this shader invisible in the editor until I delete this line. So debugging the shader is a continuous back and forth that includes removing this extra line.

I stripped down the shader to its bare bones to see which step it wasn't liking about this variable definition screenPos, which didn't help so I just gave up. Then I copied and pasted one example from the manual that contained screenpos. It was identical, just with renamed structs and functions, but everything seemingly doing the same job, and it works. Why, Unity? why when I type float4 screenPos; you freak out but when I copy and paste it you don't?

This is why I will not be pursuing shader coding again in the near future. Fuck that.  Outraged

All I wanted was a little shader that would create a fade ripple effect showing a texture. Hard to explain, but it's simple and totally replaceable with other methods.
« Last Edit: July 31, 2019, 12:14:15 PM by diegzumillo » Logged

Prinsessa
Level 10
*****


Ava Skoog


View Profile WWW
« Reply #347 on: July 31, 2019, 12:31:46 PM »

Hmm, never had that, weird. ): Didn't Unity add a visual node system for shaders recently? Maybe you'd have more luck with that.

Anyway, movement looks great in your latest GIF!
Logged

NovaSilisko
Level 3
***


Real life space alien (not fake)


View Profile
« Reply #348 on: July 31, 2019, 01:23:30 PM »

Hmm, never had that, weird. ): Didn't Unity add a visual node system for shaders recently? Maybe you'd have more luck with that.

Only if you're using the alternate render pipelines (lightweight or HD), annoyingly...
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #349 on: August 02, 2019, 07:12:54 AM »

A fun bug.

I haven't encountered a fun bug in a while. They are usually just annoying. This one is called 'spooky action at a distance'. I noticed whenever I move my physicsbody controller some nearby boxes seem to be pulled and pushed as well, like the controlled object is having some kind of influence other other objects.

My first thought was I must have messed up the function that applies the force to the objects and instead of iterating over all vertices of only the one physicsbody, it's applying the force to the first vertex of the next body of the list, maybe. Hard to imagine how I would do that.

The solution was silly. I made some recent changes to the collision handling code and forgot to re-add some ifs to check if the body is fixed. So what was happening is that the floor I was standing on was tilting slightly! and other objects on it would start sliding as I moved the controlled object.

By the way, this controller is indeed a new attempt at a physicsbody controller. It's going well, despite the bug that made my game look like it was possessed.
Logged

Prinsessa
Level 10
*****


Ava Skoog


View Profile WWW
« Reply #350 on: August 02, 2019, 07:26:45 AM »

Dang it, and here I was hoping you'd harnessed quantum entanglement!
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #351 on: August 02, 2019, 07:57:45 AM »

Breaking news: indy game devs accidentally hack together quantum computer in a weekend because they, quote, "actually introduced it as a bug in the software but then figured that this spooky action at a distance shit would create some mad juicy gameplay, yo, so we kept it as a feature".
« Last Edit: August 02, 2019, 12:49:50 PM by JobLeonard » Logged
ProgramGamer
Administrator
Level 10
******


The programmer of games


View Profile
« Reply #352 on: August 02, 2019, 08:54:00 AM »

Considering how many useful technologies have been developed in the name of making video games look and play better, it wouldn't surprise me that much if that actually happened.
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #353 on: August 02, 2019, 10:12:21 AM »

It wasn't this time. But I'll let you guys know if I revolutionize science by accident lol
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #354 on: August 03, 2019, 10:58:25 AM »

All rightie. I just "completed" two different controllers.

One that moves by directly moving a trigger object, that is, it doesn't participate in the physics simulation directly, only detects and reports intersections; and the 'physics' of this controller is done manually, by displacing it and correcting if any intersections were found etc. That is, a more traditional way of coding platformers. This is the one illustrated in the couple of gifs I posted earlier.

The other controller is by manipulating a physicsbody with forces. As usual, this route is trickier to get it feeling nice and precise, but it interacts well with other physics bodies.

I cheated a little bit though. Since I have access to the physics simulation I get to tweak it to my own needs. For example, one of the difficulties in a physics controller is controlling the speed. If you ever tried to do that with forces you know what I mean, simply adding a drag force -bv doesn't work like in real life, the discrete nature of the simulation will cause the object to twitch all over the place. And while simulations usually have drag programmed in it's hard to make use of it because it's the same to all directions. So I "cheated" by making a more flexible drag system. It works like this, every body has a directional terminal velocity; you set a direction and a limit in that direction and a limit in the perpendicular direction. That way I can tell the physicsbody to have a specific speed limit in all directions while in contact with the ground, but when you jump the up direction gets a different limit while the side movement is still limited by a specific side movement speed. This gives me control over the top speed in all kinds of situations and directions. This can be expanded for slopes, for example.

Second time it paid off to code my own physics. I'm almost not regretting it.

Now, both these controllers are bare bones implementations, just to help me decide which way to go. The physics controller is definitely a little more janky. BUT its lure is how well it plays with the other physics objects, and seeing how much I made use of physics in the demo this is an appealing selling point. Also, it is surprisingly more robust! The trigger controller works nicely on perfect surfaces only. When I tried running over tiles (each with its own square collider instead of a continuous smooth surface) it would get stuck and sometimes sink. The physics controller is like a tank! it just rolls over any rough surface, even with gaps. If there's a small step you don't even notice. If the step is high enough it becomes a ramp.

Anyway, I'm feeling like pursuing physics controller now.

Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #355 on: August 03, 2019, 11:19:48 AM »

Since I'm updating the devlog I might as well share the thing I need to do that I really don't want to because it's boring.

Positioning the camera is a process of taking two positions from the 'real space' to the 'mesh space' one is the position and the other is slightly above so I can calculate what is UP for the camera.

Anyhow,  I have the basics working already, but there is one edge case that messes up the whole thing. Whenever one of these positions lie outside a room. To correct that I need to rewrite the whole thing in a way that also finds which portal it's touching and which room it's entering and what's the position inside the room being entered.. and just typing this makes me want to die of boredom.

Can I declare this not a priority? it works fine as is! the camera does a little fart whenever you cross rooms but that's it.

You know what? I'm the president of this company and I say let future diegzumillo fix this.
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #356 on: August 03, 2019, 11:50:08 PM »

Since I'm updating the devlog I might as well share the thing I need to do that I really don't want to because it's boring.
You might get some useful feedback that way

(I got nothing)
Logged
Prinsessa
Level 10
*****


Ava Skoog


View Profile WWW
« Reply #357 on: August 04, 2019, 12:46:53 PM »

So exciting to see things finally coming together and working!! Kiss Kiss
Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #358 on: August 04, 2019, 02:05:45 PM »

So exciting to see things finally coming together and working!! Kiss Kiss

Yeee I'm getting all giggly!

Here's another wall of text with no planning whatsoever. Just getting stuff out of my system! In fact I am writing this paragraph after I wrote the text below and, whew! it goes round and round this one. Starts off confusing and ends slightly less confusing.

Here's what I've been thinking about for the past two days. Level structure and story. Previously the game was going to be a linear set of levels. Reach spacetime hole, jump to next level, repeat. Simple! which makes it even more ideal now that I am desperately trying to push this thing out of my life. And it matched the half-assed story I had in mind for the game, easily summarized as follows:

Apple and worm are chilling at home wishing for adventures. Interdimensional beings appear nearby, and they seem to be having fun researching and cataloging everything. Apple and worm watch enviously. Then assholecat (temporary name) would break their ship by pushing a rock on it, like cats do. Asshole cat is not evil, by the way, it's just a giant cat. Then apple and worm rush to help the aliens but don't reach them in time, whom casually go back to their ship and travel away in their now broken ship, which leaves holes behind now. The objective of the game is to follow the trail of holes to catch up to them and help fix their ship.

It all changed when I introduced the scale mechanic with the new implementation. Because now I can make entire sections of the game to be inside a grain of rice, and then you can leave the grain of rice and scale yourself to be the size of the galaxy, which turned out to be another grain of rice. You know what I mean? I have an artistic obligation to make use of this in the narrative! And I have a super cool idea for how to end the game which I'm going to keep to myself for now, but suffice to say it's making my life harder, both in coming up with a story that leads to it and a level progression that is simple and makes sense with it.

My plan is to first come up with a level progression that is simple, because the priority is to finish the game. Then come up with a narrative that works with it and with how I want to end the game. So (and this is me thinking while I write) it is possible to use the same story, with minor tweaks to how it progresses in order to reach the new intended ending. Which means I get to use the same level structure. Yeah... it is possible. See? this is why I write this devlog. The past two days I have this thing giving me anxiety, and writing it made it clearer.

Another thing I wanted to add to the level structure is a drop of backtracking. Not full metroidvania, because that would be like an anchor in this already slow project. However, the game could be linear even if it involves backtracking. I always felt this gameplay lends itself well for backtracking. I could have a fast travel system with a map that lets you revisit levels in orientation and scales you have already visited before to maybe find different paths. Oh wait. Branching levels? that's not linear. I'm getting anxious again  Crazy

But ok I don't have to think so hard at this stage. What I know by the end of this wall of text: same story, different ending, levels connected by the same old holes as before. I can work with that for now. The stuff in the previous paragraph requires this much to be working already anyway.

Here's my list of things to work on next but in no particular order:
  • Levels. Maybe even a demo. Exploring interesting mechanics, like the rotating block of the demo.
  • Bring back the Apple
  • Make art!

Notice how I'm pushing technical stuff for later like polishing player controller and fixing bugs. I feel like I need to bring the rest of the game up to pace.

Cheers yall  Coffee
Logged

Prinsessa
Level 10
*****


Ava Skoog


View Profile WWW
« Reply #359 on: August 04, 2019, 02:31:48 PM »

A story worthy of awards! I don't know what it is, but time travel and shrinking were always my two favourite story tropes and I can't wait to see what you do with the rice grain mechanic!!
Logged

Pages: 1 ... 16 17 [18] 19 20 ... 28
Print
Jump to:  

Theme orange-lt created by panic