Many Layouts VS One Layout with date loading.

This forum is currently in read-only mode.
From the Asset Store
Progress\Loading Bar. Now Load you game like a Professional.
  • Maybe ill describe the idea first.

    In my game there is the space. And in space you sure can bump some solar systems.

    I have splited the "galaxy" view with "solar system" view. so when being at "galaxy" layout you bump a "solar system" object, which takes you to a new layout "solar system".

    in this layout the player can only see the star/sun and the planets and the rest. its separated from the rest. Now as space exploration goes theres a need for a lots of lots of solar systems more or less generated or hand designed. As far as my knowledge go theres only two solutions to this matter (aside from VRAM eating multi-layering)

    1. Make ONE layout PER Solar system (which is almost insane thinking of the numbers)

    2. Make ONE layout that will arrange himself by reading the informations.

    my problem is, when the 2nd options sounds most apealing - i dont know how to exectue it.

    basicly: player enters previously visited system - the solar system infromations(what objects, how many planets, where, how far away from the sun ect ect) are loaded. If player visits non-visted one the infor is randomly generated but STORED after this to avoide random generation each time he enters.

    this would be great but i dont know how i can do it. How can i write those information somehere after randomly generating and then load them back when player visits the same system.

    i know, i can as well just hand made all of them but... you know

    (PS: if anything is unsure for you please ask me. i know i have a hard time describing my problems. even in my native language)

  • See now your going into the level editor plane of thought, which is something just about everybody does at some point or another.

    There are several objects that can do this, the array object being the best for this imo.

    Thing is you have to set up the data by making an external editor, or randomly generate the data and save it to the array... an external file.

    As always the wiki is a good place to start.

  • [quote:dhbsve18]As always the wiki is a good place to start.

    actualy it is the worst place for like anything. its misleading, outdated, full of holes or just writen in a language of aliens.

    advice for the future:

    first i use wiki, then i use search on forums, then i ask for help.

    as you can see i am at the 3rd base, so please assume i left first two already behind me.

    all of the newbies here with me on top - we need tutorials or tutors, not description of the wheel.

    sorry if i sound rude. i am just damn frustarted how handicapped the information flow is around Construct. propably the worst wiki i ever seen, messy forums where information are scatared all around like sand on desert, and a couple of people who actualy knows how this thing works.

    no wonder theres actualy just a hand full of games made with construct. visit any forum of that crappy, old, outdated, limited and buggy RPG Maker - you will be suprised that so many topics and posts can actualy be writen without melting the servers.

    okey rants off and back on topic:

    so how can i actualy save\load information in a external file and how to keep the players away from messing around with that file. and what do you mean by external editor? sorry but i just dont understand.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I agree the dissemination can be frustrating, but that's the nature of open source. It's controlled chaos at best, but once you get the big picture.... its a lovely thing.

    Speaking of the big picture, I'll describe the array object in terms you might be familiar with.

    Think of the object as a blank image, you have so many pixels in width(x), and so many pixels in height(y), and a specific color for each(z).

    If you acquaint your map to a picture you could say you wanted to "paint" a star that was only as big as a pixel at this point in the image.

    In terms of the array you could say that point was at 200 pixels across(x), then 150 pixels down(y), and since there wasn't any thing there before you could say instead of zero pixels you now have 1(z)or:

    array(200,150,1) instead of array(200,150,0).

    Now if you were to do a "for each" in the array, you can have it check to see if there is a 1 or a zero at the z position, and if its a one, create a star.

    Of course you wouldn't want everything to be one pixel, but lets say your star is 10 pixels big and your layout is 640 wide, and 480 pixels high, you could divide that by 10, or make your array 64x48, and then when you place the star multiply its position by 10, or array(20,15,1)*10.

    So looking at this in Construct:

    On mouse left clicked(or start of layout, etc... you don't want it to run every tick)

    ->for each in array(runs every x,y, and z)

    -->array compare value at current x, current y, (and or)current z = 1

    --->system create object star at array current x, current y * 10


    You don't have to actually have to use the z in this circumstance, you can just say the value at x, and y.

    Continuing on:

    [quote:3835ijs5]so how can i actualy save\load information in a external file and how to keep the players away from messing around with that file. and what do you mean by external editor? sorry but i just dont understand.

    Now that you know how to read what's in the array, a simple way to load the array is just to create random data, or random().

    Since we are dealing with either a 1 or 0 we could look at the possibility as a percentage, or if random(10) = n make the zero a 1.

    Start of layout

    ->for each in array

    -->System compare random(10) =1

    --->array set value at currentx, currenty to 1

    Now that the array is set you can save it as an external file IE array Save to file myarray.array, or what ever extension you like.

    I'll let you figure that one out.... &appath is your friend.

    Same goes for load... works the same way, in reverse.

    As to the external editor, basically what your doing is making an app in Construct that uses mouse coordinates to set the x,and y, and a click to set 1 or 0, and then saving the array. There's several examples in the forum.

    And finally, there's really not much you can do to keep people from changing the array, but you have to ask yourself "Are you at the point where that could ever be a problem?".

  • Ahh... You know whats worst Newt?

    i know how to code all this... but with variables. for some reason i just cant, i dont know, "catch", "grab" the big picture when it comes to arrays.

    i know its a 3d rows that store date. but i just cant use them. I dont know what the hell is wrong with my brain. Ive checked the caps which had something to do with arrays, ive checked the wiki, ive propably digged up every possible topic arrays-related on this forums. and everything is fine when i look at it. but when it comes down to me actualy using it - my mind goes blank.

    You cant imagine how frustrating it is. it makes be literaly furious.

    i sweer if Construct would have a folders options for variables or some kind of variables explorer (like Excel sheets) i think i would use just them.

    But i heard doing all this with variables will also have an impact on the performence (we are talking dozens of variables here)

  • Well it might help to forget the z element all together, as each x, and each y can have a value, so can each x, and y combined.

    Another thing you could do is use a nested loop.

    ->on start of layout

    -->loop "x" = 0 to 64

    --->loop "y" = 0 to 48

    ---->array compare value at loopindex(x), loopindex(y) =1

    ----->do stuff at loopindex(x), loopindex(y) * 10

    That's essentially what the for each in array does.

    Note, the array object is 1 based, in other words it does not start at zero, so a loop may actually be easier to use instead of current array -1.

    Then you have to add 1 to loopindex to compensate.

    But I wouldn't worry about that till you get the gist of it.

    Just remember that x, and y are coordinates that can have a value, besides it position.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)