Weekly Recap #9

Phew. The end is in sight for this mod support feature. I knew it was going to take awhile to get through all of the changes I wanted to make. Originally I planned to do it in stages while also doing more visible gameplay changes but shortly after starting I realized that would not be the most optimal.

The majority of these changes were quite intrusive and had the potential to completely break the game, which means I would need to go through and thoroughly test everything for each release. I decided to do this thorough testing after all of the changes have been made. I’ve already encountered some fun bugs like this one (lighting issue around world seam).

Death awaits

Death awaits

To expand on this “mod support” feature, it really encapsulates many small to large changes related to providing a better experience for modders. There have been some great enhancements made such working on support to disable/enable mods on a per world basis without having to restart Crea (UI is not implemented yet). Also I have been reading through the Steamworks API and laying the foundation to be able to easily add support forĀ Steam Workshop. However, most changes have revolved around reworking and simplifying the interface modders will be working with.

A great example of simplifying the modding interface is what I have spent almost all of my time on last week, which is rewriting all of the content scripts. I was surprised how much we already have – 290! This includes monsters, items, plants, tiles, etc. This took several days and much effort/boredom but I am quite pleased with the end result. As an example, here is what the old Greatsword content script looked like versus the new one.

Old Version

name = "Greatsword"
render = Render('mods/base/item/weapons/swords/greatsword.png')
add(render)

item = Item(delay=600, unique=True, use=Substitution('sword', render.image))
item.setUseAnimation("sword", "arm_front")
add(item)

craft = Craft(category='Weapons', subcategory='Swords', level=10, experience=25, service="Anvil")
craft.material('mods/base/item/weapons/swords/broadsword_plus.ce', 1)
craft.material('mods/base/item/recipes/smelting/gold_ingot.ce', 5)
craft.material('mods/base/item/recipes/smelting/iron_ingot.ce', 5)
craft.onCraft = upgradeEquipment
add(craft)

equipment = Equipment('active')
equipment.onCreate = createEquipment(0, 0, [ChangeStatAttribute.create('knockback', (2, 3))])
add(equipment)

add(Weapon("Sword", 65, AttackType.Melee, DamageType.Physical, useMeleeWeapon))

New Version

from core.template.item import Material, Sword, StatAttribute

Sword(
    name = "Greatsword",
    power = 65,
    level = 10,
    experience = 25,
    serviceRequired = "Anvil",
    upgradeFrom = "broadsword_plus",
    materials = [
        Material('gold_ingot', quantity=5),
        Material('iron_ingot', quantity=5),
    ],
    attributes = [StatAttribute('knockback', valueRange=(2, 3))],
)

There are two new aspects here that greatly change things. The first is that there are no imports at the top of each script so you know exactly where everything is coming from. The other is that there are now content templates. Here you see a Sword template that is specialized for creating swords. Templates help setup the boiler plate code and try to provide a more readable interface.

Over this next week I am going to be working on getting Crea completely back up and running as well as fixing up high priority bugs. After that I will be working on getting combat to a better state and also continuing to get multiplayer truly functional. We’ve just about made it through this technical excursion!

2 thoughts on “Weekly Recap #9

  1. Wookiee

    Maybe my bag mod will finally work, as it is now it breaks the ENTIRE character if i use the third bag( just adding it)

    Reply
  2. lemonrev

    Sounds awsume there jason and the code looks soo much simpler to read. Your work is always good. Maybe more streaming lol ??. as it would half take your efforts into answering other peoples questions about stuff.

    I like the bug maybe a perm – black night biome lol i dont know but could work maybe ???.

    Anyways thanks for the update jason and keep up the really good work.

    Reply

Leave a Reply