Also, I wouldn't recommend C++ as a beginners language. It's not just the fact that it's not easy to build a game. You also have to factor in the fact that your quite literally playing with raw memory, whether you like it or not. Higher-level languages, like PureBASIC or Python, abstract this away from you and take care of the memory aspect themselves so you don't have to worry, while languages like C/C++ do not. In C/C++, if you want to allocate enough memory for a sound, you have to know when to free it and then do a pass through all your code to ensure that the pointer you allocated to hold said memory is not used after deallocation. Now, managing memory does sound horrifying, at first; I'd have to agree. Managing memory is tricky and can be difficult sometimes, and memory management is most likely where some, if not most, of the vulnerabilities that exist today can be found. But, if your careful, and you understand the risks, C/C++ isn't a bad language to work with. Most of the time you'll never be calling malloc ()/realloc (). Rather, you'll be allocating pointers and allowing the compiler to flush them when they've ran out of scope. (This feature is, unsurprisingly, called a 'lifetime'.)
However, as a beginner, a language like Python would certainly do what you're trying to do. Don't jump for the low-level ones just yet until you feel comfortable jumping into those deep waters, because most likely after you take that plunge and have fallen in love with it, the compiler isn't going to help you and hold your hand wherever you go. Granted, in low-level languages, we have stack smashing protection and other checks, but as we all know, those can be gotten around, especially if the stack smashing protector or sanitizer has a bug in it. But I'm not going to debate security here. It's quite obvious that said subject has gotten *** enough *** attention, and there's no point debating it endlessly. Making a program as secure as you can only comes with practice; we can debate it for all eternity and without practice no one's going to actually understand what the hell we're even trying to tell them.
So, yes, choose Python for now. It's certainly a very good beginner language.

Thumbs up

Hello all, it's been quite a while since my last post on this topic.
I've currently dealing with a bit of a problem, which is not syntax related.
The way I learn most programming languages is via looking at source code. Alas, the only open-source games for VB (that I'm aware of) are Chopper Patrol by BSC, and Guess the Number by Jim Kitchen.
Are there any other open-source audiogames in VB that I'm not aware of?

Thumbs up

Not that I know of, and I don't know how your going to learn how to program games in VB using those as examples. (You might, though, don't use my judgement as the ultimate authority here! big_smile).

Thumbs up

Thanks for the vote of confidence Ethin! LOL it's good to know that you have complete trust in my ability to learn VB!

Thumbs up

I don't know what version of vb vbtutor uses, and there is the expected emphasis on visual programs, but there's this list of example games: http://www.vbtutor.net/games/games.htm#google_vignette

Thumbs up

56 (edited by blindncool 2017-08-11 03:49:18)

I don't think any of these games are accessible, but I'll try them out.
Just by looking at the webpages for each game, it seems like the majority of them (if not every single one) are visual in nature. I haven't ran the code yet, so I'll see what happens then.
BTW, it seems like vbtutor does use VB6.

Thumbs up

57 (edited by blindncool 2017-08-11 16:11:25)

The games I have tried from VB Tutor are completely inaccessible.

Thumbs up

So yeah, I'm still struggling to find some accessible games to learn from... I heard that X-Site used to host some open-source vb6 games, although I doubt they're still available.

Thumbs up

Hi folks I have a few questions.
1) How can I get my VB6 apps to speak via SAPI and screen readers?
2) How do I make an accessible menu (as seen in the majority of audiogames)?
3) How do I generate a random number (E.G from 1 to 6)?

Thumbs up

60

1)  Dimension yourself a global variable that will be used to hold the Sapi object.  In this case I used a variable called "tts".  Put this in your form_load section:
Set tts = CreateObject("SAPI.spVOICE")

You only need that line once, when the program first starts up.  From that point on, any time you want something read by Sapi use a line like this:
tts.speak "Hello there, I am a Sapi voice.", 3

The comma 3 at the end tells the program it can continue executing while the Sapi voice continues to read.  Other screen readers are more complicated to add, so for a start you should get used to working with Sapi.

2)  Accessible menus are tricky topic, since there are probably thousands of ways you could do them.  You may be thinking of how languages like BGT use a few pre-built commands to create menus, but VB6 (and other languages) do not work that way.  You have to code them yourself.

3)  In form_load, type this:
randomize timer

That only has to happen once, when the program begins.  What that does is set up the seed, allowing random numbers to seem random.  Now any time you need a random number, you use the letters "rnd".  Rnd gives you a random decimal number between 0 and 1.  By doing a little math with it, you can choose to have it generate a random integer between whatever range you want.  Here's an example of numbers 1 to 6:
diceroll = int(rnd*6) + 1
The random number gets stored in the variable I made, called diceroll.  In that equation the "rnd" part will be a number between 0 and 1.  That multiples by 6 meaning it is between 0 and 6, but not actually 6.  It could possibly be something like 5.99999, but not ever reach 6.  This 0 to 6 number is then turned into an integer, so any decimal is chopped off.  Now the result would be between 0 and 5 with no decimal.  Finally at the end 1 is added to bring the new random number 1 to 6.

Thumbs up

Thanks Aprone.
I think I'm going to work on an accessible slot machine. (I know it's not original, but hey It's my first project).
I have a few more questions before I get to coding this:
How would I grab keyboard input (similar to BGT's Key_pressed function?)
In chopper patrol, all the code relating to the keyboard was placed in a single function. Is that the only way I can handle keyboard input? And what are the values for the keys in VB6?

Thumbs up

62

Just like how you can go to your form_load section, go to the Form_KeyDown(KeyCode As Integer, Shift As Integer) section to handle keyboard input.

When any key is pressed down, the code in this section will run.  The variables KeyCode and Shift will be filled in by the language, letting you know what the user pressed.  Each key has its own keycode value (I'm sure there's a chart somewhere), but as an example the spacebar is number 32, enter is 13, and escape is 27.  The shift variable is normally zero, unless the user held shift, control, or alt at the same time they pressed another key.  If you're ever wanting to find a specific key in a hurry, just put this line of code in form_keydown:
msgbox keycode
then run your program and press the key you're think of.  A message box will appear showing you the correct keycode value.  Now you go back into your program, delete that "msgbox" line, and you can code in what you need to happen.
If you need more examples let me know, I had to make this message short because I'm leaving for work.

Thumbs up