Because I can - probably

Or perhaps it's just a "Why Not?". Not that ... that's really good or sound reasoning; But ... what constitutes good and sound ... also depends. In some ways that's a serious distinction to be made - and in others ... one wouldn't bother. Not that how one does go about it is necessarily right. Of course.

So - I've gotten back into coding; And the experience so far has been a lot more pleasant than it used to. I suppose I might blame my age for it - a certain cognitive maturity or whatever - rather than some mythical higher influence - but ... I suppose, the thing with me and happenstance is usually a bit ... unconventional.


Were I to say however that I made good progress, that too depends on how one were to look at it. I do think that it is fair to say that I made good progress over the years; Up unto a point. Whether the roadblock I was hitting was of divine intervention or my own mental peculiarities isn't always clear ... but so far I've had a good enough time digging out all my old code and putting it all next to each other.
Well ... not ALL of it. And there's yet stuff to do.

Right now I'm not quite as far as I had been in the past at some points - and have in fact already encountered the one or the other mystery bug. So, I've tossed it all over once or twice already to start over ... but right now that's just part of the process. Because, I think that's the Quality feature right now, I've got theoretically functional code - at least by proof of concept - that's not really what I care about right now. I right now rather care about the things that I didn't care about previously; And thus in one way or another led to an abortion.

And I don't know why I'm doing it, what I care to achieve, or whatever.


In all that, I still feel like I'm only allowed to play in puddles. But then there are these moments where ... minor decisions - like putting something here rather than there - has a lot of impact. And that's the kind of stuff that usually made me toss over code. Me knowing that this or that was done badly - but somehow having no clue how to fix it.
Which still is a problem right now - but I suppose I've got the time to concern myself with these things. On and off.

I have to be careful though ... it's not like I'd want to falsely get anyone's hopes up. So, I suppose I'll let this sit until I have some kind of a ... hmm ... whatever. Whenever. Like, "See you" when I get there?


So - Mystery Bugs. What are they?
From the time I noticed them I tried to convey what I had noticed. But people usually ... weren't convinced that I was capable of distinguishing what I thought a Mystery Bug was from something ... with a more reasonable explanation like me just being dumb. Maybe dumb isn't the right word - but not smart enough at least.

And sure. Sometimes ... bugs can have some totally obscure reason behind them. And I'm not sure if anyone really got to the bottom of those "It didn't work before but now it somehow works and I don't know why!" situations. It's sometimes almost like ... there's a Ghost in the Machine.

It happens and may just have some reason. Now ... the first~ish one I encountered happened while working on my very first C++ based Model Editor. I was still very new to C++. Previously I had built a Model Editor in QBasic, writing my own 3D Engine ... adequate for my needs. So, just lines were OK. And it was enough to build the simplest of meshes - without any visible surfaces. But having gotten into C++ and getting some first basic Direct3D or OpenGL situation settled, I had some use for what I made there. I've even read up on some basic Analytical Geometry to get some basic stuff like vector:normal based coloration of triangles so they'd look illuminated - and ... yea.
As a sub-topic here I suppose there's something to be said about immersion. Now, being myself somewhat dyslexic when it comes to math wouldn't stop me from getting really deep into the substance at times. There even was a point at which I almost properly understood the Gaussian Algorithm. Or what's its name. For Vector intersection in 3D space. Or something. And I suppose from there figured out how to simplify it once only using 2 Dimensions, but ... that's been a long time ago. And when I then move my mind towards other thing, that stuff is gone. And with coding it's similar. I know roughly what I have and have-not, but ... sometimes I'm in this weird spot where I'm coding on something - with my own code in the back-end of it; While for the most part I'm just hoping that I know what I'm doing because I totally don't have the mental resources to look into it.
Maybe it's a slight exaggeration ... but maybe not. I mean, sometimes I'm afraid of the opposite of mystery bugs. That would be mystery ... code. Code that shouldn't work or do what it does ... but ... does. Sometimes I wonder if that might be the cause of so or so many problems. That it works while someone believes it does ... . Anyhow ...

So after fiddling around a little I thought that a better Model Editor would be great. One I could actually see the surfaces on perhaps, have more triangles - building more complicated meshes. At the time I was also playing around with virtual functions - of which I really don't have a clue anymore. I'd regard that to be an experimental branch of object oriented programming that ... shouldn't really be used.
Anyway ... things were going fine; Being myself a little proud of how I solved being able to build Meshes without any kind of user interface. So then one day, feeling fancy, I tried to implement Triangle Fans. Not as simple as using OpenGL to render them, but to also have them as a usable primitive. So, I got there ... triangle fan added to the mesh ... and being proud of my accomplishment I wanted to add another one to the scene and then the program crashed. And naturally I wanted to know why. I traced the crash using printf down to the function assigning the color to a triangle ... and given how everything else worked fine - and how it also worked just fine for the first primitive - I didn't know what the problem was. I blamed virtual functions and moved on with my life.

For a while I tried to take what I had learned and write something more suitable for my expanding needs from the get go - but ... for a month or two - maybe three - I didn't get past the console screen. We might even say, that this period traumatized me. Making me lose faith in my ability to code or get anything done ever. I mean, compared to what I had accomplished previously - thinking of how I was getting nothing done anymore - I started to feel like writing functional code that does what it's supposed to might be impossible. And that ... sat with me for quite some time. Perhaps even until today. That was like ... 2007/2008.
But eventually I woke up inspired to not be satisfied with the usual square map. I wanted my game to take place on a Globe. I had an idea of how and what and stuff ... figured out the math ... started simple and actually got somewhat far. But I noticed that I'd have to re-arrange the code slightly ... and then also wanted to upgrade to draw-lists as the back then next more efficient way to draw things. It worked out alright - but then I wanted to tidy up the main-loop a little. I'm not sure what I did, exactly. But as far as I remember it boiled down to something along the lines of 'if(variable) {}'. I walked it back so the bracket was empty. It was as much of a line of code as that, which caused the program to crash. And you might think me for stupid suggesting that there's something wrong with the variable. Well ... "duh" - no shit! But why? I mean, you might figure that ... there has to be. And so was I rather perplexed to figure out what. The way this worked was, that I passed a pointer to the function. A pointer to a struct - THE main struct/class. The pointer I used for pretty much everything within that function. It is a valid pointer! I also tried to move the variable - an int or a bool - around in the class; Same thing. So, for all I cared ... I had flashbacks to being stuck in the console. Not being able to figure out ... why things don't work out as I'd expect them to. It's like ... a bit wild to get to question your sanity like that. I mean, facts were telling me that I was making a mistake. The hard solid evidence that unfolded before me would suggest as much. Yet for what I KNEW ... it couldn't be so.

I had something similar just recently. So, I was slowly building up - and upon wanting to move on to different input methods made some icons to have a visual representation of the active mode on screen. So I wrote the code to do that, loaded the .png file and 'crash'. I traced the bug to a pointer - the pointer pointing to the memory that the pixels would be loaded to. The funny thing being that it weren't the functions. I had used them for a long long time now. And even so within the program here and there already. Without failure. It might have been that I misjudged how much memory I had left. But 20~ish Megabytes seem to be sufficient for a 128x128 or 256x256 large png. Last suggestion ... faulty RAM. Sure, that'd suck. But changing, again, where in the loading process I created that memory didn't change the result. No, the problem was with this one particular instance ... specifically. As an abstract concept that has absolutely no bearing on the code.

Now, in hindsight all those mystery bugs have one thing in common. I suppose. They prevent me from making progress. And I might try to hack my way around them ... and they might tend to ... hack around me trying to hack around them. What follows is like when something just comes loose so it all falls apart at its seams.
So I stopped working on what I was working on and got back to touching some other things up. And now I'm back at the point where I wanted to flip between different input modes ... and that was yesterday. All well - it does what it does. Well. Now it does.
Yesterday it did or didn't do a few things ... that I then just chose to ignore. Whatever caused "it" or whyever "it" didn't do anything ... (two things) ... I removed them from the code ... and everything is fine.

I mean ... in the one instance the point indicating the 3D position that the mouse on screen "pointed to" would be stuck on zero if I pushed shift ... until I moved the camera. I tried to do the thing on toggle rather than shift - and then the point was just stuck there regardless. The thing being that what I wanted to do there had no logical connection to the parts calculating the mouse point. In the other instance I wanted to do camera rotation while holding the right mouse button. It just refused to do anything. Wouldn't even update the cursor graphics. The only thing it 'did' was 'not' updating the mouse position on screen. That sure was intended.

But yea. That's ... I guess ... it depends. These last two examples aren't really roadblocks. They're just ... well ... things, I suppose, that aren't going to be there. And so far, I'd say for the best. Eventually I can see how I need to settle with a particular solution and stick with it. I already do camera rotation with WASD ... for instance. I just figured that sometimes I'm lazy and I might want it on right-click, but I guess that we want other things on right click. Also I don't really need to shift/toggle WASD to move the camera - because I got screen-edge scrolling and target dragging. Well, now I have.


So, in a way it all played out - I suppose. Whatever Model Editor I was working on back then ... I didn't need it. For once because I didn't really come around to having any use for what I might have produced with it in a long time. And for what little need I had, the QBasic version did alright. That was until I finally got around writing one ... that worked ... though I have no idea where it's flying around ... but by that point I had an ... I'd say good idea of what the mesh structure should be like. So, I never got around to committing to any of my projects in a way that would have interfered with what I did instead ... of having code that did what it should ... so-to-speak.

Well, I suppose at the end of the day only God might now just WHAT He prevented by throwing me those wrenches ... . But in a simplified way ... the thing is that my ideas have evolved. So, today I'm thinking of an entirely different set of features that I want to have in the final thing. Or ... evolved, rather than different. And that also concerns a lot of different aspects of the whole. Possibly also features I thought of - but ... didn't "work out" because the way the code was it would be difficult or pointless to try and implement them.

And I suppose ... that's that!
Anyway ...
I just got around to looking at how to migrate my old "Planetoid" Code into my current project ... and had to recall how the first time around ... I got around to writing a constructor function in assembly - but right now wouldn't have a clue of how to do it. I mean ... I suppose things are coming back slowly ... so yea, but then ... I don't really care to optimize right now. ... But I suppose it's worth to keep in mind for later. Unless some new processor architecture comes around with some brand new ways of doing everything. Or whatever.


Something ... something

What all that somehow brings me to is ... laziness. Or so ... a certain kind of it. For once I suppose it comes with age ... and looking at news - or what's going on these days - I find it here and there. Or think to see it.

It's perhaps better described as a form of complacency. I'd for instance import some code, figure out how it works again and use it. All that while I, per chance, understand that eventually I have to screw around with the thing because the one or the other part of it isn't really quite there yet. But instead of doing that, I'd find myself working with the thing and working around the parts I should probably work on instead.

I mean ... thinking of the last time I wrote about "my Project" for instance, I did a lot of thinking without actually really ever figuring out how to start actually coding at some point. Now I'm actually in a much better spot for getting to that, but I don't really want to. As in: Doing the work to go through what I wrote. Instead I'd just ... make shit up all anew as I go along. Which also kind of means that all of that work was practically for naught, although ... I did take one or two things out of it. ~ish. And sure - it may at some point come down to "the right answer" being nothing but an educated guess.


[2023-12-19]
... [mumbles ...]



By the way: That image thingy ... . People, I figure, might suggest that the problem is still faulty memory - and that by some circumstance it perhaps came down to me still allocating the same faulty memory due to the size of the memory allocated. So, if I allocated the same amount of memory multiple times, that couldn't be the problem - for then the faulty memory wouldn't have been mysteriously "bound" to that one class. However ... I think I didn't require the same amount of memory for that one file ... but ... still. The thing being that I don't dynamically allocate memory.
See ... I use some class that I renamed a couple of times over the years but essentially has worked just fine since I used it. I allocate some memory - set the class up with the pointer to the memory and the amount allocated - and then just "take" memory from there whenever needed. So, at any rate - changing 'where' along the lines of taking memory from it I take it - also changes 'what' memory is being taken.