…but this is the internet, I'm trying to argue dammit!!
Game engine in C and open source, The Box, structural programming
Tool Update
Thinking in adding another tool “emulator” to play retro games. There is already so much content made, people develop so much new content but how much of old stuff did we explore?
Games like tekken 3 i hold probably play it today.
Think this tool fits well in to the concept, of a low level engine which could use old machines. A tool to work on this old software could be useful.
We could “in theory” put the software in a old computer and develop software or do updates. Like a keyboard on a Sega mega drive, and develop games. If we could load games in another way to the machine. The package game hardware is a bit hard to reproduce.
Sounds like that idea of creating a virtual retro computer that allows the simplicity we remember from childhood with nostalgic feelings.
There is this for example: https://www.lexaloffle.com/pico-8.php
Seems to have an active community, quite a big number of games. Pretty cool.
(sorry for disturbing again, but i get notification each time someone posts to this thread)
@Funkymunky @joej
Why i do it?
Function (var1, var 2, var 3 );
Unless you have your functions in the editor, you have to remember the order you pass the variables to the functions, and what kind of types. That is a lot to remember. Unless you go search your hole code for the function.
your already generated 2 errors 1 for type and other for order of variables.
look at my function
char text = “”;
int type = 1;
global_variables();
Generated zero errors. The order does not matter. still works, and you are seeing the types of variables.
int type = 1;
char text = “”;
global_variables();
The other way still works.
A noob programmer. Ya it need to study the code, and objects. But it does need to study new rules for the framework, He's knowledge on procedural code is enough.
Another thing is the amount of code.
Once you pass the variable to the function you need to return it. that's more code. Imagine we do all this to a quake 3 engine, with 5.000 lines. What you prefer to read? Less code or mode code in which line?
Function parameters_function(var1, var 2, var 3 ){
return value;
}
value = parameters_function(var1, var 2, var 3);
value2 = parameters_function2(value);
The same code in global :
Function global_function(){
}
parameters_function();
parameters_function2();
I prefer good data encapsulation and cache usage. If your goal is to make something you think other people would want to use, I'm bluntly telling you I wouldn't.
By using global variables, you will never know where the variable accessed by a function, will get modified elsewhere so you might end up with wrong values. And you lose cache optimization. If this was the way to go it would have been done repeatedly in the business, which is sure is not the case.
That's really no argument, but assuming it would be, i answer Visual Studio Intellisense completely eliminates such issues, and i have seen the same features with Eclipse for php, java, etc.
The text editor shows function signature, lists the variable names, their type, and even highlights the next one to enter in bold font. It never happens to me i accidently reverse two variables of the same type. And even if, that's really a but very easy to find.
But this Intellisense thing goes further. It lets me browse quickly through nested function calls, and i do not need to run the debugger to have a call stack, i can just follow dependencies from code text files alone. (I really like that, because i'm terrible at remembering anything)
However, that's just code editing comfort, not related to any critique on your proposed programming style of using global variables to hide things away that should not be hidden.
What you do here leads to dependency on your global systems. None of your code is useful if you remove it. So you can not use the code in another project. But i can. I can move a class from one project to another, and often there is no dependency at all, other than some small core functionality that can be moved just as easily because it depends on nothing.
What you do works fine for a project of small size, like that Pico-8 console from above. But it can not grow beyond that, because at some point you realize there are changes to global systems necessary that would break one thing after another.
Example: Pico-8 has fixed color palette ans screen resolution. If the want to increase any of them, all game swill break, or most at least.
Now you may say: “Nope, i've already thought about this! The resolution of my pixel draw functions can be set with a global variable, ha!” But there always comes something you did not plan ahead, things sum up, and at some point you decide to better start from scratch, not repeating the mistake to rely on something global.
Finally, the most important point: By hiding context into something global, you hide important context from yourself. At some point, when we move from PacMan to Quake, or from Quake to GTA, you no longer know on what global states your actual code depends at all. You thought you make it easy for yourself, avoiding the need to have track of all the details, but at this point you realize you have done the exact opposite of that: You confused yourself, leading to spaghetti code, hard to find bugs and unpredicted side effects, and finally to the decision to start from scratch. And you have learned: It's much easier to keep track of all the details, because those details are necessary for the program to work. It can't be simplified, context is important.
We all learned this the hard way, and it's just the first small step. Next we realize even if we try to do better it's still hard to have reusable code. We end up rewriting the same thing again and again, because it's easier than making existing code compatible without breaking dependencies. Then we learn about abstraction, interfaces and all this. It becomes better, we become software engineering experts. And still: It keeps happening. Even things like OpenGL or Flash, at some point they become just outdated and rewritten almost from scratch. And this although it's made by experts.
You will not come up with a solution to the unavoidable problems of software development. If you think so, you are wrong. If you present yourself as the experienced guy who just knows how to do it all, you mislead other, less self confident beginners! And this is just as harmful as insulting people that make very valid points. Attacking those people but not addressing their arguments shows a lack in both programming experience and social competence.
The last time i said something like this i got a penalty from a moderator, and after some time i understood i deserved it. You are now in a similar but much worse position. You should apologize, IMHO.
That said, …
jdc said:
Why i do it?
…honestly i don't care why you do it. You can keep doing this as long as you want. But you can not convince me to go back to a programming style that i have used in my childhood. I have learned it was a mistake, and for me it did not work for long.
Joej visual studio only works on windows and is very heavy needed to remove it, and parts of it are paid. 6 gigas, my hard drive only have 80 and i'm very limited in space already.
The style? Is not only the style is the interface to use it. The style in the end is not that important. The point is to generate auto code width out knowledge in programming.
When i work in visual studio i was using a normal text editor in the end did not work that well. It auto 3 or 4 tasks not that important.