2019-01-09 23:48:07

@25, I was talking about the AGK created by Ghorthalon. Considering how I've mentioned JavaScript (not Java) many times, I would've thought you'd figure that out.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-01-10 10:16:46

I start to see why you're getting pissed off @ethin

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2019-01-11 00:50:30 (edited by Ethin 2019-01-11 00:50:54)

@27, Yeah, these guys neither can make up their minds nor do they even know what I'm talking about half the time. Methinks they need a bit more experience and a bit more knowledge from people who actually do know what their talking about.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-01-11 09:12:46

Yeah, but this is a kinda of a double-edged sword.
From the one side, stupidity of all stupidities is to ask a question just to trash the answer or advice from a more experienced person
From the other side, you sometimes use such words, that I, because I am not a native english speaker must research in order to fully understand your answer.

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2019-01-11 19:04:25 (edited by Ethin 2019-01-11 19:04:52)

@29, true. I hope you don't mind; taking years of language arts (and then taking a class on professional writing in College now), combined with the illiteracy of the modern age (with people using 'u' for the word 'you', '2' for the word 'to', and so on) and people (supposedly) using grammarly all the time... well, I've pretty much made a vow to myself to not stupe to that level. If your not a native English speaker, having a spell and grammatical checker there to aid you is nice to have, and I can see the benefits. But if you need a spell and grammar checker there, all the time, just so you can write anything that looks good... shame on you. And that was aimed at those that do, not at you, 29. If you are one of those people, I hope I did not offend.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-01-11 20:23:03

Nah, I am writing everything on my own. I just don't understand some words or phrases, which I just look up in the dictionary

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2019-01-13 03:07:49

Hi there,
wow, such a discussion, but we are joining together slowly I  guess.
@Ethin: when two share the same opinion, how can they argue about it? smile
You wrote, that I want to use gui loop for a videogame. can you quote that? because I have never wrote this.
I have wrote, that you can use gui system for audiogames. And that is a difference. You can actually make even some simple fps without noticing any bugs. In audiogame there is no stucking drawing, so only way you can find that something is going wrong is when reaction to key press comes later than it should (of course meaned during actual gameplay).
When you are planning to make an audiofps with thousands of enemies and tons of objects in 3D map, you can use game loops to save cpu. But you still have a chance to do it.

If you are planning to make actually a videogame, well, that's completely different situation. It isn't a framework loop what actually stops you, but simply unability of gui systems to draw content in 60 fps. if you want to do such a operation, you need firstly to know the surface, then calculate view angle, what is visible, what is not, how to view it and just after that comes actually the drawing, also with some technologies to speed it up. That is something gui systems weren't developed to manage.
There is OpenGL as you say for this purpose and only a fool would use Windows forms or WPF instead.

About dividing game into window classes, I meaned to separate logics of game phases to multiple classes, instead of mixing everything in one, that would be a bad idea. But you already get it I guess, may be it was just a misinterpretation.

So you see, our opinions aren't different this time and I think situation was the same in many others of our conversations.

I know that you are good at programming, otherwise I wouldn't give you neither a second of my time and attention.
I have been coding synce my 11, that's about 6 years. So I have some experiences too, don't worry about it. smile

@Sanslash: BgtKit isn't published yet. It has two reasons. First that I was coding it during development of my games, and because of that just functions I actually needed are implemented. Second is, that it is some time synce I worked on some game, i am focusing more on expanding my knowledge to web technologies and mathematics, including machine learning, deep learning and artificial intelligence.
So I am not currently interested in BgtKit much.

And now, to all of you, who want to begin with programming audiogames. There were tons of examples from people like Mason, Gorthalon, etc. how to do an audiogame in bgt. But many of them shared the same mistake - spaghetti code.
In programming, a spaghetti code is a code, which uses just few or no classes and relies on functions, which aren't in any class. Something like that is very chaotic and hard to extend.
Another common mistake was using global variables, in bgt frequently for nearly everything. To make it clear, there shouldn't be any global variables or functions in your projects, everything should be at least at class level.
If you need to make it available from every class, use a static class for this purpose, which represents what category that variable belongs to.
For example, Math functions in C# aren't declared like globals, even if that were possible, but are grouped in a static class Math, what is pretty clear explanation of their category.

To react on these problems, I have developed a system of developing a game, which separates its phases to classes called Windows, or VirtualWindows better said. They are there to manage keyboard presses, mouse motions, joystick actions and other input from user, while a timer method cares about moving enemies, weather, time, healing you etc.
of course those things should be actually made in other classes, for example you should to have a class Player, which stores player's health and Window method just updates it when necessary. Physics should for example have its own class, mapsystem too, as Sanslash already pointed out.
VirtualWindow is somewhere in the midle making the colossus of classes work.
This is independent on language, you should use object oriented programming in C#, Python, Java, JavaScript, Kotlin and whatever you are able to think out, of course if it supports it. smile

As I promised, I have coded a small example of what I mean. I have found out, that I don't have necessary sound effects to do sidescroller or fps. I would be forced to steal sounds from other project and that is something I don't want to do. No publicly. big_smile
So I have coded a small Slide like game. You may know it, there is a grid of squares with numbers, just one square is empty and you must to sort them by moving to that empty square.
There is a menu, where you can choose if you want to play with 3 x 3 or 4 x 4 grid. Although I made the algorithm universal, so it can be used for every size starting from 2.
Actual gameplay is straight-forward, arrow keys allow you to navigate around the grid, if you hold shift and press an arrow, currently targeted square will move in that direction- if it is empty.

From code perspective, I recommend you to pay special attention in KeyboardShortcut class and its functionality, also check a hierarchy of VirtualWindow, how are virtual methods implemented defaultly, when is needed to override them and when not.
If you don't understand anything, feel free to ask.

For more experienced programmers, I would like to hear also yours opinion. Is there something to improve on this system in your opinion?
For example, I am thinking, if it is right to use Speak method inside of Window class. Or playing sounds. Of course actual logic is in classes, but its use must be related to its source somehow. So the question is, where exactly.
I have tried various approaches, but thisone seems the most practical and readable for me.
Also when assigning keyboard shortcuts, there should be a constructor of Keyboardshortcut class, which takes shortcut as a string and parses it inside of the class imo. It would a. clear the syntax from keyboardShortcuts[new KeyboardShortcut(true, false, false, Key.A)]=method; to keyboardShortcuts[new KeyboardShortcut("control+a")]=method; b. it would free programmer from including System.Windows.input to get Key enum.
Also when that is done, declaring keyboardShortcuts as a property with slight edit of its setter would clear previous syntax into this:
SetKeyboardShortcuts({
"control+a" = SelectAll,
"control+home" = GoToTop,
"control+end" = GoToBottom,
...
});

That seems much better like tons of if statements we used previously in bgt for me. Of course this input would parse internally to Dictionary with keyboardShortcut class, so actual look up would be as fast as possible.

I think that is all I wanted to say. If you want to check it out, you can download from:
http://leteckaposta.co/file/564857137.1 … 0a2cc5c/cs

Happy coding

Best regards

Rastislav

2019-01-13 04:29:47

@32, I found your post to be difficult to interpret. As for the global vars thing, I don't mind throwing a few global variables here and there; in fact, I do it (with extern, mainly) so I can keep track of the global variables without getting linker errors all over the place. Static classes and variables still generates linker errors, especially if you want to reference a global audio stream object in multiple files, for example.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-01-14 03:49:02

Interesting, two post with a lot of useful information. let get in touch one by one smile

@rasti:

When you are planning to make an audiofps with thousands of enemies and tons of objects in 3D map, you can use game loops to save cpu. But you still have
a chance to do it.

hmmm not only for that; other utility of have a constant game loop, is for ave a order, and synchronized all objects and actions in the game smile

@:

There is OpenGL as you say for this purpose and only a fool would use Windows forms or WPF instead.

openGl, bulcan, directX, you named it.
And a lot of useful engines for handle these things for you. monogame, xenko, wave, unity, etc. smile

@rasti:

@Sanslash: BgtKit isn't published yet. It has two reasons. First that I was coding it during development of my games, and because of that just functions
I actually needed are implemented. Second is, that it is some time synce I worked on some game, i am focusing more on expanding my knowledge to web technologies
and mathematics, including machine learning, deep learning and artificial intelligence.

sounds good, very good wink
But, why that name?
I don't know, change it to rastiToolBelt, rastiGameutilities or something similar jaja.

@
If you need to make it available from every class, use a static class for this purpose, which represents what category that variable belongs to.
For example, Math functions in C# aren't declared like globals, even if that were possible, but are grouped in a static class Math, what is pretty clear
explanation of their category.

Is util for some cases, but exist more interesthing patterns, like factoring, singleton, etc smile

so thanks for the example, some toughts about it:

OK, lets comment a few things of the code... O really, are a doubt.

In the keyboard shorcut class...
Why use the bool variables a nullable types?

I don't see a situation on that you want a ctrl or shift var will be null; is true or false, but don't see when you need these will be null smile

About the window handler class, so...

its Ok, but I preffer use a singleton instanse with a factory function to get / create it, instead of have pure statick code. Looks good and works fine, but for me, the other option sounds better :3

The other thing... whi did you capture the keyboard on the main window, and next pushs it to the virtual window, instead of capture it directly?

So, the utility that I can see, if you have a standar control input like buttons and axis deffined, and with that you can capture keyboard, touches and joystick, and next only pass to the virtual window the mask without knowing witch is the original input devise, but in this case I didn't see a real use.

And thanks for the code... the BGTKit dll is usable? or currently not; what features it can do, aditional to the speetch methods?

Thanks for the example code; works fine.

a, your idea of the shortcut is very good, and use actions for it. Very well; you can improve it mutch more, but the basis is well thinked

@thin:

linker errors?

I guess that you're talking about c++ or  other similar languajes; in c# generally you didn't see problems like that, using statick variables, of course :3

And that is all!

thanks for all