[On Hold] [MISC] ICGenerator v2.3 - Create ICs not with bytecode, but with redstone [1060]

Discussion in 'Inactive/Unsupported Plugins' started by weeknie, Jul 19, 2011.

  1. Offline

    weeknie

    ICGenerator - Create IC's (Integrated Circuits) not with bytecode, but with redstone
    Version: v2.3

    Credits: PassivePicasso for his database API

    See also:
    Clock Sign

    This plugin will enable you to make redstone ICs ingame, instead of having to rely on preprogrammed IC's or having to write IC's in bytecode.

    Download: http://dl.dropbox.com/u/5202392/ICGenerator.jar
    I can give you the sources on request, GitHub doesn't like me much:(

    Usage (open)

    Building an IC:
    1. Put down the redstone circuit you want to turn into an IC. Add a lever to all the inputs.
    2. Place a main IC creation sign
    3. Place IC input signs next to each lever
    4. Place IC output signs next to all the redstone wire that represents an output.
    5. Hit the main IC creation sign
    6. Hit all inputs and outputs
    7. Hit the main IC creation sign again
    If you're building a stateless IC:
    • Keep hitting the main IC creation sign each time when the outputs are stable (not changing state anymore), until it sais "IC <name> successfully created"
    If you're building a stateful IC:
    • Set the levers to a state transition and hit the main sign. This will register the state transition. Make sure you hit the sign with the exact input that changed the state, else it won't be registered correctly
    • When you've covered all state transitions, type /icgenerator finalize to finish building the IC
    Using an IC:
    1. Place input and output signs
    2. Put levers next to the output signs and make redstone wire lead to directly next to the input signs
    3. Hit the input and output signs
    Note: you can use an input or output multiple times, the input/output will behave like a connected redstone wire. I.e., inputs will be implicitly or-ed (if one connected input is high, that input will be considered high, regardless of how many are low) and outputs will all be set to high if that output is high.

    Sign markup (open)

    Note: <something> is used to indicate user entered text, don't include <>!

    IC creation:
    Main IC creation sign:
    This sign is used to control the building process of an IC
    Lines:
    1. icgenerator
    2. <ic name>
    3. [stateful] (if this is a stateful IC like a flipflop/latch)
    IC input sign:
    This sign marks an IC input, needs a lever next to it to send a signal
    Lines:
    1. icinput
    2. <input name> (if blank, a name will be created and put on the sign when it's added to the IC)
    IC output sign:
    This sign marks an IC output, needs redstone wire next to it to pick up the signal
    Lines:
    1. icoutput
    2. <output name> (if blank, a name will be created and put on the sign when it's added to the IC)
    IC Usage:
    Input sign:
    This sign marks the usage of an IC input, needs redstone wire next to it to pick up the signal
    Lines:
    1. input
    2. <group name>
    3. <ic name>:<input name>
    Output sign:
    This sign marks the usage of an IC output, needs a lever next to it to send a signal
    Lines:
    1. output
    2. <group name>
    3. <ic name>:<input name>

    Features (open)

    Features:
    • Create IC's on the fly from redstone circuitry (even flip flops and other stateful circuits!), no need to program them in java or bytecode
    • Connect the inputs and outputs of one group multiple times, will behave like the redstone wire was simply connected
    • Use /icgenerator autobuild <serverticksdelay> to auto build a (stateless!) IC every <serverticksdelay> server ticks. Make sure the outputs are stable between the inputs changing and the amount of server ticks.
    • Use /icgenerator autodetect to toggle automatic detection of new states when building stateful circuits. Do note that this will only work properly with single output stateful circuits
    • Use /icgenerator forcestate to force a new state when building a stateful IC, useful for when the circuit your building has an internal state, i.e. has state changes that aren't visible from the outside, but will affect the outputs later
    • Use /icgenerator list to list all registered IC's
    • Use /icgenerator listgroups <icname> to list all registered groups belonging to an IC
    • Use /icgenerator listnames <icname> to list all registered input/output names belonging to an IC
    • Use /icgenerator cancel to cancel building of an IC
    • Use /icgenerator delete <icname> to delete an IC and all it's registered groups
    • Use /icgenerator delgroup <groupname> to delete a group
    • Use /icgenerator reloaddb to reload the database (will delete any changes made since the last disable of the plugin!)
    • Use /icgenerator export to export all currently saved IC's to ics.xml (located in the data folder), use /icgenerator import to import IC's from ics.xml (NOTE: improperly formatted xml will currently throw a lot of random errors or generate not working IC's, please ensure the xml is properly formatted!)
    • Use /ic and /icgen as aliases for /icgenerator
    • BukkitPermissions nodes: icgenerator.delete, icgenerator.delgroup, icgenerator.buildic, icgenerator.buildgroup, icgenerator.reloaddb, icgenerator.export, icgenerator.import and icgenerator.* to grant all permissions at once

    Todo (open)

    Todo:
    • Add some features to import/export such as giving a filename and giving the names of IC's to be exported, also add some more error handling for improperly formatted xml files.
    • Add a DTD to the xml file to ensure properly formatted files
    • Make a file with some base IC's like the standard gates and range flip flops, as a standard IC package

    Known Bugs (open)

    Known bugs:
    • A NullPointerException when shutting down the server, causing IC's or groups not to be saved. I'm currently not sure what's causing this bug, but I'm going to look into it

    Changelog (open)

    Changelog:
    v2.4:
    • Added partial automatic detection of new states when building stateful circuits, it only works for single output IC's though
    • Added the /icgenerator forcestate command to force a new state. Use this when you have an "internal" state, i.e. a circuit which state might change, but where that change is not directly visible (for instance a selector based on a flip flop)
    v2.3:
    • Fixed a bug where icgenerator.* wasn't granting the icgenerator.build and icgenerator.buildgroup permissions
    • Added the /icgenerator listgroups <icname> command to list all groups for a certain IC name
    • Added some extra output to /icgen list to indicate when there are no IC's registered yet
    • Removing input/output signs will now really delete them from the group, so they won't trigger any levers or inputs that belonged to that group. If a group is empty (i.e. no inputs/outputs connected to it anymore), the group will be deleted too (and thus not show up in /icgenerator listgroups <name> either)
    • Fixed a problem with the datafolders name including a space, the datafolder will now always be called IcGenerator
    • Added a "Registered state transition detected" message to indicate that the user wants to add an already registered state change
    • Added some extra output to /icgenerator cancel to indicate if there was nothing to cancel
    • /icgenerator cancel will now also cancel building when you're already building the lookup table/state machine
    • Stateful IC's will now say they're building the state machine instead of the lookup table
    • Added the /icgenerator listnames <icname> command to list all input/output names for a certain IC
    v2.2.1:
    • Added the icgenerator.import and icgenerator.export permissions for import/export permission granting, and icgenerator.* to grant all icgenerator permissions at once
    • Added some output to /icgenerator import and /icgenerator export to tell you that you've actually imported/exported something
    v2.2:
    • Added an import/export feature to/from xml. Any improperly formatted xml will throw random exceptions or import IC's which will throw exceptions. For now it will be up to you to determine what's wrong with the xml, if you're modifying it yourself. If the error popped up from an exported xml file though, please post in here.
    v2.1.1:
    • Fixed consistency, your groups will be saved again
    v2.1:
    • The plugin works multiworld now (IC's are still server wide)
    • Fixed a bug where /icgenerator reloaddb would give the usage message instead of completing normally
    v2.0:
    • Added support for stateful circuits. You can now store flip flops and other stateful circuits
    • Rewrote large parts of the code. This also enables you to use inputs and outputs multiple times on groups. Inputs will be implicitly or-ed, so if 1 of the inputs is high, that input will be considered high.
    v1.2.1:
    • Added /icgenerator reloaddb and the permission icgenerator.reloaddb, so that you can reload the database on the fly (will delete any changes made since the last disable of the plugin!)
    v1.2:
    • Added BukkitPermissions. The following nodes are now available: icgenerator.delete, icgenerator.delgroup, icgenerator.buildic, icgenerator.buildgroup
    v1.1:
    • Fixed the /icgenerator delete [name] command
    • Added /icgenerator delgroup [name]
    • Added /ic and /icgen as aliases for /icgenerator
    v1.0:
    • Released the plugin
     
    ghowden and MasterMeNL like this.
  2. Offline

    MasterMeNL

    I shall try this awesome sauce!
     
  3. Offline

    Plague

    please update to 1000
     
  4. Offline

    MasterMeNL

    It works on #1000 just fine for me.
     
  5. Offline

    Plague

    Title says otherwise
     
  6. Offline

    weeknie

    Things seem to be working fine on #1000 here too, I'll update to #1000 then

    I hadn't been able to test yet, but updated

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  7. Stupid question: WTF is an "IC" ?
     
  8. Offline

    desmin88

    @Digi
    Integrated Circuit
     
    Digi likes this.
  9. Offline

    tbdaugaard

    I really like the idea of this plugin. It could potentially make extremely large circuits much smaller and if the circuit is saved to a flatfile, they can even be distributed easily.

    However, until the plugin would support stateful circuits like flip flops, I don't see much use for it :/

    I'm cheering for support for flip flops, latches and the likes! :D
     
  10. Offline

    MasterMeNL

    Indeed, I find this much better than (for example) RedstoneChips since the circuits are stored in a couple of signs instead of iron and gold blocks which even though smaller than normal redstone, still take up quite some space.
     
  11. Offline

    weeknie

    I'll see if I can make an export/import function, so that you can use that.

    The stateful circuits are going to take some time though, also there are still some good ol' bugs in vanilla minecraft/craftbukkit which of course people expect ME to fix
     
  12. Offline

    RobotGymnast

    I'm interested as to what those bugs are! I don't keep up much with bug news (except the extremely well-known ones, like piston glitches).

    I'm also going to offer some unsolicited advice: I haven't really looked into Bukkit development much, but it seems that a stateful circuit could be represented as a finite state machine, where, with any given internal state of the circuit, a set of inputs could cause one or both of
    • Change of state
    • Change of output
    The two challenges is then in detecting the number of possible states for a circuit. This could be done by brute force: powering each "section" of the circuit, in every combination (where a section is defined as a block, a wire, a torch, a diode, etc.), and waiting for it to change itself to a different powered combination (in which case, reduce to previously solved, or yet-to-be-solved, problem), or, if it remains stable in that state, determine how the input affects the internal state and the output.

    For simplicity, circuits which internally change their own state should be disallowed (for instance, a circuit which flips on and off, based on a diode). To check this, every previous state the circuit has gone through since the initial combination would need to be kept and checked with every change, and if we've previously existed in the same state, the circuit is looping back on itself.

    I have a strong feeling I left something out, but I can't figure out what (there's a good change I'll spend the day tomorrow coding something similar, and I'll correct my post then).

    Anyway, I hope I didn't come across as too arrogant, offering unsolicited advice on something you're likely capable of figuring out; it's a problem which immediately intrigued me, so these were my initial thoughts on it. (Also, if it does seem helpful, but confusing, I can certainly try a little harder to explain myself).
     
  13. Offline

    weeknie

    Those bugs is basically just one, an entity bug, which makes signs fail miserably sometimes (they don't know what's causing it though).

    The finite-state machine is something I already knew and is what I was planning on implementing anyway.
    I was planning on having the user enter the amount of states though, I'm not going to try to figure this out all on my own.
    But you'll see that soon enough

    Thanks for the advice, it might've been unsolicited and not really helpful, but thanks nevertheless;)

    Good to see some users our there, it kinda looked like my plugin wasn't really being used:p
     
  14. Offline

    RobotGymnast

    Ouch, that would be hard to work around. I actually feel bad for knowingly buying a game from such a terrible coder.

    Come to think of it, couldn't you just keep keep the circuit in memory, as-is? No complex (and likely buggy) analysis of the circuit necessary, just store it in memory (or rebuild it below the map), and the blocks to file with IDs and coordinates.

    I actually just stumbled across it (haven't downloaded it yet), but it looked damn useful, even with pure circuits.
    Have you looked at http://help.github.com/win-set-up-git/? (You don't need the GUI, and depending on how you installed Git, you can just do it from the normal command prompt, instead of the Git bash).
     
  15. Offline

    weeknie

    I can't work around the bug so I'll just have to fix it, it's exactly the reason why I delayed buying the game so much before I started to actually play it

    I don't want to copy the circuit to somewhere below the world, basically because I simply don't like the idea. i don't think it's really a nice way, also I feel that is a lot more bug-prone than my approach is.
    Also, I find this just as interesting as you, which makes me actually want to build the FSM:p

    About the git thing, I tried that multiple times, somehow it just won't accept my key pair:(
     
  16. Offline

    RobotGymnast

    I believe VoxelSniper does something similar for "undo" actions (actually, they copy things above the world), and it seems to work great. It doesn't carry across world saves, but it does work fine for what they're doing.

    Tell me about it; I'm relearning C just to do this (although I can't remember why I chose C instead of, say, Python).

    Strange; I've never had Github reject a keypair (actually, once, when I was giving it my private key instead of my public key). Have you tried without a password?
     
  17. Offline

    weeknie

    I'm almost done!

    I'm having a consistency problem at the moment, but that should be all to make stateful IC's working!

    Ok then, stateful IC's are working now

    I'll be working on ClockSigns for a while though, had some nice feature suggestions for that one, also it works really well with the now working stateful IC's, you can now easily make a counter for instance

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  18. Offline

    MasterMeNL

    Awesome!
     
  19. Offline

    RobotGymnast

    It would be nice to have an in-game guide to creating circuits, too, like "/icgenerator tutorial" or some such.
     
  20. Offline

    weeknie

    I'm not sure I like that idea, the minecraft chat isn't that awesome with text, I don't think it will be very readable
     
  21. Offline

    RobotGymnast

    The advantage to simply rebuilding the circuit is that it also works for extremely stateful circuits (for instance, 20-bit counters), where manual state transitions are infeasible.
     
  22. Offline

    weeknie

    You could simply connect 2 counters, the highest output of the first to the clock of the second
    I really don't like the idea of copying the redstone circuit to somewhere above or below the world and I won't do it either.
    I'll make a way to connect inputs to outputs easily though, perhaps even in the IC creation itself, but I'm working on ClockSign first
     
  23. Offline

    weeknie

    I updated IC Generator to make it multi world and fix a bug, this does however require that you rebuild your database, ie delete it and loose all your IC's.
    I'll be done with the import/export feature tonight or tomorrow, after which you won't have to delete your database and rebuild all your IC's anymore.

    Sorry for this guys, I'll get you some preprogrammed IC's to import though!:D
     
  24. Offline

    RobotGymnast

    I can't think of a compact way to create a subtractor, since a simple binary subtractor (with carry) will have a ton of input combinations (taking a ton of time to input). Can you give any recommendations?
     
  25. Offline

    weeknie

    Bottom right: http://www.play-hookey.com/digital/binary_subtraction.html

    That's a adder *and* substractor, that should help:p
     
  26. Offline

    RobotGymnast

    Oops, I really should have specified that I meant binary subtraction with something like 20 digits, which has to be broken down into several more manageable circuits (say, 3 digits minuend, 3 digits subtrahend, 3 digit difference, 1 digit carry). Actually, in my application, I have a constant subtrahend, so I can have a 6-digit minuend, a 6-digit difference, and a 1-digit carry).
     
  27. Offline

    weeknie

    I'm making an automatic builder soon, which will let you set up the circuit and let it build automatically
    I am however not doing any coding this night, I've got a headache and that doesn't make for very pleasant programming:(
     
  28. Offline

    RobotGymnast

    Excellent! This should make for better IC's.

    Feel better!
     
  29. Offline

    weeknie

    Sorry for the failure there, I caused some very nice NPE's on save/load, but that's fixed now.
    You'll have to rebuild the database...again:S
     
  30. Downloaded and played with it just now and works perfectly, even got my T-flipflop working, nice work :) Still, saving doesn't work, gives an NPE

    Code:
    java.lang.NullPointerException
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.writeMap(AbstractObjectWriter.java:2705)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.writeNativeObjectInfo(AbstractObjectWriter.java:916)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.insertNativeObject(AbstractObjectWriter.java:1842)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.internalStoreObject(AbstractObjectWriter.java:1926)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.internalStoreObjectWrapper(AbstractObjectWriter.java:2735)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.writeMap(AbstractObjectWriter.java:2708)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.writeNativeObjectInfo(AbstractObjectWriter.java:916)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.insertNativeObject(AbstractObjectWriter.java:1842)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.internalStoreObject(AbstractObjectWriter.java:1926)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.writeNonNativeObjectInfo(AbstractObjectWriter.java:1193)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.insertNonNativeObject(AbstractObjectWriter.java:1815)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.storeObject(AbstractObjectWriter.java:1906)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.writeNonNativeObjectInfo(AbstractObjectWriter.java:1202)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.insertNonNativeObject(AbstractObjectWriter.java:1815)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.storeObject(AbstractObjectWriter.java:1906)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.internalStoreObjectWrapper(AbstractObjectWriter.java:2738)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.writeMap(AbstractObjectWriter.java:2708)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.writeNativeObjectInfo(AbstractObjectWriter.java:916)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.insertNativeObject(AbstractObjectWriter.java:1842)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.internalStoreObject(AbstractObjectWriter.java:1926)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.writeNonNativeObjectInfo(AbstractObjectWriter.java:1193)
            at org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter.insertNonNativeObject(AbstractObjectWriter.java:1815)
            at org.neodatis.odb.core.layers.layer3.engine.AbstractStorageEngine.internalStore(AbstractStorageEngine.java:564)
            at org.neodatis.odb.core.layers.layer3.engine.AbstractStorageEngine.store(AbstractStorageEngine.java:438)
            at org.neodatis.odb.core.layers.layer3.engine.AbstractStorageEngine.store(AbstractStorageEngine.java:420)
            at org.neodatis.odb.impl.main.ODBAdapter.store(ODBAdapter.java:113)
            at me.passivepicasso.util.DatabaseManager.store(DatabaseManager.java:150)
            at me.passivepicasso.util.DatabaseManager.addAll(DatabaseManager.java:53)
            at me.weeknie.icgenerator.world.IcGeneratorWorld.saveAll(IcGeneratorWorld.java:72)
            at me.weeknie.icgenerator.IcGenerator.onDisable(IcGenerator.java:37)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:128)
            at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:899)
            at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:288)
            at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:281)
            at org.bukkit.craftbukkit.CraftServer.disablePlugins(CraftServer.java:157)
            at net.minecraft.server.MinecraftServer.stop(MinecraftServer.java:312)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:391)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Doesn't seem to be any errors when loading, but I have nothing saved so that would make sense




    EDIT:

    Deleting everything in plugins/IcGenerator/ and letting it regenerate the database seems to have worked, I think I corrupted it before when I accidently linked an output to an input in the same circuit and had a mile long error message and crashed the server

    EDIT #2:

    Tried making the t flip flop again (no idea how it worked last time :eek: lol) but everytime I make it it works but the server will freeze for a few seconds before the output toggles, the mile long error it generates is a stack overflow error, seems a recursive function is breaking in your code, it also then breaks the database so all saved ICs are lost
     

Share This Page