2014-10-02 17:53:33

Hello everyone,
BGT has it's advantages and stuff when it comes to the fact that AngelScript is object oriented. However, with Pure Basic I rarely have to enter semi colons which I regularly mistake for " or something else, and I just can't get my head around the errors that BGT parces sometimes. I forgot to enter a single quote probably to call a function and one of it's parameters. Nevertheless, the BGT engine thought I had misplaced a brace. I don't expect it to spell the problem out for me like Inform can, although that would be a hell of an accomplishment for BGT if it could.
I suppose the main reason why developers, especially the two audiogame devs developing with PureBasic, prefer it is because it's unnecessary to declare your variables like in every BGT script, easier syntax like EndScript instead of }, and an Ide for the advantages of having an IDE.
Since I'm using the PB demo, I can't get access to Sapi so will have to use my voice to record the menu, which is fine I suppose. Since I'm just learning PB, and since PB is not Object Oriented, will I have to create an Array to replace what my sound object is in BGT, for the tones, menu and music tracks? There's also the issue of the timer. In the BGT game, there is obviously the timer object which is global. It determines how fast the player has to input the three tone sequence, which is in an array, and there's several functions that define the timer. I was looking through the PB reffrence and have a grasp of how I'd use the keyboard constants. With OpenScreen, what should I set my length, width etc to since I won't be using any 2D Sprites?
I'm not sure how I'll create the menu either, but I did see something regarding that in the reffrence so I hope one of those functions work for an audiogame.

2014-10-02 18:43:59

It's possible that PB has better errors, but I'd not count on it.  Most programming languages give really cryptic messages for the obvious stuff.  Perhaps BGT is bad in this way, but I don't think PB or any other language is going to be as good as what you want.  Doing error messages is unbelievably hard.

My Blog
Twitter: @ajhicks1992

2014-10-03 01:48:59

Hey orrin did you read my article about bgt compilation errors in the articles room? I think it helps to lay out what the most common errors mean and how to tackle them

I like to sleep, Sleep is good,
This is how I do it: Lie on a nice warm cozy bed, and dream dreams about how to rule the world!
Follow @TheGreatAthlon5 on twitter for humorous facts and game updates!
If you like my posts, thumb me up!

2014-10-04 18:09:38

@orin, the best way you can program memory train in PB is by following the following instructions. In this post, I'll detail a little on the code that you need:
1. Open a screen; keyboard input is not available without doing this (unless you wish to use the windows API?):
Procedure OpenAScreen()
If OpenScreen(#pb_ignore, #pb_ignore, 32, "Title Here")
; code
EndIf
EndProcedure
or
Procedure OpenAScreen()
If OpenScreen(width, height, depth, title)
; code
EndIf
EndProcedure
Or Even:
Procedure OpenAScreen()
If OpenScreen(width, height, depth, title, FlipMode, RefreshRate)
; code
EndIf
EndProcedure
2. Initialize the keyboard:
InitKeyboard()
3. Load the sounds into memory:
LoadSound (0, soundfilename)
LoadSound (1, soundfilename)
LoadSound (2, soundfilename)
; and the rest of your sounds.
4. Create the main menu. I'm not going to go into depth about this; you will need to create your own method of menu creation yourself. However, in PB, in SR and DMPA, our menus go like this:
            Procedure SoftwareUpdatesMenu ()
              choice = 0
              TTSStop()
              TTSSpeak ("Software Updates Menu. Use the up and down arrow keys to navigate this menu; press enter to modify a setting, or activate an option. Select 'cancel' to cancel this process.")
Repeat
ExamineKeyboard()
    If keyboardpressed(#PB_Key_Down)
      PlaySound(1)
      choice = choice +1
      suvoice ()
    EndIf
    If keyboardpressed(#PB_Key_Up)
      choice = choice -1
      PlaySound(1)
      suvoice ()
    EndIf
    If keyboardpressed(#PB_Key_Return)
      PlaySound(2)
      If choice = 1
        AutomaticCheckForUpdatesChange ()
        TTSStop()
        TTSSpeak (cfumethod)
      EndIf
      If choice = 2
checkforupdates ()
EndIf
    EndIf
    Delay(5)
          FlipBuffers()
  ForEver
EndProcedure
I'm of course not going to reveal the checkforupdates() procedure to you, but the basic method of creating menus in SR and DMPA for Danny and I is:
Create the original menu procedure. Once that's done, create any additional procedures the procedure calls, and then create a procedure that follows this format:
Procedure suvoice()
    TTSStop()
  If choice < 0
    choice = 1
  EndIf
  If choice = 0
    choice = 1
  EndIf
  If choice > 2
    choice = 2
  EndIf
  If choice = 1
    TTSSpeak ("Check for Updates Method: " + cfumethod)
  ElseIf choice = 2
    TTSSpeak ("Check for Updates Now")
    EndIf
  EndProcedure
I've revealed to you as much code as I can to the audiogames.net forum. Now, change that procedue, and mold it into your own. Read those two procedures I have revealed to you, and then, without leaching off of them (None of you!), mold it in your mind how it should look. Remember that before coding, always make a design of what the program should look like, either mentally, or on some form of method you use to write it down. Never jump directly into code without a design specification first.

"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

2014-10-05 05:10:38

Is there a TTSSpeak function in PB, or did you guys create that yourself and gave a sample of your menu code?
I hope I'll be able to use that in the demo.

2014-10-08 23:54:39

There is a library for it, called PureTTS. TTSSpeak is a function in that library. I can host the library if you wish. And yes, you can use it in the demo of the product.

"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

2014-10-09 02:24:20

Hi Orin.
Yes you can use pureTts but it only supports sapi which sucks. In the purebasic reference manual there is a section about menus just use menu_create() to create a menu then do all of  your sound stuff. But be sure to open a window before you do anything else otherwise you can't have keyboard input. You can also use the input function to do cool stuff like ask a player's name and things like that.
If you created this in bgt then doing it in pb is really easy.

Guitarman.
What has been created in the laws of nature holds true in the laws of magic as well. Where there is light, there is darkness,  and where there is life, there is also death.
Aerodyne: first of the wizard order

2014-10-10 23:15:10

Hmm. PureTTS is good for those just wanting to make it on Windows, but I have the BGT game for that. I wonder if there is a library that is universal so that I can compile one on Windows and it'll use Sapi, compile it on the Mac and use the System Voice, and I could perhaps ask Robjoy to compile it in Linux to see if maybe I could get it working on Linux as well. That'd be awesome in itself to have a little audiogame on Linux, which has next to no audiogames. While I may prefer the syntax of PB, I also want the ability for my games to be cross platform as well. One option I could try is to make wav files for the speech, but I've got a score variable in the BGT game which Sapi speaks when it changes, so that wouldn't help in that regard.

2014-10-11 02:24:38

Hmmm. Well I've never tried it on mac but I do know you need applescript to give voiceover commands so you might need a way to integrate applescript into your project to use voiceover.
On linux there is probably a library to work with it's screen-reader orca fairly easily. You might also want to check out universal speech which works with all windows screen-readers and works with linux I think. Somebody told me that universal speech works with purebasic but I haven't tried it yet so can't help you there.
Hth.

Guitarman.
What has been created in the laws of nature holds true in the laws of magic as well. Where there is light, there is darkness,  and where there is life, there is also death.
Aerodyne: first of the wizard order

2014-10-11 04:51:56

I do not believe that Universal Speech works on Linux but could be wrong.  Accessible_output2 is the only thing I' aware of that works everywhere, and I have a feeling Linux isn't well tested if at all.  This package will not help a Purebasic programmer.
On Mac, you need to make calls directly to Voiceover via applescript or, in Yosemite javascript.  This can probably be done via Objective-c calls, but the sequence isn't trivial.
On Linux, the synth is the least of your problems.  I'd not worry about Linux for now.  I've heard that, at most, it's 10% of blind people.  Which is fine and good, except that really it's 10% of blind people across more than 10 distros.  The problem here is that binary distributions usually requires compiling on all of them, sometimes requires manual installation of dependencies, etc.  Linux is built around building your own software, not easily installing pre-built packages from others.  Linux is also built around the GPL; it's quite possible that if you use the wrong things, you'll have to open source your application.  I'm not an expert in Linux licensing, and it's possible that the kernel at least has some exceptions for commercial software, but it is a controversial point at best.

My Blog
Twitter: @ajhicks1992

2014-10-11 05:43:33

Guitarman, you don't have to work with Orca directly on Linux. In fact, if a game developer wants to gain TTS output on Linux the library people want is called Speech-dispature which is a global TTS interface for all things speech enabled.

Universal Speech, so far as I know, is not yet Linux compatible. However, to be honest it isn't necessary. Speech-Dispatcher is good enough for that.

Camlorn, I'd say 10% of blind computer users over 10 different distributions probably isn't far wrong, but there are ways of managing it. I have been using and developing Linux software for many years and there are ways around the number of different distributions in use. The main one is try and use libraries and other toolkits common to all Linux distributions which one can reasonably find on a target machine. I know for example if a blind person is using Linux they will likely have Speech-Dispatcher and Espeak installed so can use that as a default for speech output. I figure they have SDL or can install that so its another API I can rely upon for games. There are various other things I can be certain to work out of the box on almost any Linux distribution so its not as bad as you make it seem.

As far as licensing goes that can be tricky. Of course, if your game or project is open source definitely no problem. If a game is commercial or closed source then the developer needs to check licenses and be sure the library or toolkit they are using is under the LGPL not the GPL which allows them to use it in commercial projects without requiring the product to be open source. It is, however, one reason commercial companies are not interested in supporting Linux, because far too much is under the GPL meaning they can not create commercial software without reinventing the wheel by creating commercial libraries for their software.

Sincerely,
Thomas Ward
USA Games Interactive
http://www.usagamesinteractive.com

2014-10-11 19:02:02

I'm not saying it can't be done.  Merely that, for a new programmer, it's probably not worth it.  The complexities of getting this working outweigh the benefits while trying to make a simple program like this one.
Not to mention that Purebasic probably puts it under the "needs to install dependencies", too.  Correct me if I'm wrong, but you typically have to relink at best.  I'm not aware of anyone just giving out object files.  This implies that you need the Purebasic compiler at least.  maybe it's gotten better since I last looked at it, or maybe purebasic uses dynamic linking for everything.

My Blog
Twitter: @ajhicks1992