Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How to create Achievements in games in AS3?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 JETeran   Members   -  Reputation: 280

Like
0Likes
Like

Posted 06 August 2012 - 06:58 PM

Hi everybody.

I'm developing a small game and I thought that I can create some achievements to make it more cool.

Do you know any good tutorial / guide that I can lear how to create them in AS3?

I haven't yet research about it, but I think that, based on my xp, a good way to make them appear is by the use of flags; something like, for example: create a counter that sums the total of doors opened. When that counters hits 100, pull the flag doorsAchievement = true. That counter and flags are global vars.

What do you think about it? Is something like that or am I away from what really is?

Thanks so much for your time guys.

JET

Success with courage,

José Eduardo Terán

Project Management & Game Programming. DSK International Campus

Indie Game Developer
Google + Account


Sponsor:

#2 jbadams   Senior Staff   -  Reputation: 19324

Like
2Likes
Like

Posted 06 August 2012 - 07:50 PM

Yep, you're on the right track: all you need to do is keep track of any statistic (kills, doors opened, times the player has jumped, fastest time through a level, whatever) you think might be an interesting basis to award one or more achievements, and then award the achievement when that stat reaches a certain value. If you proceed with your current line of thinking you should be able to implement a working system with little trouble.

For best flexibility you'll want probably want to consider tracking a few different kinds of data:
  • Simple counters. Used as you described to count the number of times something happens. Common examples might be kill counts, pick-ups, or repeating some action a certain number of times. All you need to do is increment the stored value, and once it reaches a certain threshold the achievement is unlocked.
  • Timers. If your game has sections or levels, you can time how long the player takes to complete each, and store the lowest value each time. You can then set goal times, and perhaps even have different rankings for bronze, silver and gold completion times. This is marginally more complicated than just counting a value, but not overly difficult as long as you have access to some sort of timing function, and it's a pretty popular type of achievement in games where it is appropriate.
  • Conditions under which a certain goal is accomplished. You might for example have an achievement for completing an entire level using only the most basic weapon. This is again a little more complicated than either timing or value-counters, but can potentially offer more interesting goals. You would most likely implement this using a series of flags; considering my example of completing a level using only the basic weapon, you would store a boolean value that is initially set to false and changed to true as soon as the weapon is changed. At the end of the level or game play section, you then check if your boolean has been toggled and award the achievement if appropriate. Obviously this type of achievement is very specific to your game play, and harder to generalise than the above options.

If you're developing Flash games, it's worth noting that you could choose to embed an existing system such as the Mochi Achievements API (check the developer section, they have a number of other useful tools as well.), or if you're publishing on certain platforms they might provide their own achievements API such as the one provided by Kongregate. Even if you choose not to make use of these options, it might be worth having a look at the functionality provided to get ideas for your own system.


Hope that's helpful! Posted Image

#3 Malabyte   Members   -  Reputation: 589

Like
2Likes
Like

Posted 06 August 2012 - 07:57 PM

Well, an achievement list is nothing more than stored values and often graphics changing one image file to another - or - (if simplified) from one stored value to another.

As a side note, I've just watched a lecture on data structures and algorithms, in which the tutor talked about looking at the problem in the simplest possible way. If your algorithm is way off, then it's gonna be a nightmare to process no matter how hard you optimize your program or hardware. But even a great algorithm can be the wrong one, if it boils down to you overthinking the problem.


More on-topic:

Supposing someone wants a fancy image-based achievement system like in WoW, here's a rough algorithm:

1. Add the basic "zero-achievements-awarded" pane (whatever graphics).
2. Add collapsibility to the pane (or separate windows for each category and link them together).
3. Add a 1D locational array to each page of achievements.
4. Give each array item a separate instance of a global variable (let's call it gloVar), set to 0 by default.
5. Add darkImageX to achX (etc for all possible achievements).
6. Add preconditions to each achievement (visually and syntaxically).

Now, to make achievements actually work in WoW:

7. When all preconditions are met, replace darkImageX with litupImageX and run the ImageXtoast animation in the main game window.
8. Set the array item's individual gloVar to 1.
9. Have achX swap place with the array item above it, if {varBinary == 0} - OR - the array item above achX has a name earlier in the alphabet. Else, do nothing more.
10. Update any group achievements that may be attached to this achievement.
11. Done.

I think paired If statements are the way to go. (1) If (action == true) {varCounter++} and (2) if (varCounter == 100) {update achX} (using pseudo-syntax here).

====================

I'm not familiar with AS3 myself, but hopefully my reply nonetheless added something useful. Good luck on the system though.

Cheers.

Edited by DrMadolite, 06 August 2012 - 08:22 PM.

- Awl you're base are belong me! -

- I don't know, I'm just a noob -


#4 JETeran   Members   -  Reputation: 280

Like
1Likes
Like

Posted 06 August 2012 - 10:00 PM

Yep, you're on the right track: all you need to do is keep track of any statistic (kills, doors opened, times the player has jumped, fastest time through a level, whatever) you think might be an interesting basis to award one or more achievements, and then award the achievement when that stat reaches a certain value. If you proceed with your current line of thinking you should be able to implement a working system with little trouble.


WOW I'm impress jbadams, thank you sooo much for your support; your words are truly gold.

I will work in what you told me; sounds very interesting to implement statistics in the game and be tracked. And speaking about it, I LOVE statistics and want to implement them in the game; I have some Qs about it but I will make them in another post.

It's very good the way you told me to track the data in the game, sounds like a good way to have a great game design to me !! I'm going to analise it very carefuly !!

I'm going to try both APIs to see which one is close to my needs; even tho, I'll try to do it by myself, is not that rocket science (or why I'm an Engineer? ;) )

Once again, thank you so much jbadams !!!

Well, an achievement list is nothing more than stored values and often graphics changing one image file to another - or - (if simplified) from one stored value to another.

As a side note, I've just watched a lecture on data structures and algorithms, in which the tutor talked about looking at the problem in the simplest possible way. If your algorithm is way off, then it's gonna be a nightmare to process no matter how hard you optimize your program or hardware. But even a great algorithm can be the wrong one, if it boils down to you overthinking the problem.


Hey DrMadolite, thanks too for your great response !!

About your side note, did you see that lecture online? Will be cool if I can have a look at it; I have a BS in CS so I think won't be much of a problem ;)

1. Add the basic "zero-achievements-awarded" pane (whatever graphics).

About this, you mean like a place in the game where the progress of achievements appear? (I remember about Dwarfs?! or Left 4 Dead, they track the progress of the achvs) In the case of Dwarfs?! , once you get an achv, pop ups a nice note saying that you got it; feels good to see it !!

I'm not familiar with AS3 myself, but hopefully my reply nonetheless added something useful. Good luck on the system though.

Yes I understand completly what you told me, you did a nice work xplaining it !!

Thank you so much for your support guys, it's really nice and happy to be sorrounded by creative and happy-to-help people like you !!

I will work on all this !!

Happy week !!

Success with courage,

José Eduardo Terán

Project Management & Game Programming. DSK International Campus

Indie Game Developer
Google + Account


#5 Malabyte   Members   -  Reputation: 589

Like
1Likes
Like

Posted 07 August 2012 - 01:41 PM

About your side note, did you see that lecture online? Will be cool if I can have a look at it; I have a BS in CS so I think won't be much of a problem ;)


Let me link the youtube channel instead, since it's a lengthy college course (if you wanna see all the videos):
https://www.youtube....r/UNSWelearning

About this, you mean like a place in the game where the progress of achievements appear?


Yes, the frame or window showing you the list of achievement obtainable or obtained. An achievement pane is essentially the same as a game screen, except that the entities/files used are 2D images and text rather than mobs, loot and buildings.

Cheers. Posted Image

Edited by DrMadolite, 07 August 2012 - 01:42 PM.

- Awl you're base are belong me! -

- I don't know, I'm just a noob -


#6 JETeran   Members   -  Reputation: 280

Like
1Likes
Like

Posted 07 August 2012 - 02:59 PM

Let me link the youtube channel instead, since it's a lengthy college course (if you wanna see all the videos):
https://www.youtube....r/UNSWelearning


Truly awesome, thanks DrMadolite, it's very valuable. I use the Khan Academy to be in touch with math, check it out here:
http://www.khanacademy.org/

Yes, the frame or window showing you the list of achievement obtainable or obtained. An achievement pane is essentially the same as a game screen, except that the entities/files used are 2D images and text rather than mobs, loot and buildings.

Thanks for the xplanation, I will work on this.

Thanks for your support !!

Success with courage,

José Eduardo Terán

Project Management & Game Programming. DSK International Campus

Indie Game Developer
Google + Account


#7 Malabyte   Members   -  Reputation: 589

Like
1Likes
Like

Posted 07 August 2012 - 04:28 PM

KA bookmarked Posted Image

I'm doing Game Programming bachelor's in about 6 or 18 months, so I need to brush up on some math. Revisit some of the high school stuff and then learning more about vectors, logarithmics and other related stuff.

Cheers.

Edited by DrMadolite, 07 August 2012 - 04:29 PM.

- Awl you're base are belong me! -

- I don't know, I'm just a noob -


#8 JETeran   Members   -  Reputation: 280

Like
0Likes
Like

Posted 08 August 2012 - 08:30 PM

I'm doing Game Programming bachelor's in about 6 or 18 months, so I need to brush up on some math. Revisit some of the high school stuff and then learning more about vectors, logarithmics and other related stuff.


Good to hear DrMadolite, yes KA it's a GREAT starting point, hope you like it !!

Let's keep in touch, and thanks once again for your help !!

Success with courage,

José Eduardo Terán

Project Management & Game Programming. DSK International Campus

Indie Game Developer
Google + Account





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS