1

Hello.
I have a few questions about developing a game in C#. Help me please!
How to create a window? Can I open a window using DirectX or will I have enough Windows Forms?
If Windows Forms, how to make a full game window and make it black?
How to do 3D computation. Player rotations, etc. Use Bullet Physics or something else?
How to create a menu and make the status of a menu or game. How to separate the menu from the game?
Thanks in advance!

Thumbs up

2

Hi,
I coded Three-D Velocity in C# and you can check its source code here: http://github.com/munawarb/Three-D-Velocity

It will give you an idea where to start.

A brief answer to your questions:
To create a window, create a Windows Forms Application. In the "main" method, you will see code that has been placed there to create a form and run the "message loop." You can use the Windows Forms Designer by pressing SHIFT+F7 and then CTRL+ALT+X to launch the toolbox. In there you will see properties for your form. You can change the color in that list.

You can use DirectSound 3D to rotate the soundscape. There is example code in the TDV source that will show you how to do this, in BPCSharedComponent/DSound.cs.

Bullets and other projectiles are a different story. This depends on if you're using a game engine or coding from scratch. In TDV, I coded everything from scratch, so I had to write the formulae myself using reference material and knowledge from Physics. If you look in BPCSharedComponent/VectorCalculation, there are useful functions in there to calculate angles, speeds, positions according to time steps, etc. But, nowadays I wouldn't recommend coding this stuff from scratch since many Physics libraries exist that will do the hard work for you. Things like Mono Game Studio or Unity 3D are popular choices.

Basically, all the questions you're asking can be answered by poking through TDV's source, especially since you want to make a 3-D game.

To make a scrollable menu, I do it by putting all of my options in a String array and then changing the index of the menu up or down based on what key the user pressed. The items in the String arrays are paths to sound files that will play.

So for example, when the user presses DOWN ARROW, play file at menu[0], menu[1], menu[2], etc. The trick is controlling the key input so that if they hold down an arrow, the menu won't continuously scroll. You have to get a little clever about it, but if you look in TDV/Common.cs in the generateMenu method you will see a function you can pretty much copy-and-paste into your project to get a working menu.

Good luck and if you have any more questions, post here and I'll try to help as time permits.

Thumbs up

3

Is that part of it accessible, I do have some vision, and I know that if you click on one of the tabs on the toolbox, a tray of sorts slides open, and you have controls related to that tab, so labels, one line text fields, buttons, and so forth. But, is it possible to access the toolbox, and put the items on the form with a screen reader. Once there, the position can be tuned by editing its properties, but I don't know how to get them onto the form in the first place.

The bipeds think this place belongs to them, how cute.

Thumbs up

4

Munawar, hello!
First of all, thank you for your game!
Yesterday I looked at the source code, but it's very difficult for me. I could not find the source code of the form, etc.
Unity is not available for us, but MonoGame is available. But I do not know if that decision is good.
I do not have a good knowledge of physics and higher mathematics. For this reason, it is better for me to use libraries.
If you do not mind, I'd like to talk with you when you have free time. Please share it with your contacts or write to me.
My mail:
[email protected]
My Skype:
volibor4444
Thank you.

Thumbs up

5

ironcross32, element panel and form designer are completely accessible to us. I don't know about older versions of Visual Studio, but I'm talking about Visual Studio 2017.
I can press ctrl + alt + x, in the toolbar select the element I need and place it on the form. After, in the form designer, I can click on the alt + enter element and change the properties.
I don't know, it's more convenient for me to program the GUI interface through the code. As for example in Java or Python.

Thumbs up

6 (edited by Munawar 2018-03-22 11:34:54)

You're welcome re: the game. As for the source code, the way TDV is designed, this wouldn't be a good entry point for you. Try looking in Common.cs in the main method. You will see the form being created from there.

The actual code for the form is in the file GUI.cs.

In your later post, you mention that creating the GUI is easier from code. The good thing about C# is that when you click on the controls and drop fields onto the form, it's generating code in the background. You can view the code editor by pressing F7 in your designer window. There, you will see the code Visual Studio is generating for you. You can manipulate this code how ever you like and the changes will be reflected in the designer window.

Re: Mono Game Studio, yes this is a great option especially if your comfort zone is C# or this is the language you are aiming to learn. I've used Mono Game in the past and you can do some pretty cool things with it. I think it some aspects it makes things more complicated than they have to be, but then so does Unity, because they're all trying to converge on this idea of "game assets" where things have to be in the engine-specific format. Generally, it's why I prefer to code games from scratch; you're not restricted by the bounds of the engine. But, Mono Game does have some great Physics libraries you can use. I used Mono Game purely for academic reasons and by then TDV was already almost finished, so I didn't get much benefit from the gaming engine itself.

Re: contacting you, certainly, I'll do that. We might not be able to chat for two weeks or more though, since I'm currently away on a business trip and don't expect to return home until mid April. But feel free to follow up on this thread and I'll do my best to help you along in the meantime.

jonikster wrote:

Munawar, hello!
First of all, thank you for your game!
Yesterday I looked at the source code, but it's very difficult for me. I could not find the source code of the form, etc.
Unity is not available for us, but MonoGame is available. But I do not know if that decision is good.
I do not have a good knowledge of physics and higher mathematics. For this reason, it is better for me to use libraries.
If you do not mind, I'd like to talk with you when you have free time. Please share it with your contacts or write to me.
My mail:
[email protected]
My Skype:
volibor4444
Thank you.

Thumbs up +1

7

Hi there. Munawar, Is mono studio accessible? I mean is that a different IDE or it's the library itself. Because i've downloaded mono game but not mono studio. It means mono game library and it's extention for visual studio. Also using xact with monogame looks a pain in the ass and unity3d is inaccessible and is more pain in the ass than xact mono game. Although i have no expeirence with xact and unity3d, Just the things that i've heard

Add me on skype: kianoosh.shakeri2
Or follow me on twitter @kianoosh shakeri

Thumbs up

8

MonoGame is just a Visual Studio add-on; you don't need Mono Studio for it as far as I remember. It's one reason I liked working with MonoGame back in my university days: I could use the tools I was already familiar with.

When you install MonoGame, it will just create new project templates that you will select in the New Project wizard.

kianoosh wrote:

Hi there. Munawar, Is mono studio accessible? I mean is that a different IDE or it's the library itself. Because i've downloaded mono game but not mono studio. It means mono game library and it's extention for visual studio. Also using xact with monogame looks a pain in the ass and unity3d is inaccessible and is more pain in the ass than xact mono game. Although i have no expeirence with xact and unity3d, Just the things that i've heard

Thumbs up

9

yes but i think deeling with sounds takes so much time/It's not hard but it needs a long code for a sound to play

Add me on skype: kianoosh.shakeri2
Or follow me on twitter @kianoosh shakeri

Thumbs up

10

@kianoosh, not necessarily; ever heard of a function wrapper? Or, better yet, go use a sound engine like FMOD.

"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.

Thumbs up

11

Ethin Of course i can wrap the functions it's right that was just something that i wanted to mention. Or maybe It's not that long you know, I was working with IrrKlan so far and it was using a wrapper like sound pool in bgt so that's why i think most of these things are hard to implement. I even can write the wrapping functions myself i was just mentionning it that it takes a bit. Speaking of fmod, It's a long time that i want to ask someone that how do I use fmod in C#? Fmod studio itself is completely inaccessible and I got a dot net fmod wrapper or something like that from sourcefordge but that thing wasn't built to the library and when i trye to build it it was missing some stuff which i cannot remember at the moment and thus couldn't compile. No worries i tryed googleing but likely found nothing special or better say i couldn't find anything special.

Add me on skype: kianoosh.shakeri2
Or follow me on twitter @kianoosh shakeri

Thumbs up

12

I agree with you on this. I think DirectX itself gives you much more control and I like how it handles multimedia a lot better than other things, even better than XNA. But MonoGame is the worst of them all, which is why even though I used it for education, I never ported TDV over to it and always preferred to use SlimDX and later on SharpDX. Maybe it's because I never bothered to learn multimedia handling in MonoGame more than I had to (I was more interested in the AI portion of the class, since multimedia to me by then was old news,) so it could very well be that I didn't give MonoGame a chance, but my thoughts are the same in that it over complicates things.

kianoosh wrote:

yes but i think deeling with sounds takes so much time/It's not hard but it needs a long code for a sound to play

Thumbs up