There are currently two types of substance which can be run in CodeBugs: Plants and Bugs.
All substances must reference CodeBugs.Core
All substances must be signed by developers. You will need to retain the certificate in order to login as a developer in CodeBugs.
Please do initial debugging in standalone mode, then remove faulty bugs before restarting, otherwise your bugs' bugs will spread around the network!
Currently Plants are only in place for completeness, and do not do much however I am always open to suggestions...
Bugs must inherit CodeBugs.Core.Bug
You must have a New() method with no parameters and must call:
MyBase.New(SubstanceTypeEnum)
SetSubstanceImage(My.Resources.MyBugImage)
Where My.Resources.MyBugImage is a drawing.image
N.B. I am hoping to change this to a WPF imagesource fairly soon... please bear with me.
You should also override:
Protected Overrides Sub Born(ByVal DNA() As Byte)
Protected Overrides Sub TakeTurn()
Protected Overrides Sub ScanComplete(ByVal SubstancesFound() As CodeBugs.Core.Substance)
Protected Overrides Sub BeingAttacked(ByVal Attacker As CodeBugs.Core.Bug)
The above methods are fairly self-explanatory...
This method is called when a bug is first born. DNA() will usually be empty. It is there such that information may be passed between bugs on reproduction... see Reproduce(ByVal DNA() as byte) for more information.
This method is called once per turn and should be where the actions of your bug are decided and take place. Please do not write long loops etc in here.
Callback method from Public Sub Scan(ByVal Distance As Double). Remember that SubstancesFound will contain yourself.
Called when you are attacked.
Again, fairly self explanatory...
Call to attack another Bug.
AttackEnergy is the energy used to make the attack... 1 unit of energy will remove 1 unit of health from a target.
Move the bug by one unit in the direction. Direction should be given in Radians.
Causes the bug to reproduce. Will only take place if old enough and hasn't reproduced recently.
DNA is information that can be passed between bugs. It must be less than 128 bytes in length.
Substance to be eaten to gain energy. Substance can be either Bug or Plant...
Distance is how far to scan.
Scanning will result in a loss of energy = Distance * 0.1
Anonymous