Re: trying to solidify my understanding of coding concepts, and failing

2021-01-24 Thread AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

One thing i will never understand about the "Bgt coding guys", if You're that smart to learn such scripting language why not learn C sharp instead which is a programing language and more functional or Python otherwise that probabely is way mnore simpler? not that really simpler but, You got what i mean.

URL: https://forum.audiogames.net/post/609235/#p609235




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-24 Thread AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

One thing i will never understand about the Bgft guys, if You're that smart to learn such script ing language why not learn C sharp instead which is a programing language and more functional or Python otherwise that probabely is way mnore simpler not that really simpler but, You got what i mean.

URL: https://forum.audiogames.net/post/609235/#p609235




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-23 Thread AudioGames . net Forum — Developers room : GrannyCheeseWheel via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

In Python, you pass handles without a second thought. BGT just turns it into this nebulous, hard to grasp thing and the manual doesn't explain it properly in my opinion.

URL: https://forum.audiogames.net/post/609101/#p609101




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-23 Thread AudioGames . net Forum — Developers room : targor via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

In other high level languages, basic datatypes such as numbers (int) or characters (char) are often automatically passed by value (a new variable with the same content is made every time you use it as a function argument), while other objects are usually automatically passed by reference (A handle points to the original). This makes it easier, because most times, this is exactly what you want to do and you don't have to specify it yourself.

URL: https://forum.audiogames.net/post/609099/#p609099




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

@musicalman, I have been writing code for a couple of years now, and I still consider myself barely above a beginner. Don't feel bad when you get stuck... it takes time.That being said, let me try and explain handles. First, they are not a BGT thing. A lot of languages have this concept. Consider this:void change_variable(int x)
{
x += 1;
}
int number = 3;
change_variable(number);
alert("Variable", number);I've omitted the main function because it doesn't serve any purpose for this example. If you run this code, you would expect the program to print 4. It won't, though. Instead, the original value, 3, would be shown to you. Why? Unless specified otherwise, BGT passes everything by value, meaning that it creates a new copy of the variable. The function would essentially look like this from the compiler's perspective:void change_variable(int x)
{
int function_x = x+1;
}This is why the code won't produce the same result. Other languages have this too. This is Python (don't worry, it's easy to follow):def change_variable(x):
x += 1
x = 2
change_variable(x)
print(x)This code is equivalent to the earlier script in BGT. The output of Python code will mirror that of BGT, that is, 2.So, here is where passing handles, or references, comes into play. Computers are stupid. They will copy variables and classes unless being told otherwise. Consider this:class Player
{
int x;
Player()
{
x = 0;
}
}

void change_player(Player p)
{
//Do stuff
}

player p;
change_player(p);When called, change_player goes "Okay, I'm just gonna copy this object"... and gets away with it because the player class is small. Consider a larger example, however. What if your player had other classes attached to it, such as vectors, components, inventory... copying the object would be pretty expensive. Enter handles, or pass by reference.void change_player(Player@ p)
{
//Do stuff
}

player p;
change_player(p);This version of change_player now accepts a handle as its parameter. This means that whenever it makes changes to the object, you will see the changes when the function executes. Also, handles, or references, come in handy when you want to avoid expensive copies. You can now pass around the object to the function and it will use it as a pointer back to the original creation. If you're wondering, pointer is also a valid name for "handle", but I would hesitate to use the term because it typically carries other implications when used.I hope this was helpful.

URL: https://forum.audiogames.net/post/608829/#p608829




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

@10It always amazes me that there in fact haven't been BGT viruses.  It's perfect.  All you have to do is say "let my program through the AV" and the program doesn't even have to be written in BGT as long as you claim it is because we already have a culture of turning it off for audiogames.

URL: https://forum.audiogames.net/post/608817/#p608817




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

The problem is that BGT's perspective entirely comes from new programmers, on a site where we consider said aforementioned Bopit clones to be the height of entertainment.  There's a culture here of "I put out a game and that's amazing", coupled with this sort of self-perpetuating thing where when you do that you get a ton of feedback that's positive, the negative feedback gets shot down, and then there's this belief that whoever is trying to learn right now is about to write the next Swamp or Shades of Doom.  Programming competently usually takes intentionally deciding that you're going to learn to program competently rather than just hammer and hammer and hammer away at your game.  The BGT dev approach is instantly gratifying but then takes way, way longer because you're not actually going out and learning the thing.  We've got lots of devs here who consider the project more important than the skill.  They all end up in the same place and this is very much not hypothetical.  Point being, you're on the right track having realized that you need to learn the thing, and that you're not learning the thing, but the last step is realizing that BGT isn't an environment in which it is possible to learn the thing.  It's hard to articulate what the thing is, other than that you're right to think that you're missing the thing, and have identified it for yourself pretty accurately,.You say you're into music.  Some people are talented at music and can sit down at a keyboard and be Mozart in 5 minutes.  But I bet music took you a long time.  Don't feel bad if programming does.  Programming is at a weird intersection of art, science, and project planning.  You have to learn to be creative, and also to work within the rules, and also how to manage really huge projects before they run away from you.Anyway, for an idea of what's available outside BGT: this is old and Python 2, but goes into game design up to and including networking. Probably a bit beyond where you are now.  How about an entire page of game algorithms?  That last one links out to a *ton* of stuff in various languages.  I thought I had more, but it's been a long time and apparently I lost my bookmark folder.  But that should give you a taste, and you can go find tons and tons of resources with Google; pick one that, I hate to use something as cliche as speaks to you but there's no better way to put it.

URL: https://forum.audiogames.net/post/608813/#p608813




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : GrannyCheeseWheel via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

Lol, +1

URL: https://forum.audiogames.net/post/608811/#p608811




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

I think the general consensus is that BGT is easy, in the same way heroine is easy. You'll feel good about yourself, but not in any meaningful way, and you'll lose all your friends and start to smell bad. Then you'll start talking to yourself, and eventually have a stunning moment of clarity where you'll go "wow, my life is fucked, wish I hadn't started shooting up BGT way back when. Ah well, too late to go back now."Seriously, do yourself a favour and pick another language. You'll be just as confused, if not more confused in the beginning, but when it starts to sink in, it will be good knowledge that is transferable. If you ever decide you want a web component for your BGT stuff for example, then you're screwed my confused friend.Plus, I honestly believe it's only a matter of time before some idiot says "hey, install my really cool BGT thing", and some other poor sod lets it through their antivirus. Next thing, their credit card details are being used to purchase drugs in Bolivia, and they're getting emails saying "Give me $500 or I send your naughty message logs to your mum."

URL: https://forum.audiogames.net/post/608807/#p608807




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : musicalman via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

@8, thanks for the perspective!See, I wouldn't have known that BGT is the least helpful ever for getting you to think about design patterns. I guess I latched onto the fact that it does go for quick gratification, and, I thought the tutorials were doing their job well since almost everything I read caused me to think and absorb new information, unless I got stuck lol. So I felt like I was learning something.The one thing I didn't feel I learned much about, though, was how to think through design patterns like you say. I feel like the manual often explains how something works, and on occasion why something works, but not enough about when concepts are appropriate. Sometimes it does, but I can't count how many times I come away from a few paragraphs going "Okay I sort of follow you but how did we get here again?" I find the manual goes back and forth between handholding and setting you on your own in a jarring kind of way... but I have always believed that was normal and expected for any tutorial.

URL: https://forum.audiogames.net/post/608787/#p608787




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

@6First: if you haven't spent at least a couple years on this, you're not behind.  People always overestimate how fast they can go.  It took me at least a few years to be even halfway competent.  This idea that those of us who are good sat down and were going at it in a couple months or something is very incorrect.Second: with all due respect, you're wrong about BGT.  BGT's manual is the least helpful tutorial I have ever seen.  Ever.  You're confused because it doesn't explain anything.  If you want to learn about things like design patterns and stuff--the things that let you get further--you have to leave it.  For instance all the BGT manual ever bothers to say about object oriented programming is that it exists.  You could go find the worst Python tutorials, or the worst C# tutorials, or hell even the worst C++ tutorials, and you'd probably get more out of it than that thing.  People like the BGT manual because it gets you playing sounds quickly and because it's very short.  That doesn't mean it's good, just that you got some instant gratification and a false idea that you'll be able to write a game that's not some tiny bopit or space invaders thing in a couple weeks after reading it.Getting onto something where you can Google your questions is critical.  I've been programming for 10 years and can just flat out write C/C++ without checking docs and I still spend half my time Googling things.And yes, most other high level languages don't make you think about handles.  BGT's scripting language was designed to be embedded in other things where the other thing provides most of the game logic, and then repurposed for BGT by not doing it that way.  SO it's got a lot of weird corner cases in it, handles being one, "what's a module? #include your stuff", no closures (not that you care yet, but you will, once you use a language that has them).  And so on.

URL: https://forum.audiogames.net/post/608721/#p608721




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : thggamer via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

@5 Think the main body of the player class is the same idea as the top of your script, you can put only variables on it. To put instructions, you need functions, like "main" or the player's constructor.If you want to load the footsteps on the player class, you're right, you need the constructor, since you can put instructions only in a function.

URL: https://forum.audiogames.net/post/608713/#p608713




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : musicalman via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

Thanks guys for your responses!@2, You basically showed me that my hunches about handles are correct. While I will have to study what you did a few times to solidify it, I feel like I'm on the right track with that at least. It still feels weird to me that I can't just load the sounds I want in the main body of the player class, so I'm still wondering if there's an obvious reason for that or if it's just BGT being how it is. I only ask because if there's an obvious reason for it, knowing it might help me figure stuff out.Hmm... after sleeping on it, I just realized that I could use the class constructor and destructor to load and destroy sounds inside the class if I didn't want my objects to be globals. I haven't tried anything like that yet, but I think I'll try it later. Either I've stumbled across an invaluable technique or a trap. I have no idea which, I guess it'll depend on where I go...@3 and @5I agree with your sentiment that I shouldn't use BGT. Mainstream help is way more available with other languages as you said, and using something like Python would eliminate the false virus issue that plagues many bGT games.I'd like to try something else, but there are a few reasons I'm afraid to jump ship.I started with BGT, and I'm afraid I'll only be confused if I try to drop what I know and get used to another language with its own quirky rules. Yes, as you can tell I know very little, but I still have something to hang on to.When I read the things devs post and need help with, I am often shaking my head and saying "That sounds complicated, I'm not ready for that!" Whether they use BGT or something else. Of course there is the odd exception, and I haven't read enough posts here to say that every one is beyond me, but I know many are.Also, BGT isn't perfect by any means, but I find that since it forces me to use its tutorials and fixed reference guide, I at least don't have to worry so much about making poor choices regarding what guides and examples to look at. I also don't have to worry about relying on suboptomal dependencies eg. sound management is native to BGT so I just need to learn how it works. I know programmers say BGT's approach does not allow you to expand your horizons, and I agree with the sentiment, but as a beginner among beginners, the cocoon is still very comforting.I realize this may come off as whining that I don't want to change. The thing is, I'm not opposed to the change itself, I just don't have any confidence in my abilities to progress after trying to switch. I know most people say "Do research, man!" And that is something I often willingly do, but I become easily overwhelmed if I start to lose sense of direction. Trying to learn to code has been, for me, mostly a sense of struggling in vane to get my direction, and while I'm sure that's a common feeling among beginners, it's taking me a very long time to overcome it.I suppose frustration is factoring into it too because this stuff does make sense to many people much more easily. Ever since BGT's existance, the difficulty bar has been set much lower when it comes to making a working game. Of course that can be a good or a bad thing depending on how you look at it. But my point is that if BGT really does make game creation so easy, why do I have so much trouble getting it?I guess I could always turn this around and blame BGT and say I'm going to switch to something which comes easier to me. If @4 is right and Python makes handle management easier, maybe that's a compelling reason to switch to Python for instance. But I also know how easy it is for me to get into a dangerous loop, where as soon as I struggle with something, I give it up and look for something else. I'm trying to avoid that tendency because I know a certain amount of struggle is necessary and good.Anyway sorry for rambling so much, I'm just trying to figure things out.

URL: https://forum.audiogames.net/post/608699/#p608699




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : musicalman via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

Thanks guys for your responses!@2, You basically showed me that my hunches about handles are correct. While I will have to study what you did a few times to solidify it, I feel like I'm on the right track with that at least. It still feels weird to me that I can't just load the sounds I want in the main body of the player class, so I'm still wondering if there's an obvious reason for that or if it's just BGT being how it is. I only ask because if there's an obvious reason for it, knowing it might help me figure stuff out.Hmm... after sleeping on it, I just realized that I could use the class constructor and destruct or to load and destroy sounds inside the class if I didn't want my objects to be globals. I haven't tried anything like that yet, but I think I'll try it later. Either I've stumbled across an invaluable technique or a trap. I have no idea which...@3 and @5I agree with your sentiment that I shouldn't use BGT. Mainstream help is way more available with other languages as you said, and using something like Python would eliminate the false virus issue that plagues many bGT games.I'd like to try something else, but there are a few reasons I'm afraid to jump ship.I started with BGT, and I'm afraid I'll only be confused if I try to drop what I know and get used to another language with its own quirky rules. On the same vane, when I read the things devs post and need help with, I am often shaking my head and saying "That sounds complicated, I'm not ready for that!" Whether they use BGT or something else. Of course there is the odd exception, and I haven't read enough posts here to say that every one is beyond me, but I know many are.Also, BGT isn't perfect by any means, but I find that since it forces me to use its tutorials and syntax, I at least don't have to worry so much about making poor choices regarding what guides and examples to look at. I know programmers say that approach isn't good for learning how things actually work, and I agree with the sentament, but as a beginner among beginners, the cocoon is still very comforting.I realize this may come off as whining that I don't want to change. The thing is, I'm not opposed to the change itself, I just don't have any confidence in my abilities to progress after trying to switch. I know most people say "Do research, man!" And that is something I often willingly do, but I become easily overwhelmed if I start to lose sense of direction. Trying to learn to code has been, for me, mostly a sense of struggling in vane to get my direction, and while I'm sure that's a common feeling among beginners, it's taking me a very long time to overcome it.I suppose frustration is factoring into it too because this stuff does make sense to many people much more easily. BGT is proof that we've set the difficulty bar much lower when it comes to getting a working game. Of course that can be a good or a bad thing depending on how you look at it. But my point is that if BGT really does make game creation so easy, why do I have so much trouble getting it?I guess I could always turn this around and blame BGT and say I'm going to switch to something which comes easier to me. If @4 is right and Python makes handle management easier, maybe that's a compelling reason to switch to Python for instance. But I also know how easy it is for me to get into a dangerous loop, where as soon as I struggle with something, I give it up and look for something else. I'm trying to avoid that tendency because I know a certain amount of struggle is necessary and good.Anyway sorry for rambling so much, I'm just trying to figure things out.

URL: https://forum.audiogames.net/post/608699/#p608699




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

i recommend python. i hate bgt, and most people don't recommend. it's out dated. and many more reasons. python is really awsome. any one in this forum recommend, atleest, don't say no if oyu wan't to learn python

URL: https://forum.audiogames.net/post/608683/#p608683




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : ogomez92 via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

yeah BGT forces you to use handles which is strange, most high level programming languages don't require you to even think about that.

URL: https://forum.audiogames.net/post/608676/#p608676




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

Sorry to be "that guy" again... but please don't use BGT. You could google this stuff so easily if you were using literally any other language.In Python for example, you pass handles most of the time without realising it.If you can modify something in place, so dictionary[key] = value, then you've passed a "handle" to it. If not, so string+= 'hello', then you've passed the object itself, and you can't modify the original object anyways.

URL: https://forum.audiogames.net/post/608652/#p608652




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : thggamer via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

Yes, this example is a good way to apply the concepts you learned abouthandles. I'll make a example, let me know if you understood it, or if you became confused so I can explain it another way.In this example, we'll create a function to play a random footstep. Why we'll use handles? Because if we use normal variables, each time we reference the footstep on the function, BGT will make a copy of the sound we referenced. And with a handle, you can prevent this copy and work with the original variable.On the top of your script, you'd create a variable for each footstep:sound step_1, step_2, step_3;In your main function, you'll load each step sound separately, and in your move function, you could do something like this:class player {void move()    {    sound @step_sound;    int r;    // Generate a random number to select which step you want to play    r = random(1, 3);    if (r == 1)        @step_sound = @step_1;    else if (r == 2)        @step_sound = step_2;    else        @step_sound = @step_3;    step_sound.play(); // Equivalent to step_1.play() or the others, since the andle is a reference to the step chosen}Hope it helps a bit.Edit: another thing you could ask is why I didn't put step_1.play(), step_2.play() and step_3.play() on the ifs. This could work, but if you add more code for the steps, you'd need to copy the code in 3 places. With the handle, you can have it in a single place.

URL: https://forum.audiogames.net/post/608638/#p608638




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: trying to solidify my understanding of coding concepts, and failing

2021-01-22 Thread AudioGames . net Forum — Developers room : thggamer via Audiogames-reflector


  


Re: trying to solidify my understanding of coding concepts, and failing

Yes, this example is a good way to apply the concepts you learned abouthandles. I'll make a example, let me know if you understood it, or if you became confused so I can explain it another way.In this example, we'll create a function to play a random footstep. Why we'll use handles? Because if we use normal variables, each time we reference the footstep on the function, BGT will make a copy of the sound we referenced. And with a handle, you can prevent this copy and work with the original variable.On the top of your script, you'd create a variable for each footstep:sound step_1, step_2, step_3;In your main function, you'll load each step sound separately, and in your move function, you could do something like this:class player {void move()    {    sound @step_sound;    int r;    // Generate a random number to select which step you want to play    r = random(1, 3);    if (r == 1)        @step_sound = @step_1;    else if (r == 2)        @step_sound = step_2;    else        @step_sound = @step_3;    step_sound.play(); // Equivalent to step_1.play() or the others, since the andle is a reference to the step chosen}Hope it helps a bit.

URL: https://forum.audiogames.net/post/608638/#p608638




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


trying to solidify my understanding of coding concepts, and failing

2021-01-21 Thread AudioGames . net Forum — Developers room : musicalman via Audiogames-reflector


  


trying to solidify my understanding of coding concepts, and failing

Hi all,I've posted a few times on audiogames about how I will never be able to code games, even in comparatively simple languages such as BGT, and how frustrated I was while trying to learn. Nevertheless, something in me keeps me coming back and trying, despite my dozens of impulses to just throw in the towel and give up the endeavor. I guess I have always dreamed of designing something and trying to make it happen, because musically I'm pretty good at doing just that. and I enjoy games enough to have a spark in me that keeps wanting to try. And I do make progress with coding, so not all hope is lost.I'm more comfortable with basic constructs like loops, functions and conditional statements than I ever was before. I'm not at a level most would consider good, but I definitely feel a lot better than I did, and have made a few small programs with those constructs. But I still struggle to know if i'm coding cleanly, or even to know if I can code something at all.Right now, I'm working on trying to understand objects/classes in BGT. I get their purpose at least on a basic level. But when we start talking about handles is where I run into trouble.The BGT manual does mention what handles are, but I'm having a hard time understanding how I can use them for things.BGT Manual wrote:You may want to pass objects around various functions of your own. To do this, it is essential that you pass handles, and not the object itself. A handle is essentially a reference to the original object. To do this, you would do something like the following:sound@ play_sound(string filename){sound the_sound;the_sound.load(filename);the_sound.play();return the_sound;}void main(){show_game_window("My Game");sound@ ambience=play_sound("curry.wav");ambience.volume=-6;@ambience=null;}In short, when you declare an object handle, you put an @ (at) sign after the variable type. You can then use this variable as if it were a standard object, the only difference being that you are referencing the original variable. When you want to change the value of your handle, for example to make it point to another object of the same type, you simply put the @ (at) sign before the variable name.You can destroy a handle by setting its value to null. This is the object equivalent to 0. With this in mind, though you cannot manually destroy the contents of an object, a way to work around this is to set all your global objects as handles, and only use the objects themselves in functions. This way, although the objects themselves are local variables, they have global variables still referring to them. Therefore the object will always remain usable until its last handle is destroyed.On a basic level, I understand what this is doing: it's basically showing how you can play a sound using a function and handles. My understanding right now is that a handle is just a reference to an object, but the object the handle references can change at any point. However, I'm not sure if there is a specific reason why a handle must be used when creating a function which returns an object. For example, why does play_sound start with sound@ the_sound? Perhaps this is just the way BGT does things, or maybe it makes logical sense? I dunno, I'm still trying to figure that out.Apart from that, I think I've figured the example out, but I'm still stuck on where I would personally use handles myself. I'm sure if I were at a stage where I was ready to write complex games, I would already know, but at this stage, I don't really know and I feel like I need to before moving forward.Something else I have been grappling with which is probably related.I've noticed that there are limitations on when you can do certain things. For example, while you can do basic object setup globally, you can't actually use methods unless you are doing it inside a function/method. I just recently figured that out, and I'm certain this structure is a major source of my struggles.As a test, I tried to make a player class with a move method. Getting the class to move my player left and right for a side scroller, for example, was actually easy. But when trying to figure out how I could hear footsteps, I ran into trouble. In the end, I had to settle for one of two ways, and I'm not sure if either are ideal.Method 1. Create a global sound object for the footstep. Then inside the function which runs the game, load step.wav in that object so either it or my player class can make use of it.Here's the code:player you;
sound step;

class player
{
int pos = 1;
void move()
{
step.play();
pos++;
}
}

void main()
{
show_game_window ("test");
step.load("move.wav");
while (true)
{
if (key_pressed(KEY_UP))
{
you.move();
}
wait (5);
}
}It looks a bit cluttered since I'm using my step sound three times: first time globally to set it up, second in the game function to load step.wav, and thirdly in my move method to actually play it. I have no idea if this is how 

trying to solidify my understanding of coding concepts, and failing

2021-01-21 Thread AudioGames . net Forum — Developers room : musicalman via Audiogames-reflector


  


trying to solidify my understanding of coding concepts, and failing

Hi all,I've posted a few times on audiogames about how I will never be able to code games, even in comparatively simple languages such as BGT, and how frustrated I was while trying to learn. Nevertheless, something in me keeps me coming back and trying, despite my dozens of impulses to just throw in the towel and give up the endeavor. I guess I have always dreamed of designing something and trying to make it happen, because musically I'm pretty good at doing just that. and I enjoy games enough to have a spark in me that keeps wanting to try. And I do make progress with coding, so not all hope is lost.I'm more comfortable with basic constructs like loops, functions and conditional statements than I ever was before. I'm not at a level most would consider good, but I definitely feel a lot better than I did, and have made a few small programs with those constructs. But I still struggle to know if i'm coding cleanly, or even to know if I can code something at all.Right now, I'm working on trying to understand objects/classes in BGT. I get their purpose at least on a basic level. But when we start talking about handles is where I run into trouble.The BGT manual does mention what handles are, but I'm having a hard time understanding how I can use them for things.BGT Manual]You may want to pass objects around various functions of your own. To do this, it is essential that you pass handles, and not the object itself. A handle is essentially a reference to the original object. To do this, you would do something like the following:sound@ play_sound(string filename){sound the_sound;the_sound.load(filename);the_sound.play();return the_sound;}void main(){show_game_window("My Game");sound@ ambience=play_sound("curry.wav");ambience.volume=-6;@ambience=null;}In short, when you declare an object handle, you put an @ (at) sign after the variable type. You can then use this variable as if it were a standard object, the only difference being that you are referencing the original variable. When you want to change the value of your handle, for example to make it point to another object of the same type, you simply put the @ (at) sign before the variable name.You can destroy a handle by setting its value to null. This is the object equivalent to 0. With this in mind, though you cannot manually destroy the contents of an object, a way to work around this is to set all your global objects as handles, and only use the objects themselves in functions. This way, although the objects themselves are local variables, they have global variables still referring to them. Therefore the object will always remain usable until its last handle is destroyed.On a basic level, I understand what this is doing: it's basically showing how you can play a sound using a function and handles. My understanding right now is that a handle is just a reference to an object, but the object the handle references can change at any point. However, I'm not sure if there is a specific reason why a handle must be used when creating a function which returns an object. For example, why does play_sound start with sound@ the_sound? Perhaps this is just the way BGT does things, or maybe it makes logical sense? I dunno, I'm still trying to figure that out.Apart from that, I think I've figured the example out, but I'm still stuck on where I would personally use handles myself. I'm sure if I were at a stage where I was ready to write complex games, I would already know, but at this stage, I don't really know and I feel like I need to before moving forward.Something else I have been grappling with which is probably related.I've noticed that there are limitations on when you can do certain things. For example, while you can do basic object setup globally, you can't actually use methods unless you are doing it inside a function/method. I just recently figured that out, and I'm certain this structure is a major source of my struggles.As a test, I tried to make a player class with a move method. Getting the class to move my player left and right for a side scroller, for example, was actually easy. But when trying to figure out how I could hear footsteps, I ran into trouble. In the end, I had to settle for one of two ways, and I'm not sure if either are ideal.Method 1. Create a global sound object for the footstep. Then inside the function which runs the game, load step.wav in that object so either it or my player class can make use of it.Here's the code:player you;
sound step;

class player
{
int pos = 1;
void move()
{
step.play();
pos++;
}
}

void main()
{
show_game_window ("test");
step.load("move.wav");
while (true)
{
if (key_pressed(KEY_UP))
{
you.move();
}
wait (5);
}
}It looks a bit cluttered since I'm using my step sound three times: first time globally to set it up, second in the game function to load step.wav, and thirdly in my move method to actually play it. I have no idea if this is how