2019-01-08 21:10:28

Hello.
I noticed that there are a lot of Python developers here. But these questions are for C# developers, and I hope that I can find them here.
I have a few questions about C#:
1. Is it efficient to use any libraries for audio games? SDL, SFML, or Windows Forms only?
2. How can you advise me to handle the keys?
Problem. If I use key handling through Windows Forms, I need to use events. But in such cases, I can't separate the game from the menu, inventory, etc.
I saw a way to use SharpDX. But there is no good documentation for this.
3. Are there any forums for C# NET developers?
4. Any information you can share for developing audio games in C#.
Thanks in advance!

2019-01-08 21:33:54

Hi there,
1. use WPF, in case you don't need to draw expensive graphics, it will be fine for you and it is compatible with all screenreaders including Jaws.
2. About keyboard handling, i recommend to use events. Also a hierarchy of classes representing virtual windows, with one parent class with defined events receiving methods and then calling the hierarchy from according places.
Please, really avoid code like this:
if (gamePhase=="menu")
{
if (key==up)
{
//...
}
else if (key==down)
{
//...
}
else if (ctrl and space)
{
//...
}
}

It isn't funny.
If you need a example how a good game code should look like imo, just let me know. I am coding this already for one my friend, so I can make a version with english variable names and comments.

3. Sure, what about stack overflow?
4. Hmm, what shall I say to this? Just be object oriented, write efficient and flexible code, and you will be on the right way. The reason why development of anything bigger is so hard isn't in problems with coding but rather with overwhelming amount of actions to do to make a good and errors proof audiogame. For example I am able to develop a game like minesweeper or rtr for every platform in few days. If only I had all necessary sound effects... smile
That is never ending problem for me, I know about lots of sound effects resources, but I don't know which I can use freely and which not.

So that's it, if you have any further questions, feel free to ask even here, there are more good C# developers.

Best regards

Rastislav

2019-01-08 21:35:10

1. There are not any audiogame-specific libraries for Audiogames. Python developers doesn't have them either.
2. Windows Forms, and you can separate the game. Use namespaces, or if you want to make your code more elegant, just separate the files.
3. csharpcorner.net

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-08 22:29:26

you can use monogame also. Im tryiing to make a game with him and well, I thinc Im on the right wai...

Sorry for my english

2019-01-08 22:52:27

@2, could you please give us that example game? I would really love to see that code.

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-08 23:09:21

Rastislav Kiss,
You already helped me. To be honest, I'd like to know you better. For example, what should I know to develop a game like RTR in a few days like you?
It works. I should do what others do. Especially since I know that you are working with C++.
About events, I don't understand how I can separate the menu from the game.
In a normal Windows Forms application, I create an event for the keys. But how can I do this in different states of the game, if without creating a status variable?
About StackOverFlow, I can't ask there about choosing libraries or other similar questions.
If you use only IMO, I can register there. But it will be better if you have Skype, Facebook, WhatsApp. But I'm ready to adjust to you!

nuno69,
I can't make code like this:
public class Menu
{
public Menu()
{
if(KeyDown == Key.UP))
//something
if(KeyDown == Key.DOWN))
//something
}
}
Because in Windows Forms there is one method with an event where I should work.

alisson,
Good choice, but for Android or cross-platform solutions.

2019-01-09 00:58:04

Hi there,
just to clarify about my speed of development, yes, it is true that I can develop various games in a short time, if I had already all necessary resources. But this is also because I have coded a massive code base, which I can use as a base.
For example my BgtKit library. Currently, this project supports C++, C#, Python, android C#, android Java, android Kotlin and I am about to make a version for JavaScript in short time as well. In every language it supports speaking, playing sounds, more and less good sound positioning, direct or indirect interaction with user through keyboard or touch and some language specific features like encryption and hashing in C# version or string compression in C++ version, those features aren't integrated in all languages yet.
Thus when I decide to create a game like RTR, the most important is phase, where I decide program's structure, development then goes very fast.
But you need a good code architecture. not just dividing into files, that is good practice, but too weak if applied lonely.
You need to use full potential of object oriented programming, only in that case you will end with elegant and readable code. A status variable isn't the right solution, because it forces you to write many conditions and switches, what is an initial signal that something is wrong in your code.
You need something more powerful than just a status variable.
I have some free time tomorrow, I will try to write out something, may be a simple sidescroller with a main menu and pause screen, or something in style of Operation blacksquare, I will decide with regard to my actual mood. smile
I will write it in C#, so you can see the code hierarchy and understand it. Then I can show you also my similar demo in Python if you want, which is already coded, in that stuff i have put out all my crazyness and tried to supply the power of object oriented programming with capabilities of Python as a dynamically typed language and results seem very interesting to me. smile

Best regards

Rastislav

2019-01-09 03:35:59

@6, well, a Heros call was made in monogame and works perfectly on my windows machine... so... and entombed was made on XNA, (spiritual previows version of monogame) and it works withouth problems too

Sorry for my english

2019-01-09 04:47:05 (edited by Ethin 2019-01-09 04:54:30)

WPF. In a game. Seriously? What kind of BS advice is that? When your playing a game you don't want full-on GUI event loops running. You want all of that integrated. If possible, you want the game framework to provide you the tools necessary to draw 2D or 3D GUIs, and you want the framework to allow you to intercept particular events to make those GUIs accessible. You never want to ever start another GUI loop alongside your games update loops. That will hold your update loops until the GUI terminates, which usually never happends until you want to exit a program. WPF was *not* designed to be used that way. No normal GUI system was designed to be used that way, and getting a game framework to meld with a GUI framework that wasn't specifically designed with gaming in mind is only going to give you headaches and rages because your code malfunctions.
@Rastislav Kiss, have you ever developed an actual audio game in C#? Clearly not. Here's some actual information that will aid people in developing C# audio game frameworks in any language:
* Either use events, signals and slots, or whatever you can to make your game as asynchronous as possible. Try to avoid callbacks; callbacks can get ugly, very, very fast. Then again, events, signals and such can also get ugly really fast, so be careful about nesting them and all that.
* Do not, under any circumstance, use a full GUI event loop in your game. Ever. Only do that before the main game loop takes over (i.e. a registration dialog before the game has even been initialized and such). Even then, try to meld that into the game itself. Avoid GUI loops if possible; they complicate things and can really fuck your project up. Modern game frameworks have replacements for GUI loops that are strictly designed to be rendered in a game.
* Don't try and divide your code into "windows" and such. That just won't work.
* Your game will always have a central method that's usually called 'update()' or something like that. That is your central "event loop", where all the magic happens. Branch out from there.
All of this goes for any game being developed in any programming language. Unlike some in this topic, there *are actually* game frameworks for C#. Guys, before you say that there is not something in a particular language, do your homework. A particular place to find game-related stuff are in locations like https://awesome.re, and its links. In particular, pay attention to the various back-end, front-end, and programming language sections of that page. And yes, I, unlike people like Rastislav Kiss, actually do know what I'm talking about regarding developing games in C# and C++; I've made prototypes using game frameworks, and have done a hell of a lot of research on this very topic. I have helped write games in C++ (and then aided in the rewriting of them in Python). I think my knowledge, and references, can be trusted. In C# you do have game frameworks; frameworks like MonoGame, CocosSharp, Duality, and others. In C++, you do, also, have frameworks; in particular, bs::framework, Acid, Allegro, SFML, SDL, and so on.

"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-09 07:41:05

Ethin,
People like you can just throw words.
Rastislav helped me in the past. But what have you done?
In my topics about choosing programming languages or other topics, you condemn me.
Dude, if you can do something, show us that.

2019-01-09 07:56:22

Rastislav Kiss,
Can I get your contacts?
I wrote to you on your email yesterday, which you used before. I don't know if you use it now.
Please send me your contacts either here or in PM.

2019-01-09 09:23:58

@Ethin I diidn't say the aren't game frameworks on the market, I said that there are no udio-game specific framework on the market, which is true

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-09 10:07:29

@Ethin: well, show me just one your game to prove what you're saying. Otherwise sorry, but i can't take your words seriously. I have been helping with Eurofly development and I will tell you few things:
1. Eurofly runs with full guy event loop. Yes, that's true. it doesn't use any game development framework, i'm not sure if there are any for Delphi.
2. It is made of Window classes as i recommended in my answer. it can't work just in your head, but in practice it works perfectly and allows programmer to write highly flexible code.

Yes, if you want to write a game with 3D graphics rendering, then it is worth thinking about using some kind of game framework, because it should be optimized to do this in shortest possible time using every available computation resources like cpus, gpus etc.
But if you want to develop just an audiogame, what was original question, then this is rather overkill.
Even Swamp for example didn't used any sort of game framework if I know right, Aprone has coded everything from movement to sound positioning himself and it works perfectly.
So, seriously, before you write anything about game development, please try out to write at least one game yourself. Better some more massive project like RTR or Redspot. You will find out, that many things in reality simply don't work as you're saying.

Best regards

Rastislav

2019-01-09 10:22:32

As far as I know all frameworks compliant with dot net standart can be delphi-compatible. But we're going kinda offtop here.

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-09 10:28:08

Rastislav Kiss,
I'll be glad if you share your Python code.
Also, what about C++?

2019-01-09 11:18:41

DOn't learn million programming languages at the same time. I also did it in past and now I see my problem

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-09 13:09:36 (edited by kianoosh 2019-01-09 13:09:59)

I use BPC shared component dll library, coded by munawar, Check it out if you need a good sound and key handling library. And as for menus, I prefer using threds, Or just use while loops and call application.doEvents() inside your while loop so things won't be messed up

---
Co-founder of Sonorous Arts.
Check out Sonorous Arts on github: https://github.com/sonorous-arts/
my Discord: kianoosh.shakeri2#2988

2019-01-09 18:50:23 (edited by Ethin 2019-01-09 19:01:49)

OK... I'll happily respond to you one by one:
@jonikster, I condemn you, as you put it, because you have shown yourself incapable of making your own decisions and deciding what you will use for quite literally anything. Even now, such a behavioral pattern continues, and after the twentieth topic you posted that asked the same thing as your previous nineteen, that incapability only further cemented itself in my mind. You refuse to do your own research, refuse to try libraries that I have recommended, refuse to try libraries that programmers who have programmed far longer than I have have recommended... right now most of them have given up. And I lose hope every day that you will actually learn what we've told you because this pattern continues. It doesn't help that you listen to people like Rastislav Kiss, who have shown themselves to exhibit similar behavioral patterns to your own, with the only difference being that Rastislav Kiss is extremely stubborn and always considers himself to be right, while never considering another programmers point of view unless that programmer agrees with him on a part of a previous statement he's made. It doesn't help that, of course, he gives you misinformation.
@Rastislav Kiss: OK, Eurofly uses a GUI loop... not cool. If using a GUI loop is so wonderful and nice, then why doesn't every video game use one? Hmm?
As one of the major contributors to dMNB and DMPA's source code, I can tell you that nowhere did we use a GUI event loop anywhere. Nowhere! Like I said in post nine, you don't use a full GUI event loop in a game alongside a game event loop -- it will only result in frustration. I have been programming since I was thirteen, a time of 6 years or so, and in every game I've helped make and in every prototype I've worked with, I have never seen a full GUI event loop employed in a game unless strictly required. And that strict requirement was only employed under particularly controlled circumstances, and it usually resulted in the entire game halting while the GUI did its own processing, only resuming after the GUI event loop had terminated. I am attempting to give you -- and others -- advice on how to properly develop a game while leaving a game that you make open to the possibility of 2D or 3D content later on, if you wish to add it. That is why I gave my advice in post nine. There is only one -- and only one -- GUI framework that I know of that makes it possible to solidly and safely combine GUI, OpenGL/Vulkan and 3D technologies. That is QT. and the only reason that works is because QT only has two types of event loops -- QCoreApplication and QApplication. It deliberately separates the two so that you can run a QCoreApplication in a full 3D video game for command-line parameter processing, for instance. And even then, that doesn't work very well. GUI frameworks are *not designed for* gaming. Even if you were to post a question like this on Stack Overflow (something like, perhaps, "Is it a good idea to use a GUI event loop to make a game?" Or, "Is it a good idea to use an event GUI loop alongside a game event loop?") You'd get a similar response -- No, use your game frameworks GUI primitives, don't use a full GUI event loop, and if your framework doesn't provide one, make your own. It makes no sense whatsoever to use a full GUI event loop (like WX's) in a game, especially since some GUI frameworks (like WX) refuse to allow event loops to be run on a separate thread, and must be, for some unexplained reason, must run in the main thread. I'm sorry to be so harsh, but please go look up, on google, exactly why you shouldn't use a full GUI event loop in a game, and then you might understand, though from your response, I don't have much faith.
@nuno69, true. Though I suppose AGK can be considered one... either way, just because there isn't an "audio game development kit" in languages like Python, C# or C++ doesn't mean you can't make an audio game using a video game framework (which is definitely a good idea).

"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-09 19:22:53

@Rastislav Kiss were is published your BGTKit library?

Or currently is only a work in progress.
Sound interesting to check what kind of things you can do with that.

@Ethin
I agree with you in various things, but for some others... well.

Is clearly that if you want develop a game that needs a constant update loops use a gui framework is a bad idea, but for a sutch types of games, like card games, some board games, and other stuf like that, a gui framework can do these things very good.

And other point that give to me some... discomfort is that you say that in a game is bad idea use divide and  conker.
I don't agree with that; on every kind of project that you're working, divide your project in backend and frontend is a very (if not the best) option that you can pick, and help to you on move your project to different languages, different platforms, and other stuff.

But well.

Thanks for all guys.

2019-01-09 19:43:13

@19, Yes, for card games, a GUI is fine. But as soon as you start FPS clocks and such, a GUI isn't. Most frameworks, as I've said, provide replacements for most GUI components. As for the divide and conker thing, I disagree. If your going to make a project in a programming language, make it in that programming language; don't make it in 30 different programming languages. The more languages you involve in the development of a project, the higher the risk will be that you'll get some kind of callout error of some kind, and your program will misbehave.

"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-09 19:53:37

Ethin,
Do you know that AGK uses Wx?
About my choice. You say that I'm not able to make my own decisions. How can I do this without experience?
In any case, most likely I will have to make a choice in the direction of C++. Because C# is not capable of solving problems of robotics.

2019-01-09 20:22:34

@21... dude, choose your programming language, the one you most feel comfortable, c#, python, simply choose one. using and do not ask any more, please. You will only get experience when you start to program something and you are not asking all the time. There are millions of tutorials on the internet, and you have many pages to ask, just sit down, program anything simple. Do not try to program a GTA5 when what I see in your posts, you do not know how to program a press the space bar game...
I'm starting in the game programming, but I try to do everything I can before asking and I'm not asking here and there even before I've started something ...

Sorry for my english

2019-01-09 20:22:53

@Ethin
Of course, if you need FPS  precision a gui is the worst solution that can you take, but as I said on my previous post, not all games need FPS precision. Various genres can live without them.

About divide and conker, the example of various languages isn't good, but almost for me, is one the best practise that I use when I'm programing, and I learned at the university.
Try your keep code the simplest possible, dividing all the task in atomic subtask. And the things that are aparentli unrelated between them, is a good practice.
Example, game logic, input logic, graphics logic, network logic, and sound logic. And if you want to go deeper you can divide your game logic in more smallest logics. the last step is find a good mechanism to comunicate all engines to have a complete engine. But is a good practice have all components separated.

Write for example in one class the code for your main world map, and mix with that the code for render the map things on the screen, you can end with a beauty spaghetti code.

But, well. experiences are experiences, and at the end of the way, each team choose how have to program their projects.

2019-01-09 21:50:23

@23, ah, I see what you mean now. Yeah, I agree with that. @21, no, AGK does not use WX. AGK is written in java script. There is no WX port to javascript yet. You ask, "How can I learn programming languages without experience?" Well, may of us have told you exactly how to do that, yet you continuously brush us off or disregard our advice.

"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-09 22:09:54

Ethin,
AGK? Java? Ahaha, dude
https://github.com/cartertemm/agk3