Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5 ... 8

Author Topic: Perplexicon RL  (Read 12313 times)

Anvilfolk

  • Bay Watcher
  • Love! <3
    • View Profile
    • Portuguese blacksmithing forum!
Re: Perplexicon RL
« Reply #30 on: July 15, 2013, 07:02:25 pm »

Why not use XML and an XML reading library out there? Don't reinvent the wheel :) Also, I've heard about JSON, but haven't really tried it. Seems similar in idea to XML.

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Perplexicon RL
« Reply #31 on: July 15, 2013, 07:53:53 pm »

I have no idea how XML works. It does sound better than screwing around with regular expressions the way I am right now though, so I'll look into it.

Edit: Alright, so I went over XML briefly. How does this look?

Spoiler (click to show/hide)

I'm not sure about the stats. it seems like there should be more to the encoding for them.
« Last Edit: July 15, 2013, 09:50:16 pm by Angle »
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Anvilfolk

  • Bay Watcher
  • Love! <3
    • View Profile
    • Portuguese blacksmithing forum!
Re: Perplexicon RL
« Reply #32 on: July 15, 2013, 10:38:21 pm »

Nice :)

It's pretty verbose, and some people are all up in your face like XML is gonna change the world, but ignore them ;)

For Python I use ElementTree, which is super nice, and Python allows you to do some wicked stuff. Anyways, here's how I build subcomponents:

Code: [Select]
class BodyComponent(Component):
  def init(self, XMLRoot):
    partNodes = XMLRoot.findAll("PartComponent")
    for partNode in partNodes:
      part = PartComponent(self.entity, self)
      part.init(partNode)
      self.parts.append(part)

And the PartComponent init just takes the XML subnode and parses it from there. But here's the really cool part.

Code: [Select]
class Component
  """XML is <tag>text</tag>"""
  def init(self, XMLRoot):
    for prop in XMLRoot:
      setattr(self, prop.tag, Utility.convert(prop.text))

So what that is doing is assigning new variables to the Component instance at runtime, based on all property subnodes in the Component node in XML. So for instance, if you had a Name class, each instance that's initialised with the XML you gave me would automatically have variables "singular", "plural", and "adjective". Even a wee bit cooler is that under each Stat, you'd get name as a string variable and score as a float :)

Anyways, just find a nice XML library and walk through the tree creating things :)

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Perplexicon RL
« Reply #33 on: July 15, 2013, 11:02:17 pm »

Java has a couple of XML loaders in the standard library, and I'm going to take a look at them as soon as I finalize my format.

For my example there, though, would having multiple <stat></stat> elements in the same <itemdefinition></itemdefinition> cause problems? What about having different things within the <score></score> element? Like how I have 5.0 and Volume * Density. Should I store the second one separately? As it is, I'd have to put some work into interpreting that string into the actual variables stored.
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Anvilfolk

  • Bay Watcher
  • Love! <3
    • View Profile
    • Portuguese blacksmithing forum!
Re: Perplexicon RL
« Reply #34 on: July 16, 2013, 01:27:53 pm »

You could always just store variables in a HashMap, instead of in actual variables: "Map<String, Double> stats" should work. Makes the whole system a little slower, but I'm guessing that's what happens behind the scenes in Python as well ;)

You can also use XML itself to define multiplication, otherwise you'll need an arithmetic parser...
Code: [Select]
<stat>
  <name>Volume</name>
  <score>5.0</score>
</stat>
<stat>
  <name>Mass</name>
  <score>
    <multiply>
      <operand>Volume</operand>
      <operand>Density</operand>
    </multiply>
  </score>
</stat>

In this case you'd try to parse whatever is inside the <score> tag into a Double, and if that failed you knew it was a variable name and could use that :) Alternatively, just specify in the XML whether it's a variable name or a value:

Code: [Select]
<stat>
  <name>Volume</name>
  <value>5.0</value>
</stat>
<stat>
  <name>VolumeCopy</name>
  <Variable>Volume</variable>
</stat>
<stat>
  <name>DoubledVolume</name>
  <score>
    <multiply>
      <value>2</value>
      <variable>Volume</variable>
    </multiply>
  </score>
</stat>

Again, it's too bad XML is so verbose. I guess you can always use some shortcuts, like <operand name="Volume" />, and then access the "name" attribute of the <operand> node.

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Perplexicon RL
« Reply #35 on: July 16, 2013, 05:35:39 pm »

You could always just store variables in a HashMap, instead of in actual variables: "Map<String, Double> stats" should work. Makes the whole system a little slower, but I'm guessing that's what happens behind the scenes in Python as well ;)

That's actually what I'm doing, except it's HashMap<String, Stat>, where Stat is an interface and a group of classes that can store either a specific variable, or a couple of other stats that the stat is calculated based off of. If the stats for an object change, all of its other stats can be recalculated.

Edit: Does anybody know of a good free XML editor for windows? I found one for Linux, but there don't seem to be any for windows.
« Last Edit: July 17, 2013, 03:20:05 pm by Angle »
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Perplexicon RL
« Reply #36 on: July 22, 2013, 03:42:04 pm »

I've got Materials and ItemDefs working with JSON raws, and a few other misc additions: a very primitive spell system and the ability to change your wielded item.

Next, I'm going to work on moving BodyDefinitions and the equations for combat to the raws.

Edit: Upload! You can try out the basic spell system by pressing s. The only ones that work right now are "Steel Sword" and "Iron Sword", because that's all that's in the raws. Anything you add to them should show up, though.
« Last Edit: July 22, 2013, 05:16:34 pm by Angle »
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

flabort

  • Bay Watcher
  • Still a demilich, despite the 4e and 5e nerfs
    • View Profile
Re: Perplexicon RL
« Reply #37 on: July 22, 2013, 09:23:04 pm »

Haha, it's now modder friendly!  :D
I'm getting excited.
What's the full list of tags available so far?
Logged
The Cyan Menace

Went away for a while, came back, went away for a while, and back for now.

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Perplexicon RL
« Reply #38 on: July 22, 2013, 10:05:01 pm »

Only those shown in the raws. It's not really modder friendly yet, seeing as it's not really a game yet, but I'm working on it. My current challenge is how exactly to move the combat equations into the raws. I think I'll make attacks just be bundles of stats, and have things have lists of ways they respond to these - when exposed to fire, hey burn, when smacked, they shatter or get bent, etc. I'll also need to fully implement the item mods system.
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Anvilfolk

  • Bay Watcher
  • Love! <3
    • View Profile
    • Portuguese blacksmithing forum!
Re: Perplexicon RL
« Reply #39 on: July 23, 2013, 08:17:37 am »

So why did you do JSON instead of XML? What do you like more about it, and should I read more about it? ;)

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Perplexicon RL
« Reply #40 on: July 23, 2013, 08:44:24 am »

With XML, I have to load everything as strings, ad then parse it. With JSON, I can load things as many different types. Let me show you my code, and I think you'll see what I mean.

Spoiler (click to show/hide)
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Anvilfolk

  • Bay Watcher
  • Love! <3
    • View Profile
    • Portuguese blacksmithing forum!
Re: Perplexicon RL
« Reply #41 on: July 24, 2013, 07:46:42 am »

Kinda hard to read, but you seem to be explicitly converting it anyway with Float.parseFloat or so?

Also, I just googled JSON a little bit, and essentially a JSON file appears to be a Python Dict, so I guess it does have typing information, and that's pretty cool.

Either way, nice to see this progressing! :)

Angle

  • Bay Watcher
  • 39 Indigo Spear Questions the Poor
    • View Profile
    • Agora Forum Demo!
Re: Perplexicon RL
« Reply #42 on: July 24, 2013, 01:09:59 pm »

The parse float is in the XML code.

In terms of game balance, do you think I should use mana? I was thinking of using more of a threshold system, where when you use magic, it contaminates you with magical energy, which goes away slowly over time. While contaminated, spells you cast have a slightly greater chance of being miscast, and you may have random magical effects appear in your vicinity, including mutations.

Also I thought of a way to somewhat balance will control over materials. You can use telekinesis on any material you have will control over, but the power of said TK will be rather low. You can make a material turn into any inanimate shape, and if it's living you can turn it into one of the structures that it would naturally form. So flesh can make muscles and other organs, fungus can make sporepods, mycelium, and mushrooms, plants can make leaves, and anything can make a sword, though only some things will make good swords. This means that if you want to make an animate construct, you need to use flesh for muscles. You could then change the material into something else, and it would still function, but in order to make the muscles in the first place, you must use flesh. For composite materials, they can be controlled if you have control over any of the materials that make them up, but you will suffer a % penalty if you don't have control over all the materials that make them up. For example, if you have control over 1 out of 2 materials in a composite material, you suffer a 50% penalty, 1 out of 3 you suffer a 66% penalty, etc.
Logged

Agora: open-source platform to facilitate complicated discussions between large numbers of people. Now with test site!

The Temple of the Elements: Quirky Dungeon Crawler

Anvilfolk

  • Bay Watcher
  • Love! <3
    • View Profile
    • Portuguese blacksmithing forum!
Re: Perplexicon RL
« Reply #43 on: July 25, 2013, 07:23:12 am »

I've never played or read perplexicon, so I don't really know the theme - sorry! You should ask the people who are playing to come over here though :)

syvarris

  • Bay Watcher
  • UNICORNPEGASUSKITTEN
    • View Profile
Re: Perplexicon RL
« Reply #44 on: July 25, 2013, 09:08:53 am »

I like the contamination idea.  If I understand, you mean something along the lines of "You say fire" and your corruption goes up to 10%, and you have ten percent higher chance to set youself on fire or something with subsequent spells?  Probably not that extreme, but it'd be cool to have a system where if you're desperate, you can use more magic at a greater risk of self damage.

If you do go with that, I'd suggest keeping potency and channelling equivalents.  Potency would make the effects of corruption less dangerous, and channelling would affect it's growth rate.

I'm neutral on the will stuff.  Would it still be possible to summon a "Living stone human"?  And then control it with stone control?

And it doesn't make sense to me to be able to control something that's half laser and half steel with just laser control.  I think the old system of needing control over both, and having seperate rolls to control each.

That way, there's more of a disadvantage of giving your steel golem the ability to burn/explode whatever it touches.  Of course, if you already have something that will make it more fragile than a steel golem, and less dangerous than a laser golem, then it's already balanced.

But do whatever you want.  Even if it works terribly, it'll be different from everything I know of.
Pages: 1 2 [3] 4 5 ... 8