Latest Evennia dev blog: Tutorial-writing and Attributes galore: It has been a while since I wrote anything for the dev blog of Evennia, the MU creation system - so it's about time! ...
<inputtype="image"src="https://www.paypalobjects.com/en_US/SE/i/btn/btn_donateCC_LG.gif"border="0"name="submit"title="PayPal - The safer, easier way to pay online!"alt="Donate with PayPal button"/>
<p>It has been a while since I wrote anything for the dev blog of Evennia, the MU creation system - so it's about time!</p>
<p>It's been a busy spring and early summer for me, with lots of real-life work going on away from Evennia land. But that hasn't meant activity on the Evennia code base has slowed!</p>
<h2>Many eyes on Evennia 1.0-dev</h2>
<p>Earlier this year I <ahref="https://github.com/evennia/evennia/discussions/2640">invited people to try the Evennia develop branch</a> - what will become Evennia 1.0. A lot of bold beta-testers have since swapped to using the 1.0 branch. While there are plenty of issues being reported, most seem pretty happy about it so far. As mentioned in earlier dev blogs, Evennia 1.0 has a <ahref="https://github.com/evennia/evennia/blob/master/CHANGELOG.md">lot of improvements and new features</a>!</p>
<p>As part of this, the amount of PRs being made against develop branch has increased a lot, with awesome community members stepping up to fix bugs and even address long-standing annoyances. This includes everything from big improvements in ANSI parsing, fixes to the 1.0 FuncParser, RPSystem contrib optimizations and much more - <ahref="https://github.com/evennia/evennia/pulls?page=2&q=is%3Apr+is%3Aclosed">the list of closed PRs is long</a>.</p>
<p>Another big part are everyone helping to answer questions in chat and suggesting improvements to the community in general. Thanks everyone!</p>
<p>On my end, I'm working on the Beginner Tutorial for the new 1.0 documentation. This will be a multi-part tutorial where you get to make a little MUD game from scratch. It goes through the basics of Evennia all the way to releasing your little game and I hope it will help people get started. This will also lead to a new contrib - the <code>evadventure</code> package, which should (I plan) have everything the tutorial needs to run. This is useful for those that prefer picking apart existing code over reading about it.</p>
<p>The tutorial game itself is based on <ahref="https://www.gmbinder.com/share/-LZGcbbCQaqjIV0TmLx3">Knave</a>, an light Old-School-Renaissance (OSR) tabletop roleplaying ruleset inspired by early editions Dungeons & Dragons. It's simple enough to fit in a tutorial but with enough wrinkles to showcase how to create some basic rpg systems in Evennia:</p>
<p>Alternative Twitch-based combat system (might be a stretch goal)</p>
</li>
<li>
<p>NPCs with very simple AI, Death and respawn</p>
</li>
<li>
<p>Simple Questing system with NPC quest givers and quest states</p>
</li>
<li>
<p>A small example world (tech-demo)</p>
</li>
</ul>
<p>I won't include how to make a Crafting system, since I've added a full <ahref="https://www.evennia.com/docs/1.0-dev/Contribs/Contrib-Crafting.html">Crafting contrib</a> to Evennia 1.0 for devs to be inspired by or tear apart.</p>
<h2>Some nice new things about Attributes</h2>
<p>In general news, Evennia 1.0 will see two big improvements when it comes to <ahref="https://www.evennia.com/docs/1.0-dev/Components/Attributes.html">Attributes</a>.</p>
<h3>AttributeProperty</h3>
<p>This is a new way to write - and particularly initialize - Attributes. Traditionally in Evennia you need to initialize your object's Attributes something like this:</p>
mana <spanstyle="color: #666666">=</span> AttributeProperty(<spanstyle="color: #666666">10</span>)
</pre></div>
<p>This makes Attributes look more like Django fields, sitting directly on the class. They can also have <code>category</code> and all other values you'd expect. You can still access those Attributes like normal:</p>
<p>An interesting feature of using an <code>AttributeProperty</code> is that you can choose to <em>not</em> actually create the <code>Attribute</code> under the hood unless the default changed:</p>
<p>When you now access <code>char.strength</code> you will get <code>10</code> back but you won't actually be hitting the database to load anything - it's just giving you the default. Not until you <em>change</em> the default will the actual <code>Attribute</code> be created. While this can be very powerful for optimization, note that you can of course not access such data via <code>char.db</code> or <code>char.attributes.get</code> either (because no <code>Attribute</code> yet exists). So this functionality can be confusing unless you know what you are doing. Hence <code>autocreate</code> defaults to <code>True</code>.</p>
<h3>Saving Attributes with hidden database objects</h3>
<p>This is one of those classical quirks of Evennia that many have encountered. While Evennia can save a lot of things in an <code>Attribute</code>, including database objects, it cannot do so if it doesnt <em>know</em> those database objects are there. This is fine if you are saving a list or a dict with objects in it - Evennia will go through it and make sure to serialize each db-object in turn.</p>
<p>But if you "hide away" your db-object you will be in trouble:</p>
<p>This fails because we store <code>char</code> inside <code>MyStore</code> and there is no way for Evennia to know it's there and to handle it properly.</p>
<p>For the longest time, this was just a limitation you had to accept. But with Evennia 1.0-dev you can now help Evennia out:</p>
<p>With the new <code>__serialize_dbobjs__</code> and <code>__deserialize_dbobjs__</code>, Evennia is told how to properly stow away the db-object (using the tools from <code>evennia.utils</code>) before trying to serialize the entire <code>MyStore</code>. And later, when loading it up, Evennia is helped to know how to restore the db-object back to normal again after the rest of <code>MyStore</code> was already loaded up.</p>
<h2>Moving forward ...</h2>
<p>For Evennia 1.0, the tutorial-writing is the single biggest project that remains - that and the general documentation cleanup of our entirely rewritten documentation.</p>
<p>After that I will dive back in with the issues that has popped up during beta-testing of 1.0-dev and try to wrap up the most serious ones before release. Still some time away, but it's getting there ... slowly!</p>
<p>I didn't write an end-of-the year summary for 2021, so this first devblog of 2022 will also look back a bit at the past year. It also helps me get used to using this new blog platform I wrote about in the previous post.</p>
<h2>On Evennia 1.0</h2>
<p>Speaking of 2021, you may have noticed that there was no new versioned Evennia release last year. Last one was 0.9.5 back in 2020. This may make it seem like little is happening in Evennia-land ... but the fact is that while little has happened in <code>master</code> branch over the past year, all the more has been going on in Evennia's <code>develop</code> branch - the branch which will become Evennia 1.0.</p>
<p>Now, it's not really so good to have a development branch run so long. This is because in the interim people report errors in <code>master</code> branch that has since been resolved in <code>develop</code>. It's becoming more and more cumbersome to backport which means that <code>master</code> is not getting updated all that much right now.</p>
<p>Post 1.0, I'll likely switch to a faster release cycle, but at least for now, it has been hard to avoid, this is because I'm reworking the entire documentation site alongside the code, with new autodocs and tutorials. Releasing an intermediary version with some sort of mid-way documentation version is just not practical for me. So I hope you can be patient a bit further!</p>
<p>Soonish™, I hope to have finished the code changes needed for 1.0 and then I'll invite adventurous folks to use the branch more extensively while the docs are still in flux.</p>
<h3>So what's still to do for Evennia 1.0?</h3>
<p><ahref="https://github.com/evennia/evennia/projects/9">This is the current TODO list</a>.</p>
<p>The big one I'm currently doing is to refactor the <code>contrib/</code> folder to have more structure (it has grown organically until now). After this, there are a series of bugs and minor features to do. I will also go back and address the low-hanging <code>master</code> branch bugs that haven't already been resolved in <code>develop</code>.</p>
<p>I won't/can't commit to a deadline for Evennia 1.0, but I'll keep chipping away at it as fast as I can. If you want things to move quicker you are more than welcome to join the other contributors that have chipped in with PRs over the past year. Check out the TODO list and consider investigating a bug or implementing a feature - some may be pretty straight forward.</p>
<h3>... some thanks!</h3>
<p>A big thanks to those that dropped an encouraing buck in my hat (aka <ahref="https://www.patreon.com/griatch">patreon</a> or with a one-time paypal donation) over the year. Everyone has different economical situations and I hope I've been very clear that noone should feel obligated to pay anything. But those of you that could and did - know that you have my thanks - it's very encouraging.</p>
<p>But - just as big thanks go out to <em>everyone</em> that contributed to Evennia in 2021! "Contribution" means so many things - we have the troopers that contributed code and made PRs (best Hacktoberfest yet!), but also those that dilligently reported bugs and pointed out problems as well as (and this is just as important) were active and helpful in the support chat and github discussion!</p>
<p>You guys make the community, that's all there is to it. Thanks a lot.</p>
<p>Now onward into this new, fresh year and towards that elusive Evennia 1.0 ...</p>
<footerclass="devblog-footer">
<spanclass="devblog-copyrights">
<p>Image by <ahref="https://pixabay.com/users/tumisu-148124/?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=6786741">Tumisu</a> from <ahref="https://pixabay.com/?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=6786741">Pixabay</a></p>
</span>
<aclass="devblog-to-toplink"href="2022.html#2022-01-06-into-2022-with-thanks-and-plans"title="Link to top of post">⇬(top)</a>