1. #1

    Murdoc Loch - Total Noob

    Well I feel inadequate - All you guys with your fancy logic games - with all the crazy stuff that's been made so far in the editor I thought for sure I could make a Drop 7 Remake - turns out i'm a total noob!

    I'd love for my 5+ days of work not to have been for nothing so if anyone has any insight as to how I can optimize this to work in the evo editor I'd be greatly appreciative!

    Share this post

  2. #2
    LukeMSki's Avatar Senior Member
    Join Date
    Mar 2014
    Posts
    1,326

    Re: Murdoc Loch - Total Noob

    I think people may be able to help you better if you explain in words what your code is doing. It was hard to see in the video. I am not the best at this so I won't try and offer any advice, but there is probably a way to cut down on the amount of code by chaining successive function together and running loops. Maybe a possible tip is seeing if there is anything that you can replace with vectors as this can cut down on the amount of code. I am sorry I can't be of more help, but hopefully some of the skill game experts can help you out.
    Share this post

  3. #3
    dasraizer's Avatar Senior Member
    Join Date
    Apr 2014
    Location
    UK, Isle of Wight
    Posts
    1,195

    Re: Murdoc Loch - Total Noob

    howdy Murdoc

    i'd go with Vector at size 49 and use a loop code that 'get vector's any info needed for filtering

    so grid
    Vector(size 49)

    grid position = location_X+(location_Y*7) , the 7 is the grid size in X direction

    make a loop* and iterate through it looking for any cell that's greater than 0, then look at cells -1,+1,-7 and +7 and apply your logic, if +7 is down, see if its empty, copy the number to the new location and delete its current (with animation)

    to make it easier maybe make the grid size in the vector +1 on each edge (81 size) and use the coordinates 1-7x1-7 so you don't have to worry about testing the +-1 & +-7 go out of bounds, bit of a cheat but works nicely

    *make a loop
    interval trigger(disable after 1 tick)->do some stuff->increment index->filter test index less 81->
    true->back to do some stuff, false-> either state enable the interval or state enable say button movement that then on select enables the loop interval.
    the good thing with doing this is the game will easily handle 81 iterations if your logic code in it is fairly short, if not just break out of the code periodically by state enabling the interval, could do this with modulo index and test=0

    in fact with a 9x9 grid you can use that to insert the number to be dropped into the grid and then instead of copying below you could copy from above, note that you will need to scan the grid backward, if 0,0 location is in the top left that is...


    edit: i'll try break some of this down a little

    make a vector(size 81)
    make a Variable Data Source=Index, this holds base the index for the Get Vector
    (i'll assume 0x0 is top left, also Get/Set Vector always start at 0, so a vector of size 81 has indexes of 0-80)

    move code Set Vector (choice=drop position=1 to 7)
    made choice
    SetVector(select=vector,index=choice,value=random)

    set Index= 70 (X=7, Y=7 so 9*Y+X)
    interval for loop
    test code, the conditions for this depend if the cell is occupied or not, if cell is occupied, you'll need to test if it drops or needs to be acted on, not sure of you game logic here

    test cell X,Y, if Get Vector(Index)=0 its empty, so test above
    { this is true impulse code inside the {..}
    test above cell X,Y, if Get Vector(Index-9) >0 then:
    { above code
    set vector(index=index,value=getvector(index-9) ,copy above
    set vector(index=index-9,0), clear above
    } out of above code
    } false the cell has a number, because were scanning backward it means that there is either a number below it or its at the base of the grid
    { false code
    do your logic on surrounding squares
    for left do if GetVector(index-1)>0 it has a number
    for right do if GetVector(index+1)>0 it has a number
    for above do if GetVector(index-9)>0 it has a number, again because there is an empty border around the playing area, it will never go out of bounds and will always return 0 if out of the playing area.
    for below do if GetVector(index+9)>0 it has a number

    do some logic based on results.
    }

    note all true and false code or any impulse chain must send its impulse to the next event below, this is so the loop doesn't stop, easy to spot as you're game will just halt and do nothing.

    set value, decrease index by 1
    test index modulo 9=0, if this is true then decrease index by 2, so the border is not included in the next iteration
    test index greater than 9, true impulse back to loop start
    false enable button code


    some ideas, hope its not confusing.
    Share this post

  4. #4
    LukeMSki's Avatar Senior Member
    Join Date
    Mar 2014
    Posts
    1,326

    Re: Murdoc Loch - Total Noob

    Originally Posted by dasraiser
    some ideas, hope its not confusing.
    It's confusing. Your stuff always confuses me.
    Share this post

  5. #5

    Re: Murdoc Loch - Total Noob

    Share this post

  6. #6
    dasraizer's Avatar Senior Member
    Join Date
    Apr 2014
    Location
    UK, Isle of Wight
    Posts
    1,195

    Re: Murdoc Loch - Total Noob

    just edited it, hopefully easier to understand, best advice, get some graph paper make a grid 9x9 and do the math.

    @murdoc, lmao at that gif
    Share this post

  7. #7

    Re: Murdoc Loch - Total Noob

    Originally Posted by dasraiser
    howdy Murdoc

    i'd go with Vector at size 49 and use a loop code that 'get vector's any info needed for filtering

    so grid
    Vector(size 49)

    grid position = location_X+(location_Y*7) , the 7 is the grid size in X direction

    make a loop* and iterate through it looking for any cell that's greater than 0, then look at cells -1,+1,-7 and +7 and apply your logic, if +7 is down, see if its empty, copy the number to the new location and delete its current (with animation)

    to make it easier maybe make the grid size in the vector +1 on each edge (81 size) and use the coordinates 1-7x1-7 so you don't have to worry about testing the +-1 & +-7 go out of bounds, bit of a cheat but works nicely

    *make a loop
    interval trigger(disable after 1 tick)->do some stuff->increment index->filter test index less 81->
    true->back to do some stuff, false-> either state enable the interval or state enable say button movement that then on select enables the loop interval.
    the good thing with doing this is the game will easily handle 81 iterations if your logic code in it is fairly short, if not just break out of the code periodically by state enabling the interval, could do this with modulo index and test=0

    in fact with a 9x9 grid you can use that to insert the number to be dropped into the grid and then instead of copying below you could copy from above, note that you will need to scan the grid backward, if 0,0 location is in the top left that is...

    some ideas, hope its not confusing.
    with this vector 49 thing i can apply different logic onto different pieces at the same time? the way i have it now is the logic is in the piece - i couldn't think of a way to have a universal filtering system because multiple values are in multiple places and need to be filtered simultaneously to achieve multiple outcomes - so all the logic is built into the piece and each piece is copied and filtered off at the top if the piece is in play


    The board works like this: each space is on (1) or off (0) it does not keep the value of the piece in play - then it checks the sum of the column to relay back to any piece and then it looks left and right to see the sum of the pieces next to it - back at the piece this data is checked against the value of the piece and when they are equal the piece is broken and the board space is set back to off (0)

    Now because each piece could be anywhere on the board it has to have all this logic for each value and space, looking at both the sum of the column and the sum of it's neighbors - to do this it's wired to all 49 spaces three times, one for each sum and a third to turn the space back to zero after the piece is broken
    Share this post

  8. #8
    dasraizer's Avatar Senior Member
    Join Date
    Apr 2014
    Location
    UK, Isle of Wight
    Posts
    1,195

    Re: Murdoc Loch - Total Noob

    edit:
    ok
    clear flag
    iterate through and drop the numbers, set a flag if it had to do this then and loop drop this if flag set
    iterate through with another bit of code that sums the values in a column grid (81 size) that adds the values as it works back through
    then do another pass to see what's left and right and then clear if equal
    then start the iteration process for dropping the numbers, summing of columns and the left/right pass if the flag was initially set (ok have to have 2 flags, one it was set and another for looping the drop)

    this way you only need 1 piece of code (not 49) for all the game logic.
    Share this post

  9. #9

    Re: Murdoc Loch - Total Noob

    Originally Posted by dasraiser
    this way you only need 1 piece of code (not 49) for all the game logic.
    alright - well I'm going to try my best to figure out what all that meant and start rebuilding this for the third time

    Thanks a lot for taking the time to help me out! If I get stuck on your explanation you mind if I send you a PM for further clarification?
    Share this post

  10. #10
    dasraizer's Avatar Senior Member
    Join Date
    Apr 2014
    Location
    UK, Isle of Wight
    Posts
    1,195

    Re: Murdoc Loch - Total Noob

    np, always available, well will be in a few hours, getting late n im an old git

    the basis behind of all this is the vector, get vector, and set vector

    the get vector inspects the value at the index of the selected vector (remember the index starts from 0, so a vector of size 10 has indexes ranging from 0-9)
    use get vector like any other number in the editor, ie it can be used in a generic filter, operators, etc
    set vector does exactly the same as the set value, uncheck size 3 and it opens more options for setting a value at a particular index

    the key to getting this to work is iterating the grid, can do it either by +-1 left/rigth +-9 for up/down to the current position index or
    index=grid position X + (grid position Y * 9), both yield the same results, using grid positions X&Y would mean you need to make a loop inside a loop, the outer loop increases Y and inner cycles X from 1 to 7
    Share this post