Better Logic Editor

#1
I like the idea that players can build their own levels, but the current level editor is kind of hard to use. My idea is to add a new logic editor (like the advanced building tool in relation to the basic building tool) which has features found in high level programming languages.

A few ideas:

1. More versatile variables. Currently variables are only used as event triggers. It will be great if variables can be used in events, for example, as the amount of time to wait or the distance that somethings travels.

2. Switch statement. It will be great to have "if" statements in events. For example, if the progress is greater than 50%, reset the bomb . Or, if Ran (an variable with an arbitrary value) is greater than 1, reset the chicken.

3. While / Until loops. It will be far more useful than the "loop x times" event we already have.

4. Object Oriented. Instead of reset(the bomb), why not use bomb.reset? It will make lots of sense since levels are already objects based.

I understand the developer(s) probably want to make the logic editor easy to use for everyday players by not using concepts found in most high level programming languages, but it also severely limits the flexibility one have when making a new level. I believe an advanced level editor will open up lots of possibilities and benefit the community.
 

Shade

Active Member
#2
2. easy, use logic gates
add event that also adds variable, so when var >= 50, activate an object that will reset a bomb when activaded.
and
ran >= 1, activate an object that will reset the chicken

3. again, use logic gates
object x = loop event forever
object y can stops the loop by deactivating object x
 
#3
2. easy, use logic gates
add event that also adds variable, so when var >= 50, activate an object that will reset a bomb when activaded.
and
ran >= 1, activate an object that will reset the chicken

3. again, use logic gates
object x = loop event forever
object y can stops the loop by deactivating object x
I know 2&3 are doable, but it seems overly complicated. I find myself constantly coming up with this kind of workarounds when creating new levels, but the thing is, sometimes with the current logic editor, things cannot be done because the level of complexity it involves. For example, nested loops will definitely a mess. A more elegant way to program the logic will definitely help.
 
#4
2. easy, use logic gates
add event that also adds variable, so when var >= 50, activate an object that will reset a bomb when activaded.
and
ran >= 1, activate an object that will reset the chicken

3. again, use logic gates
object x = loop event forever
object y can stops the loop by deactivating object x
And to be honest, the solution you proposed isn't actually a while loop equivalent. A while loop always checks the condition before executing the block of code (chain of events in the case of Besiege), so it only exits the loop after executing the chain of events (or without executing the chain of events when condition is not met in the first place). The solution you proposed may exit the loop in the middle of the chain of events.

For example, I want a bomb to be activated for 10s and then deactivated for 10s repetitively while N (a arbitrary variable) is greater than 1, which looks like this:
while(N>1){
activate(bomb);
delay(10s);
deactivate(bomb);
delay(10s);
}
This makes sure that when it exits the while loop, the bomb is always deactivated, and every cycle is always 20s. The solution you proposed either has a random end state (we don't know if the bomb is activated or not when the object that runs the loop is deactivated), or the last cycle is likely not to be exactly 20s (deactivate the bomb when deactivate the object that runs the loop, which will mess up the timing of the last cycle).

Hopefully this comment doesn't look too geeked out. I just what to point out why a true while loop is necessary.
 

Shade

Active Member
#5
ah i see, that's sounds more complicated. i usually use the solution i proposed for animation.
i can think a complicated logic that can check if the loop is finished or not but i can see why we need your proposal.
 
Top