Not Dead yet - About Crafting

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
Antagonist
Higher
Posts: 71
Joined: Sun May 23, 2010 9:55 am

Not Dead yet - About Crafting

#1 Post by Antagonist »

Soo...

I wrote some tuts, was loud-mouthed about some of my module plans... and then dissapeared.

Well, in short, my thesis happened. Cant really put time in my module anymore, but I certainly havn't forgotten about it. But I have some ideas for it that other module writers might be interested in, so I'm posting some stuff here. That and to say that I am not dead yet.

It's sci-fi based, and one of its inspirations is Space Station 13. A nice, if primitive multi-player rogue-ish game. One big feature is its ability to assemble various components to create something new. Like a plasma tank to a timer and a igniter makes a bomb. Naturally I need to be able to do this.

First, there are 3 types of crafting I am considering. Actual crafting, like making a sword from metal, Improvement, like fitting a piece of armor or sharpening a sword, and assembly, which is simply putting together some components.

I'm starting with assembly, its simple and reversible. Crafting and Improving is a one-way process.

I havn't done much beyond deciding how it should look data side. I decided to put the recipes into the object file, instead of creating a new type of entity.

Code: Select all

newEntity{
 define_as="LASER_GUN",
 display="-", color=colors.RED,
 craftable={
  frame={type="frame", subtype="handgun"},
  power={type="ammo", subtype="power_cell"},
  barrel={type="barrel", subtype="laser"},
 },
 components={
  frame=resolvers.object{"frame"},
  power=resolvers.object{"power"},
  barrel=resolvers.object{"barrel"},
 }
 dam=function(self)
  return self.components.barrel.dam
 end,
 dam_type=function(self)
  return self.components.barrel.dam_type
 end,
 accuracy=function(self)
  return self.components.frame.accuracy*self.components.barrel.accuracy_mod
 end,
}
A few notes about this. The parts in craftable is in object filter style, so you can filter for name, types, size, whatever. The resolver is custom, and points back to the filter to create a part for when you find a laser gun somewhere. When you assemble it from existing components in inventory, those replace the resolved components. And... the stats of the weapon depends on its components. So if you find a superior laser barrel, you can replace it with the barrel on your current weapon (either replacing or disassembling and reassembling with the new barrel). Ammo cartridges like power cells can also easily be replaced. I'll need to test whether it works with stacks tho, like individual bullets.

Now, one limitation of this is that the recipes that can be parsed is determined by the zone. If you have a zone that no laser guns can spawn in, you cant craft a laser gun. I'm considering maybe spawning a dummy zone or object generator for crafting, will see how that goes. As this is I can spawn fully assembled weapons, all with spawned components without actually adding any custom code other than the special resolver.

On my TODO to actually create something useful from this is the actual parser to create a list of recipes from the loaded objects, do a canCraft check that sees if you have all the needed stuff in your inven, and finally a UI for the process.

Once that's all done I'll move on to crafting and improving, the latter perhaps by somehow applying egos to already created objects? Will see, but I'm trying to use as much of the existing engine classes I can. Will perhaps also need to add a requirements field as well, where certain stats or talents are needed to assemble or disassemble some objects.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Not Dead yet - About Crafting

#2 Post by yufra »

Looks interesting to be sure! I will keep an eye on this because crafting would be a nice addition to a post-apocalypse type game where Viral Resistance is eventually headed. Assuming of course my thesis behaves. :D
<DarkGod> lets say it's intended

Post Reply