RetroAchievements / docs-archive

RADocs
https://docs-archive.retroachievements.org
52 stars 10 forks source link

Talk Page: Achievement Templates #36

Open Tsearo opened 4 years ago

Tsearo commented 4 years ago

I see a few of Achievement Templates that I feel can either use more examples or can be updated to include some new features that have been added since they were made.


Example to check if the last item of X items is collected and the items are stored in bits.

ID Flag Type Size Memory Cmp Type Mem/Val Hits
1 Mem BitX1 0xItemX1 = Value 1
2 Mem BitX2 0xItemX2 = Value 1
3 Mem BitX3 0xItemX3 = Value 1
4 AddSource Delta BitX1 0xItemX1
5 AddSource Delta BitX2 0xItemX2
6 Delta BitX3 0xItemX3 = Value XItemsTotal - 1
7 Mem Size 0xPlayerState = Value Valid player state for collecting items

Requirements *Assuming that 0xItemX bits are 1 when obtained and 0 when not and that multiple items can nob be obtained in the same frame.

Using this method the achievement will trigger when all ItemX's are currently obtained and the previous frame any one of them was not collected.

Real Example CollectAllX

Condition 1 - Difficulty is Normal or higher Conditions 2-6 - All 5 shoes are currently collected Conditions 7-11 - Previous frame any of 4 shoes were collected

*Conditions 2-6 Alternative - Alternatively you can write these conditions with AddSource the way it is used in conditions 7-11 but using value = 5 instead of 4. However you won't be able to debug which specific conditions are currently true/false and if you check a large number of conditions this can be problematic (Ex. out of all the 100+ treasure chests in a game which one is not getting triggered properly)


Alternative ALT1 (Using AndNext)

ID Special? Type Memory Cmp Type Mem/Val
1 AndNext Mem 0xLEVEL = Value LEVELID
2 AndNext Mem 0xX-COORDS > Value RESET-X-ZONE
3 AndNext Mem 0xX-COORDS < Value RESET-X-ZONE
4 AndNext Mem 0xY-COORDS > Value RESET-Y-ZONE
5 ResetIf Mem 0xY-COORDS < Value RESET-Y-ZONE

Also I was suggested to use the issue tracker for suggestions but also told that any edits to pages are reviewed beforehand so I'm not sure was the best way to go about making suggestions would be since I plan to do more. Can I just make these sort of edits myself or is it better to post suggestions here to discuss further before making changes?

meleu commented 4 years ago

Collected 100% of Something

Conditional Resets

ID Special? Type Memory Cmp Type Mem/Val
1 AndNext Mem 0xLEVEL = Value LEVELID
2 AndNext Mem 0xX-COORDS > Value X-UPPER-LIMIT
3 AndNext Mem 0xX-COORDS < Value X-LOWER-LIMIT
4 AndNext Mem 0xY-COORDS > Value Y-UPPER-LIMIT
5 ResetIf Mem 0xY-COORDS < Value Y-LOWER-LIMIT

How to edit the wiki/docs

Can I just make these sort of edits myself or is it better to post suggestions here to discuss further before making changes?

Simple changes can be made with no discussion. But for "educational" contents (like the ones we're talking about here), it's better to discuss with others first (specially with the code-reviewer team).

Tsearo commented 4 years ago

Thanks meleu that makes sense I'll keep posting any suggestions here in the issue tracker then to make sure that we provide the best content for learning.

I agree that the more accurate Mem/Val descriptions for the conditional reset example would be much better there.

For the 100% template I'm not sure how to make a generic one for any mem size so this template is just specific for using individual bits in a way that prevent you from needing to use potentially many Alt Groups.

Since games handle items differently I figured adding this type couldn't hurt since currently we only have the template for when you are checking one value. I'm not sure if there is a generic template that could be made but I'll keep it in mind and see if I can come up with a better one.

meleu commented 4 years ago

I'm starting to realize that maybe it's better to split each template on their own page. I'll try it over the next week and see how it looks.