Page 1 of 4
Implementing: Achievements
Posted: Sat Sep 22, 2012 4:05 pm
by John Adams
Note: Zcoretri, I have scoured the entire forum and cannot find a reference from you saying you were working on Achievements, I knew you were doing Traits, Traditions and Master spells, and seem to recall you adding Achievements to parser, but that was 2 years ago. Just so you know, I did my due diligence before deciding to try taking it on
At any rate, during my "learning packets" adventure, I ran into a problem with Arenas and decided to look at what I thought was already there - Achievements, but the C++ scripts were empty shells. Since the struct was already sound and matched all the data I have, I decided to parse some Achievements data to see how it looked.
Parser was not quite accurate on some things, so I fixed that - renamed some columns, and working last night with Zcoretri, he found the last 2 "unknowns" - so Achievements as far as Data goes, we got.
With the help of Scatman, I spent the night building code to support Achievements lists in Emu, based off the Collections modules. I stopped short of loading the data from the DB because I needed input on how we might store a player's achievement progress (quests? player history? - the latter which I am slated to implement, and the entire reason I am looking into Achievements in the first place).
Using test packets in the code, I could not get the Achievements tab to show any data. Zcoretri, Jabantiz and I fought with it for hours - only to discover another packet was necessary

and after this discovery, Zcoretri got the world to display the test data! Woot.
Next two things we need is to load our Achievements data into the world arrays, then sort out how to store the achievements each player has in progress. "
Player History" has been on my plate for over a year, and I am not sure if we need to sort that out before moving forward with achievements or not?
This thread is to track the progress of this implementation, which was not slated for 0.7.1, but will slip nicely into 0.7.2.
Re: Implementing: Achievements
Posted: Sun Sep 23, 2012 6:09 pm
by Zcoretri
John Adams wrote:Note: Zcoretri, I have scoured the entire forum and cannot find a reference from you saying you were working on Achievements, I knew you were doing Traits, Traditions and Master spells, and seem to recall you adding Achievements to parser, but that was 2 years ago. Just so you know, I did my due diligence before deciding to try taking it on
Working with structs as much as I do, I try to get everything to work.

Re: Implementing: Achievements
Posted: Mon Sep 24, 2012 9:19 am
by John Adams
Too bad you only commit once a year or I would know this
Attached is my DB work, with data. But feel free to discard it and do it all yourself. This list should be from 1161 (AoD) but the struct didn't appear to change, at least the data is still there. 1470 achievements

Re: Implementing: Achievements
Posted: Mon Sep 24, 2012 7:16 pm
by Zcoretri
Is that file different from the one you gave me a couple days ago? The one you gave me had data in it, so I trying to use it.
I am trying my hand at trying to load the data from the DB and sending it to the client. No luck so far

, going to step through it now to see if I did anything correctly, lol.
Re: Implementing: Achievements
Posted: Mon Sep 24, 2012 7:44 pm
by Jabantiz
Zcoretri wrote:I am trying my hand at trying to load the data from the DB and sending it to the client. No luck so far

, going to step through it now to see if I did anything correctly, lol.
I have learned that constructing a packet is a lot harder then it first appears to be, especially when you need to order the list some how. If you need any help feel free to ask and I can try to help figure out what is going wrong (usually takes me 3 or 4 attempts to build a packet before I get it working right).
As for Player History, it is also important to AA's, mainly keeping track of what named mobs the player has already earned AA exp for. The AA exp bar also keeps track of how many quests/exploration points/named mob kills you have earned AA exp for (not an over all total just what you got AA exp for).
Re: Implementing: Achievements
Posted: Mon Sep 24, 2012 11:08 pm
by John Adams
Yup, I have a huge list of all the things to consider for Player History. If you are interested in implementing this, go for it. I have been staring at notes a year, and have not written 10 lines of code

Re: Implementing: Achievements
Posted: Mon Sep 24, 2012 11:48 pm
by Jabantiz
Nope, I'm good, lots of other things I would like to work on when I have the time, player history is all yours.
Re: Implementing: Achievements
Posted: Sat Sep 29, 2012 10:44 pm
by Zcoretri
Making some progress here with the Achievements window...
Achievements.png
Achievements1.png
Achievements2.png
Re: Implementing: Achievements
Posted: Sun Sep 30, 2012 2:42 pm
by Jabantiz
Looks great. This was so under utilized on live, can't wait to see what people do with the sytem on the emu.
Re: Implementing: Achievements
Posted: Sun Oct 07, 2012 9:26 am
by Zcoretri
Still struggling with getting the achievement update packet correct...on my 3rd re-write
Currently, this is what the DB tables are like.
Code: Select all
CREATE TABLE `character_achievements` (
`id` INT(10) NOT NULL AUTO_INCREMENT,
`char_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`achievement_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`completed_date` INT(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
INDEX `FK_character_achievements` (`char_id`),
CONSTRAINT `FK_character_achievements` FOREIGN KEY (`char_id`) REFERENCES `characters` (`id`) ON UPDATE CASCADE
)
COLLATE='latin1_general_ci'
ENGINE=InnoDB;
Code: Select all
CREATE TABLE `character_achievements_items` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`char_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`achievement_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`items` INT(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
COLLATE='latin1_general_ci'
ENGINE=InnoDB;
John, do you see a better way we can structure the DB?
The update packet expects an achievement ID, a completion date and an array of completed items (an index).
Re: Implementing: Achievements
Posted: Sun Oct 07, 2012 11:03 am
by John Adams
Strictly speaking from a DB perspective (not the C++ side), if it were me I would not include a `character_achievement_items` table, but instead let the `character_achievements` be similar to character_items or spells or whatever... multiple records, since it is a small table. We shouldn't need to "normalize" in this case
Code: Select all
CREATE TABLE `character_achievements` (
`id` INT(10) NOT NULL AUTO_INCREMENT,
`char_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`achievement_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`reward_fk` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`completed_date` INT(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
INDEX `FK_character_achievements` (`char_id`),
CONSTRAINT `FK_character_achievements` FOREIGN KEY (`char_id`) REFERENCES `characters` (`id`) ON UPDATE CASCADE
)
COLLATE='latin1_general_ci'
ENGINE=InnoDB;
where `reward_fk` is a FK to the id column (for uniqueness) in our static `achievement_requirements` table (the table from raw data). Not sure if you are using the data I created, or have come up with your own, but I had the usual structure.
achievements - the main table
achievement_requirements - the items needed to complete an achievement
achievement_rewards - your booty
Does this answer your question? Or did I just confuse things more?

Re: Implementing: Achievements
Posted: Sun Oct 21, 2012 1:08 am
by John Adams
After an exhausting effort, Zcoretri (with Jabantiz's C++ help) pulled off the impossible tonight. The biggest packet we have ever dealt with before, "the Adventure List", is working - sorta

We have a ways to go, but Achievements do appear on our test servers. Note, this is brutal data so until we figure out the slowness, don't complain

(not even in French)
To the Devs who have fallen asleep (haha) - I am running Release x64 on my workstation, and had a 10s lag loading Achievements at world startup. My player experienced no delays, and no crashes at all after running /test. I even went to a new zone, still okay and lag meter is almost non-existent. Here are my screen shots:
In this one, not sure why there is an empty category with 1223 achievements in it?
achievements1.jpg
Under Exploration, pretty sure I should be seeing more than just Everfrost here (probably tied to the above question)
achievements2.jpg
But I see progress bars in these next two, which is very cool
achievements3.jpg
achievements4.jpg
Watching these guys figure this stuff out is very exciting. I might accidentally learn something someday! Good job, guys.
Re: Implementing: Achievements
Posted: Sun Oct 21, 2012 1:13 am
by John Adams
Now, on to troubleshooting. Not sure if this is part of the problem, but I ran a query to see what our counts of categories were..
Code: Select all
SELECT COUNT(*), achievements.category FROM achievements GROUP BY category
First, there are no blank categories...
achievements5.jpg
Second, it looks like some things that should be in categories are not being set (battlegrounds = 121 but only has 19 in client)?
Edit: Something Jab reminded me, since this packet came from AoD+, let's be sure the data fits into a DoV client. Might need to parse a 1096 log for achievements afterall.
Edit2: I just updated EQ2TC with the Achievements code and data. While it was loading achievements (release x86), I watched the process memory climb to over 700mb at it's peak, then it started plummeting down, soon as it got to about 400mb the Loading achievements loggers showed it was done. Now the server is resting at a 330mb memory state. Not sure if this is helpful.
Re: Implementing: Achievements
Posted: Sun Oct 21, 2012 7:28 am
by xinux
ok the issue with the blank category in achievements has to do with the achievement_id and my guess the values are just to freaking huge for a test i decided to change my achievement_id to match the id number and it loaded every single one of them instantly. I didn't mess with the achievements_requirement or reward table tho.
Maybe another table to hold the real achievement_id number? o yea i was also able to zone and fight without it crashing.
Re: Implementing: Achievements
Posted: Sun Oct 21, 2012 8:12 am
by alfa
Well a hudge load :p (and you see not in french :p) (for info server engine is: Core I7 2600K with 16 Go of Ram and SSD) Take about 1 minute to load Achievements ! (SVN 1757 Build: Debug)
In release it load propely.
But when I log in, nothing appear in Achievement Tab (DoV 7628)
Just post that if it can help :p