Element Files

  • Colton-Bates
    24th Dec 2011 Member 0 Permalink
    As you read this (or lose interest and stop halfway through), remember that this is a 'what if.." type thing, not a 'If you don't do this then I'll be a crabby stubborn creep that can't seem to take no for an answer' type thing. What if you could make an element file? Maybe with a .tpt extension? The basic structure that I had in mind was :

    Element <name of new element>
    weight <weight>
    diffusion <diffusion>
    etc.
    update {
    <lua (or maybe C) code to define the update function>
    }
    menu <number representing menu>
    End

    you could then load this element by typing into the console elementload("file.tpt")
    Also, you could stick a bunch of 'official' custom elements directly into the C code and then compile it, so that new elements could be seamlessly integrated into the game.

    If this were to be implemented, it would allow all of the n00bs that can't code but think they can to make their own elements. It would also allow the Devs to concentrate on engine enhancement and optimization. There could also be an element repository, where you could load elements that you don't have. Or, better yet, you could make it such that you can only load custom elements from the beta, and then all of the beta saves would be 'tagged' with the custom elements that are needed. I can understand how this would be a lot more coding than any of the devs would like to do, but it would benefit all of the people who think they can code but they (obviously) can't. (Like me.)

    I found it kind of weird that the person(s) described by the word "you" changed throughout the post.
  • Lynxrufus
    24th Dec 2011 Banned 0 Permalink
    This post is hidden because the user is banned
  • Colton-Bates
    24th Dec 2011 Member 0 Permalink

    @Lynxrufus (View Post)

    1) I don't think so.
    2) I think the Beta-only option would be best, where each save has the element file embedded in it.
    3) I never said it was realistic or possible. I just said it would be cool.
  • Lynxrufus
    24th Dec 2011 Banned 0 Permalink
    This post is hidden because the user is banned
  • MasterMind555
    24th Dec 2011 Member 0 Permalink
    @Colton-Bates (View Post)
    It would take alot more time to get the properties from a file then from variable hard-coded into TPT. Good idea though.
  • Colton-Bates
    24th Dec 2011 Member 0 Permalink
    @MasterMind555 (View Post)

    Colton-Bates:

    3) I never said it was realistic or possible. I just said it would be cool.


  • MasterMind555
    24th Dec 2011 Member 0 Permalink
    @Colton-Bates (View Post)
    If you're suggesting it, I assume you want it implemented ( Even though you didn't made a thread to ask for it to be implemented ), so I gave my feedback on it...
  • Colton-Bates
    24th Dec 2011 Member 0 Permalink
    @MasterMind555 (View Post)
    You make a good point. The part about it not being implemented was mostly to keep everyone from flaming me...

  • jacob1
    24th Dec 2011 Developer 0 Permalink
    This already is sort of possible in the beta. Just set the properties of an element like wind like this:
    tpt.el.wind.enabled = 1

    You can set all of the other properties too, including name and description, and then create an update function using Lua. The only thing you can't do is a graphics function, but you can still set the color. I created VIRS and CURE like this by replacing EQVE and BRAN, but the virus was extremely laggy. Something less complicated would be a little less laggy though.

    Also, in my mod, there will be a way to include this code with saves. I will release the new version tomorrow.
  • Simon
    24th Dec 2011 Administrator 0 Permalink
    @jacob1 (View Post)
    Some tips for optimising performance with the Lua element_func, Don't use tpt.parts, there's still some performance issues, use set_property(string property, object value, number x, number y) and get_property; Although it's still not as fast as the native code, it's good enough.