Title
Impulsing The Game – Game Development and other Gaming Pursuits
Go Home
Category
Description
Address
Phone Number
+1 609-831-2326 (US) | Message me
Site Icon
Impulsing  The Game – Game Development and other Gaming Pursuits
Page Views
0
Share
Update Time
2022-06-10 09:57:30

"I love Impulsing The Game – Game Development and other Gaming Pursuits"

www.aniamosity.net VS www.gqak.com

2022-06-10 09:57:30

Skip to contentSkip to navigationImpulsing The GameGame Development and other Gaming PursuitsWait… What? by aniamosityMay 14, 2022Ah yes. Definitions.Who: “What person or people”When: “At what time”Where: “In what place or at what location”Why: “For what reason or purpose”How: “In what way or manner”Hmm… Those all use “what”. Let’s go see what’s “what”.What: “used as an interrogative expressing inquiry about…”Thanks. That clarifies things. We don’t really know what “what” is, but we do know how it’s used.So the next time someone asks you, “Which is the odd one out of ‘who’, ‘what’, ‘when’, ‘why’, etc.”, now you can tell them.UncategorizedLeave a commentFurther Thoughts on The Three Bears as Code by aniamosityMay 7, 2022May 7, 2022After writing and uploading the previous post about a computer programmer stylized rendition of “The Three Bears” (https://www.aniamosity.net/if-authors-wrote-stories-the-way-programmers-write-code/), I spent a good deal of time reflecting on what I had done. And there ended up being some interesting aspects to the process I went through that might cast some light on what we do as programmers when writing and refactoring code.So I wanted to dive into that a bit…The first question might be, “What was the process you used to arrive at that?” And there were different aspects to that.High-level StructureThe initial step was to look at the overall story and see what the meaningful chunks were. It ended up being roughly along paragraph boundaries, but not exactly. In fact, the initial paragraph made more sense to split into two, semantically, since they’re actually about different aspects of the story. (That could be considered a “bug” in the original story’s use of paragraphs.)I actually think the high-level steps in Story give a pretty good overall sense of the progress of the story – that is, if you know what they mean. So that can be useful in computer code as well: by pushing lower-level details down into functions, you can allow someone to get a good sense of what a function is doing at a high level.This raises an interesting point, which I hadn’t thought of before:It’s easier to understand the lower level details when you know where they fit into the higher level structure.Someone who has read The Three Bears, for example, can know exactly where this fits in:define Sitting_In_My_Chair: Someone's been sitting in my chairThey can see that small piece and understand its role in the overall story.There is the counterpart to that as well:It’s easier to understand the higher level structure when you know what the lower-level details do and where they fit.Something like the overall structure of Story is only as clear as the step names can offer – and you can only put so much information into a name. That is one of the problems I have with the idea of “self-documenting code” as a sort of excuse for having virtually no comments in code: identifiers are of necessity limited. They can only contain and convey so much information.However, once you know what they mean, then they can be good shorthand for things. Once I know what happens in Girl_Chairs, for example, I can just look at it as “the part where she interacts with the chairs”, and if I later want to find where the bears discover she has eaten the porridge, I can quickly jump to Bears_Food – once I know that that’s where it is. On the other side, if I know the overall arc of the Three Bears story, I could probably jump right there even if I had never seen this particular “code” before. I can map what’s in my head onto the story’s structure.You can move your level up and down within the code. I think it could be argued that decomposition works best when the view level of the code goes down as you go down into sub-pieces and vice versa. Beware of decomposition where the result is actually at the same level. That can point to an arbitrary creation of concepts rather than a refinement of concepts.Extracting Common ConstructsMoving on, another aspect of the “codifying” was to extract some constants from the code. Now, that wasn’t necessary, but it can have advantages later. It might be a bit silly to generalize “porridge” as {Food} or to allow the name of the girl to not be “Goldilocks” – “Ms. Locks”, perhaps? On the other hand, I have seen the bears named “Papa Bear” and “Mama Bear” instead “Daddy Bear” and “Mummy Bear”. By having constants outside of the main body that can be changed, then all of their references will change automatically, if so desired.The structure of the story is the same, but minor details can be easily changed, on a whim.This is the first part of what is typically referred to in software development circles as “DRY” or “Don’t Repeat Yourself”. Consolidating repeated values like names into overarching constants or variables (or doing so with bits of code into common functions) offers at least two advantages:1) You can easily change the value of all instances of one of them at once by changing the higher-level definition.2) By making them all refer to the same thing (for example, Girl for “Goldilocks”), you are saying, “These things are all the same.” That might seem obvious in this case, but there will be cases where that isn’t true. Having that additional clue when looking at the code makes it easier work with, because you know what is meant to be the same and what isn’t.When refactoring, we need to differentiate between things that happen to be the same and things that actually are the same, especially when we consider coding them as the same thing.Consider, for example, my injection of Bear_Scene to replace the three repetitive bear sections. On the surface, it seems reasonable: if you look at those sections, they are basically the same as each other, structurally, with just some minor differences in wording. However, I made a mechanical decision, which is that I would make them all be expressions of the same pattern simply because it worked to do so. I really don’t know if the author deliberately intended that they would be the same or should be the same or if it just worked out that way. In other words, I don’t know if the pattern I ascribed to them is a deliberate pattern or just something accidental. That might seem like a very nuanced (and maybe pointless) point, as the code works, but when you’re working with software, the distinction in semantics can become important if things need to change later. By forcing the text to fit the pattern (and I sneakily did that by changing Daddy_Bear’s dialogue tag from “growled” to “said” in the chair section to make it fit – does that violate the requirements?), it then becomes much more difficult later to change things if, for example, we need to add an additional line into one case but not the others.The pattern works while it’s a pattern. But if things need to change in one case, then the question becomes, “Do I need to remove this case from the pattern, or do I need to extend the pattern to cover this varying case?” And you can typically do it either way, though if you do the latter too much, it can lead to horribly complicated code with lots of exceptions and variability, trying to account for variations in a pattern that might not actually be a pattern anymore.This is where it really helps to understand what the code actually means. But we can’t always have that insight, especially when it’s code written by others.Objectifying the BearsAfter some initial breaking down of what varied in the various scenes, I discovered I had a number of constants like “Daddy_Chair_State”, “Mummy_Chair_State”, “Daddy_Chair_Size”, etc. where all three bears had the same set, and I had unique calling cases for each bear. At that point, I saw I could invert things a bit by dividing and consolidating the constants into structures, one for each bear. Then the other chunks could look at which bear was in play and use its values. I could just pass the bear around instead of the values within, and the underlying chunk could pick out the part it needed.So “Daddy_Chair_State”, for example, became “bear.chair_state”, where “bear” could be one of the Daddy_Bear, Mummy_Bear or Baby_Bear “things”.This isn’t really “object oriented”, in that there is neither encapsulation nor even any inheritance. It’s really more “structured data”. In fact, I made a point of using “thing” instead of “object” (which had connotations) or “struct” or “structure” (which sounded techie and even language specific).There is possibly more that could be done along those lines. But then, there’s a limit to the gains you make, and doing too much can lead to code being harder to understand, even if it “works”.This leads us to some of the difficulties I noticed during this exercise.The Difficulties with CompressionAs I mentioned before, it’s easier to understand the lower-level pieces when you know where they fit into the higher-level structure. That is one reason why the person writing the code is in a better place to understand the decomposed, semantically compressed code, as they (at least when they wrote it) have the full picture in their mind of what it all means and where it all fits together.Someone coming onto the code for the first time won’t have that advantage. And that is something I think we need to be aware of as programmers: that someone else won’t have the same mindset that we do, even if “someone else” is us 5 years down the road. (Though, in all fairness, I tend to find it easier to get back into a mindset I once had, even if I’m not in it at first when encountering old code.) It might make sense for us as the all-knowing programmer to keep breaking the code down into smaller and smaller pieces, as we know how they all fit and – more importantly – what they all mean. But someone else won’t, at least not at first. At that makes the code harder to understand, if the pieces become so small that they have little semantic information on their own, or if the divisions are along syntactic lines rather than semantic lines, where it becomes hard to work out what something actually means.Take, for example, the Said_Food_Is chunk. That is exactly one line, and it’s used in exactly one place. That came into being because I originally replaced a few separate lines with that (doing a sort of textual replacement), and then later when I compressed the resulting structures using those lines into one thing, it became a single instance again.The question is, “Is this chunk useful or does it make the code harder to understand?” Initially, it had a use, as it replaced several common sections. But I would postulate that, now that it’s back to a single use, not only does it not serve a purpose, but it makes the code harder to understand, as the name for it doesn’t add any useful information and it’s just another level of indirection. It becomes just another concept to have to deal with when understanding what is happening. The decomposition has gone too far.What’s interesting to consider is how “helpful” decompositions differ from “harmful” decompositions. If you look back at the original Story breakdown, it felt “helpful” because it allowed us to operate at a higher level and gain an understanding of the code at that level, without having to plow through all the low-level details. It actually added information, by providing a structure that we might not have noticed otherwise. However, the Said_Food_Is chunk doesn’t have that benefit – it doesn’t take us up or down levels. It’s just a replacement with no value. It is introducing an extra step to go through, but it doesn’t offer any additional insight, whether it be structural or “these things are all the same”, which is what you get when replacing things used in multiple places. It’s barely a separate thought, and yet it’s trying to be one.The Difficulties with AbstractionI wanted to look at one more chunk, which is the Bear_Scene one. This is really a template to be filled in. And it works for what it needs to do. However, if you were to hand that to someone outside of the context of this code, it would be hard to get a good sense of it. I mean, you could see what it does, but you may not know exactly what it means. And this is something I have noticed often in code, which isn’t a 100% generality, but it happens often enough to make it worth watching out for:While it can feel good to find patterns and generalize the code through common abstractions for those patterns, abstractions tend to be harder to initially grasp than concrete code.Again, I wouldn’t say it’s generally true. Things like templated or generic containers, for example, have good semantics that make immediate sense. However, other abstractions – especially if they don’t have a unifying concept behind them – can be harder to grasp until they can be placed into context so their usage can be seen. We can extract the pattern out, but not all patterns have good semantics outside of the code that uses them, which would allow them to stand on their own in our minds.UncategorizedLeave a commentIf Authors Wrote Stories the Way Programmers Write Code by aniamosityMay 6, 2022May 11, 2022There is a saying in coding circles that code should read like well-written prose. While on the surface this sounds like an admirable goal, we’re actually taught to break down our code, which can lead to it being hard to follow and understand if done to too fine a detail. Its interesting to compare that sort of writing to actual prose.The following is a made up example of the other way around: what prose would look like if written like typical code. The main point of this is that code readability is something worth thinking about – and that maybe the automatic decomposition of code into smaller and smaller units may not always be the best thing to do, especially if we are interested in having the code be able to be easily understood. At some point, we begin to lose a lot of the context and coherence that allows us to maintain it properly in our minds.I don’t really have hard-and-fast rules for when to break down or not, but it’s something I have been keeping firmly in mind when writing code lately. I think it’s worth thinking about and exploring in different ways to see what actually works best.The story is “Goldilocks and the Three Bears”, with text taken from this website: https://www.wardleyce.co.uk/serve_file/699125I fixed one error in the text and normalized some of it to keep the code from getting too special-case. There may actually be bugs in this, as it’s not something that can actually be run.Enjoy!================================================================={Story} # Execute the story!define Story: {Intro} {Girl_Enters} {Girl_Food} {Girl_Chairs} {Girl_Beds} {Bears_Enter} {Bears_Food} {Bears_Chairs} {Bears_Bed} {Girl_Exits}constant Girl: "Goldilocks"constant Food: "porridge"constant Just_Right: "just right."constant Daddy_Size: "big"constant Daddy_Bowl_Size: "large" # fix this inconsistency?constant Mummy_Size: "medium"constant Baby_Size: "small"thing Daddy_Bear: [ name: "Daddy Bear", bowl_size: Daddy_Bowl_Size, food_state: "too salty!", chair_size: Daddy_Size, chair_state: "too big!", bed_size: Daddy_Size, bed_state: "too hard!"]thing Mummy_Bear: [ name: "Mummy Bear", bowl_size: Mummy_Size, food_state: "too sweet!", chair_size: Mummy_Size, chair_state: "too big, too!", bed_size: Mummy_Size, bed_state: "too soft!"]thing Baby_Bear: [ name: "Baby Bear", bowl_size: Baby_Size, food_state: Just_Right, chair_size: Baby_Size, chair_state: Just_Right, bed_size: Baby_Size, bed_state: Just_Right]define Eating_My_Food: Someone's been eating my {Food}define Sitting_In_My_Chair: Someone's been sitting in my chairdefine Sleeping_In_My_Bed: Someone's been sleeping in my beddefine Intro: Once upon a time there lived three bears and a little girl called {Girl}.define Girl_Enters: One day, she saw a house and went inside. {{break}}define Girl_Porridge: She saw some {Food}. {{break}} {Tasted_Bowl_And_Commented(Daddy_Bear)} {Tasted_Bowl_And_Commented(Mummy_Bear)} {Tasted_Bowl_And_Commented(Baby_Bear)} She ate it all up. {{break}}define Girl_Chairs: {Girl} saw three chairs. {{break}} {Sat_In_Chair(Daddy_Bear.chair_size)}. “{Chair_Is(Daddy_Bear.chair_state)}” she said. {Sat_In_Chair(Mummy_Bear.chair_size)}. “{Chair_Is(Mummy_Bear.chair_state)}” she said. {Sat_In_Chair(Baby_Bear.chair_size)} and said, “{Chair_Is(Baby_Bear.chair_state)}” Then it broke. {{break}}define Girl_Beds: {Girl} went upstairs. {{break}} {Lay_Down_On_Bed(Daddy_Bear)} {Lay_Down_On_Bed(Mummy_Bear)} {Lay_Down_On_Bed(Baby_Bear)} She fell asleep. {{break}}define Bears_Enter: The Three Bears came home. {{break}}define Bears_Porridge: {Bear_Scene({Eating_My_Food}, "it's all gone")}define Bears_Chairs: {Bear_Scene({Sitting_In_My_Chair}, "it's broken")}define Bears_Beds: They went upstairs. {{break}} {Bear_Scene({Sleeping_In_My_Bed}, "she's still there")}define Girl_Exits: {Girl} woke up and screamed. She ran away and never went back into the woods again.define Tasted_Bowl_And_Commented(bear): {Tasted_Bowl(bear.bowl_size)} and {Said_Food_Is(bear.food_state)}define Tasted_Bowl(size): She tasted the {size} bowldefine Said_Food_Is(food_state): said, “This {food} is {food_state}”define Sat_In_Chair(chair_size): She sat in the {chair_size} chairdefine Chair_Is(chair_state): This chair is {chair_state}define Lay_Down_On_Bed(bear): She lay down on the {bear.bed_size} bed and said, “This bed is {bear.bed_state}”define Bear_Scene(each_said, baby_added): “{each_said},” said {Daddy_Bear.name}. “{each_said},” said {Mummy_Bear.name}. “{each_said}, and {baby_added}!” cried {Baby_Bear.name}. {{break}}UncategorizedLeave a commentFrom drawing pad to game by aniamosityMarch 12, 2022March 12, 2022Some original sketchesIn BlenderAn in-game test to see how it looks (with base added)Impulsinggame development ImpulsingLeave a commentImpulsing: #devtober Post Mortem by Jay NabonneNovember 1, 2020Here it is, November 1st, and devtober is now no more. It has been a wild month. I have had highs of creativity and several periods where I was so depressed, I felt like I would never be able to progress.Lots of takeaways, in no particular order:I enjoyed writing each day. I used to write more, and it felt good to write again.Being part of devtober forced me to do a little each day, just to have something to write about. It wasn’t much, and sometimes barely anything at all, but there was daily effort and daily progress of some kind.Writing the daily entry stirred thoughts that didn’t occur otherwise. Perhaps it’s a bit like “talking to the duck”.The most frustrating parts were struggling with the Godot engine, in terms of learning how particular features worked and then working around idiosyncrasies in the implementation. When you use a game engine, you’re at the mercy of the features as they are implemented.Some of the most rewarding parts were becoming competent in those same features in the Godot engine. You have to go through the pain, but you come out the other end with something that works better than you would have had if you had done it on your own. You are really standing on the shoulders of everyone who has worked to make the engine what it is. The body of knowledge, experience, and expertise embodied in the engine is tremendous. And there is so much I haven’t explored yet.Making screen captures is a really good way to see progress. And it’s really nice to see the progress, to look at where you were and where you ended up and know, “I did that.” Without a way to measure, you can have a dim view of what you actually accomplished, which means you’re deprived of that energy that can help keep you going.Sometimes it’s good to walk away for a while and then come back.I need to – and want to – get better at art. I’m often pleased with what I can do, frustrated with what I can’t do, and determined to increase how often I’m in the former category.You will have times when you know exactly what the next step is, and you will have times when you have no idea not only what the next step is but where you’re going at all.If you want to complete a project like this, you have to be persistent. Never forget what you’re trying to do. Don’t compare yourself to others how have “made it”, thinking you can never do that. You may not do what they did, but you can still do what you can do. And what you can do is something that is yours, your creation, and part of you. If you want to share it with the world, then make it happen.Game programming is hard. I have been writing software for over 30 years, and I’m continually surprised how working on a game is different from other software in a way I haven’t been able to quantify yet. Part of it, I think, is that you can’t fudge things. You can’t cut corners. Everything is right up front. Everything is part of the player’s experience.That’s all. Well, there’s probably more, but I’m running dry. In half an hour, I might have ten more thoughts. But I don’t know if anyone is going to read this anyway.I’m glad I took part in devtober. It has been an eye opener in many ways, and what I started here is something I want to continue.#devtober, ober and out.Impulsingdevtober-2020Leave a commentImpulsing: #devtober Day 31 by Jay NabonneOctober 31, 2020Today ended up being the most productive Saturday I have had in a while.After my write up last night, my brain was branching off on new ideas and thoughts. I began envisioning the levels being platforms in a broad 3D space, and when you finished one, it would whisk you off to another with slick animation. And you could see in some form the levels around, beside, below, etc.It was a really cool idea. And it was far too ambitious to try to do right now.Granted, it would be fun to try, and there’s nothing ruling out doing something like that ultimately. But what stuck in my mind was this image of the puzzle level sitting on this thin sort of platform floating in space or air or whatever you like.First thing this morning, I swapped out the plane used as a background with a thin, broad cube – the same side, but not with some depth. Given the angle of view, it was hard to see the depth, so I bumped it up a bit.Then I bumped it up a bit more.Then for grins, I bumped it up a whole lot more, and suddenly I saw something I really liked. It’s probably not fantastic in the gaming world, and it’s not what I would go with if I had more artistic talent or a better vision. But I like it enough that I’m happy to settle on this for now. I mean, this is just a passion indie game that likely will never go anywhere. I want to get it to the point where people can play it. I just need something to build on.I sometimes feel like I’m avoiding working on the levels. Perhaps I am. But there is also a rationale for getting some of the more global details settled: it’s easier recreating a few levels than a few hundred. With what I have now, I feel like the idea is solid enough that (hopefully) things won’t change too drastically, at least for this first round.Here is the first level, reworked:Initially, it was just a cube (properly sized). That was easy to deal with. The next level has jog in it, and I wanted the background to follow. If nothing else, it helps to see the 3D. Man, that was a pain.Sure, you can resize and move blocks fairly easily in Godot, but trying to butt blocks up against each other isn’t easy. And if you want to make a block larger, it resizes from the center, so then you have to guess around how large it will be and then reposition it. Not bad for one or a few, but after completing the even more complex third level (which wasn’t even that complex), I was at the point where I knew that approach wasn’t going to be workable.Then it occurred to me that perhaps this was a good time to re-evaluate GridMaps, now that I know what will actually be in them. I started out with a simple tall narrow cube, full height but 1×1. Immediately, I hit the problem that the GridMap was centering this tall cube in the Y direction, whereas I wanted it to be top aligned. I tried offsetting the GridMap to make the top line up, but then the perspective camera made painting the blocks impossible. (You would need to figure out where the bottom way down there would be.) Thinking now, a top view or orthogonal camera would have solved that. What I did instead was to research the problem, and I learned that others had it, and there was no solution in Godot for it besides creating your own mesh in an external tool like Blender. That’s what I ended up doing. A lot more transpired after that, including some really frustrating things around getting the mesh to show up and the fact that the GridMap plane can be moved up and down, and to pan the view you use the middle mouse button plus shift, and it turns out that if you hold down the shift key and spin the mouse wheel, the plane moves up and down. I noticed the grid had changed colors, and the objects being placed no longer lined up. It took me too long to figure out what the heck was going on. Even now, even being careful, when panning I will occasionally move the plane by accident and have to reposition it.On the positive side, being able to move the plane up and down opened up some creative possibilities in terms of level design (“artistic” more than functional), so it ended up net positive after quite a while of hair tearing. You can see how the corners in the above picture are a little lower. It’s not worthy of hanging in a museum, but it does break up the monotony a bit.Some more levels:I finally feel like I know it string the levels together now.Time to start building out the game more.Day 31: A bit scary at times. But also something sweet in the end. (Ok, corny. I know.)The final day of devtober. The month has flown. Not every day was great advances, but a little each day gets you somewhere.I’ll write up the post mortem tomorrow.Impulsingdevtober-2020Leave a commentImpulsing: #devtober Day 30 by Jay NabonneOctober 30, 2020October 30, 2020Another one of those days. Not much done externally, but a lot of time spent thinking and doing some research. I have a set of levels, but I need to work out how to connect them together – the overall strategy to build the game from the levels.I could just string them all together, but that makes for a linear game. And it creates a situation where if someone can’t solve a puzzle, they’re just stuck and can’t proceed. I’m determined that the player will have more freedom, but that means some sort of navigation of puzzles, as well as being able to exit a level or more to a different puzzle or section of puzzle in the same level. Also, some levels might have different puzzle sections, so it’s important to be able to come back to a level and continue it. (At this point, I plan on every level you visit remembering its state. The entire game is in play at once. That has some interesting ramifications in terms of whether you can do irreversible actions.)To list that out explicitly:There are multiple levels that can be navigated among.You can exit a level and come back to it, and the level will be in the same state.There may be multiple ways to leave a level (places to go to), with some being easier and some being more advanced. There is some sort of overworld or other type of hub level that the other levels branch off from.Of course, that could all change. I had originally envisioned a single level with all parts of the machine on it, which you would massage into operation as a single master goal. My reluctance to do that has two aspects: 1) having smaller “bites” to focus on might be easier for the novice player to deal with in the beginning, and 2) I have concerns about performance for something that large all operating as a single network.Stating things like this, in and of itself, has stirred some thoughts. Perhaps I should do this more often, even if only to myself.Penultimate but not. Life will continue beyond devtober.Impulsingdevtober-2020Leave a commentImpulsing: #devtober Day 29 by Jay NabonneOctober 29, 2020Today, I got the rest of the components converted over to KinematicBodies. I also fixed up the collision layers and masks. That wraps up that part of the recent changes.I spent the rest of the time playing around with some levels. Nothing has come of it yet. What I find is that I have some ideas for level layout, which is interesting to look at, but which doesn’t have any puzzle elements to it. I’m hoping I’ll get better at this as I go along…Here’s one, for example:Sort of an upside-down butterfly. Fun to watch, but no real challenge. Yet.Day 29: two days left.Impulsingdevtober-2020Leave a commentImpulsing: #devtober Day 28 by Jay NabonneOctober 28, 2020I worked a bit today on wrapping up the new physics-based dragging, and it’s working rather nicely. The main trick was to integrate the snapping into the movement, which initially didn’t work properly. It was snapping based on (at least one axis of) where the mouse was, not where the actual component was, which could be different if the component was blocked from following the mouse. It looked really odd (wrong) to see the component snap when the mouse was near a grid position far away.The solution was to do two different move_and_slides. The first would try to move the component to the mouse. Then the component’s new position would be used to calculate a snapped position. Then the component would move_and_slide again to the snapped position. Either move_and_slide could end up blocked. The final snapped grid position would then be calculated from the ultimate world position of the component (either an actual grid coordinate or null if not within snapping distance of one).There were a couple of minor things to fix (including changing the spherical collision shape to a cylindrical one, as snapping and setting into the sparse nodes would crash the code if there was already one there), but in the end, it seems to be working. Which makes me happy, especially given where I was a couple of days ago: on the verge of giving up and putting it off.It’s hard to believe the month is almost up. Day 28: four weeks in.Impulsingdevtober-2020Leave a commentImpulsing: #devtober Day 27 by Jay NabonneOctober 27, 2020I had some relatively amazing progress today. I had zero luck trying to move things myself in _physics_process. So I decided to play around a bit with Godot physics. Besides being fun, it worked out more or less how I wanted. It’s not perfect yet, but it’s a lot closer than it was before today.I started out by changing the level boundaries from Areas to StaticBodies. Then I changed the Herbert from an Area to a KinematicBody. This caused a few things to break, but only because I had set “collide_with_bodies” to false in my raycast in a couple of places. Once I fixed that, I was happy to see that everything still worked the way it had before. Still no collisions (sadly), but my code generally worked despite it being a different type.My first step at getting collisions working was to move the node in _physics_process, by simply setting the new translation as I had before. That didn’t work. So I tried reading up on move_and_slide and move_and_collide. Both of them take a directional vector instead of a new position. So I tried simply taking the vector between the current position and where I wanted it to be. When I tried move_and_collide, it worked – except when it touched something. Then it started moving reeeeaaallllyy slowly. That’s because, I assume, move_and_collide stops the motion when it touches something.That wasn’t going to work.I tried move_and_slide next, since it sounded more like what I wanted, and it sort of did work, but it was slower in general. After some more reading and thinking, I decided to simply try multiplying the delta vector, and suddenly things started working much better. I’m not sure what the difference is (the docs mention taking delta into account or not), but I don’t really want there to be too much slop anyway. I just want it to meet the mouse position. One interesting side effect is that the component with the cylinder collision object worked as I wanted, but the one with spherical collision object allowed the dragged component to slip up and over it. Fun to watch, but not what I want. I should be able to change the spherical shape to a cylinder one to solve it. Seeing this behavior though means that if I ever get into physics full time in a game, it’s going to be a lot of fun. (Maybe I can find a use for the “up and over” behavior.)There is some quirkiness to work out, and I still have to re-enable the grid setting code (which wants to snap the position – that could be a lot of “fun”), but it’s an incredible breakthrough for me, and I’m happy to have learned something new today as well as move it closer to what I have been wanting.Day 27: A glimpse of heaven.Impulsingdevtober-2020Leave a commentPosts navigation← Older postsHomeAboutResponsIF source Model-A-tire Older Renders Render-with-Fence-1 Blender Renders Recent PostsWait… What?Further Thoughts on The Three Bears as CodeIf Authors Wrote Stories the Way Programmers Write CodeFrom drawing pad to gameImpulsing: #devtober Post MortemRecent Commentsaniamosity on Choose Your Own AttractionMatt Wigdahl on Choose Your Own AttractionOscillation | Aniamosity on AssociationArchivesMay 2022March 2022November 2020October 2020June 2017September 2016July 2016June 2016January 2016CategoriesImpulsingInteractive FictionUncategorizedMetaRegisterLog inEntries feedComments feedWordPress.org Proudly powered by WordPress • Theme: Capoverso by WordPress.com.