2019-04-28 20:24:38

Hello! I am creating a game, and it would be nice if i could create options, like so: If i turn on music of always, in the main menu there is no music untill i turn the option off. How to make it so the option will save. And next, how to make achievements. And last, how can i create a check for updates thing? How does the game know if there is an update available? Please someone help me. Best regards: Marco

Best regards: Marco

Thumbs up

2019-04-29 18:54:22

Please answer

Best regards: Marco

Thumbs up

2019-04-29 19:39:11

wel, you could use file writing and reading commands for saving.
You could do like,

//in your menu.

For achievements, I'm not sure.

yo! so I'm working on programing, it's really hard. But I'll tell you where you can contact me if your stupid enough to do so.
Contact information:email: [email protected]
Skype: Brennan Draves
I'm usually found on online games, chatting, and being warned bye admins for talking to much, f**k you admin!

2019-05-05 07:56:30

dude, please, read the bgt manual. a lot of this stuff could be answered from that.

blindness is an ability. not a disability.

2019-05-05 08:22:29 (edited by ogomez92 2019-05-05 08:38:44)

Use serialize
In my bgt days serialize saved my life but... I just would never do something like this anymore when in more less primitive programming language you can save entire game objects to files, pickle, or JSON strings...

If you are just starting out why don't you learn to code with js or python? we can point you in the right direction.

I remember rhythm rage save files were a pain to save!

Want to see my rhythm rage save level function? that is a pain!

void set_level(string level,string value,string pack) {
int whichone=-1;
string info;
string[] lvl=string_split(info,",,,",true);

for (uint i=0;i<lvl.length();i++) {
if (string_left(lvl[i],level.length())==level) {
if (whichone!=-1) {
string built;
for (uint i=0;i<lvl.length();i++) {

//the save function looks like this

void ser() {
if (creatingpack) {
//if (!SCRIPT_COMPILED) return;
dictionary data;
//save unlocks here
string[] save=unlockinfo.get_keys();
string savea;
for (uint i=0;i<save.length();i++) {
if (!ok) {
if (lang==1) 
alert("error","error saving unlocked level information.");
if (lang==2) 
alert("error","Hubo un error al guardar tu información sobre paquetes desbloqueados. Puede que encuentres algún problema.");
for (uint u=0;u<savea.length();u++) {
string srld=serialize(data);
string esrld=string_encrypt(srld,"soyelputoamo");
file fld;

//with the new version made in js I can just save an object like

 function set_level(level,value) {

//And the save function is just this.

                 export function save() {
    if (!fs.existsSync(os.homedir() + '/rpacks')) {
fs.mkdirSync(os.homedir() + '/rpacks');
    let write = JSON.stringify(data);
fs.writeFileSync(os.homedir() + '/rpacks/save.dat', write);

that's it.

Just trying to give you an example as to why you should use  a more modern programming language.

If you don't see the difference...

Thumbs up

2019-05-05 12:49:19

you made me want to start in js rofl

Thumbs up

2019-05-05 13:15:44 (edited by ogomez92 2019-05-05 13:17:31)

again, any other programming language can generate JSON strings which lets you serialize arrays to files, as it is a popular format to save data. Swift can do it, Python can do it, .net can do it, etc.

In python you have something called cPickle which is used by many NVDA addon writers and probably audiogame writers to seamlessly convert any python object to a file, similar to what I am doing in JSON.

Thumbs up

2019-05-05 19:17:31

People seem to have helped you for saving things.
TLDR: save it to some sort of file.

as far as an achievements system goes, I recommend this chapter of a game programming patterns book that is very good. It talks about the observer pattern which can be used to make an achievement system. The other chapters in the book are very good and I recommend those as well for other game programming help.

I don’t believe in fighting unnecessarily.  But if something is worth fighting for, then its always a fight worth winning.
check me out on Twitter and on GitHub

2019-05-05 20:14:37 (edited by ogomez92 2019-05-05 20:14:48)

at #8 isn't this post very advanced for the sort of games are currently being done?
Anyway, bgt does not have event support. You'd need to make a bizillion different callbacks to implement this kind of system. Don't troll the poor guy big_smile

Thumbs up

2019-05-05 20:19:06

@9, na, not advanced at all. For the AG.NET community that'd be a huge leap forwards towards mainstream integration.

"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 +1

2019-05-05 21:28:09

To quote the chapter I linked to earlier

This is tricky to implement cleanly since we have such a wide range of achievements that are unlocked by all sorts of different behaviors. If we aren’t careful, tendrils of our achievement system will twine their way through every dark corner of our codebase. Sure, “Fall off a Bridge” is somehow tied to the physics engine, but do we really want to see a call to unlockFallOffBridge() right in the middle of the linear algebra in our collision resolution algorithm?

This is a rhetorical question. No self-respecting physics programmer would ever let us sully their beautiful mathematics with something as pedestrian as gameplay.
What we’d like, as always, is to have all the code concerned with one facet of the game nicely lumped in one place. The challenge is that achievements are triggered by a bunch of different aspects of gameplay. How can that work without coupling the achievement code to all of them?

That’s what the observer pattern is for. It lets one piece of code announce that something interesting happened without actually caring who receives the notification.

For example, we’ve got some physics code that handles gravity and tracks which bodies are relaxing on nice flat surfaces and which are plummeting toward sure demise. To implement the “Fall off a Bridge” badge, we could just jam the achievement code right in there, but that’s a mess.

Let me draw your attention to the idea That inserting achievement code willy nilly is not scaleable. Its messy, at best and  if the game advances into a bigger project or when a bigger project is attempted, the programmer is going to need to come up with a better system. to make programming easier,  isolated game components are put together to make a complete game.

What we’d like, as always, is to have all the code concerned with one facet of the game nicely lumped in one place.

To address the size of the projects people are working on. I'll say good programming practices scale in both directions. Bad ones: spaghetti coding, code interdependencies, etc do not scale. They make it more difficult for for you 5 to 6 months down the road and if you have other people reading your code, good luck to that other person trying to make sense of the mess you wrote.  If you wish to move beyond our niche  community you have to step-up your programming game.

I don’t believe in fighting unnecessarily.  But if something is worth fighting for, then its always a fight worth winning.
check me out on Twitter and on GitHub