CJD's Recent Forum Activity

  • Unfortunately, I'm not done yet with spawning,

    As with any game this complex, just adding a new complex feature without something breaking is always likely.

    My crew's movement system runs on a step-timer, so that they can snap position to each hull piece and not vacuum/void themselves by leaving the ship.

    Note: My ship doesn't have wall collisions, instead, I make the game check if something *can* leave. I do this with everything, including projectiles, they basically bounce off of nothing and stay within the ship's hull (with tolerance, its not perfect but it works).

    Now you might be wondering why this relates to ship loading, well, when I spawn my ship, they don't have anywhere to snap to,

    I know theres some kind of way to get around this, like temporarily deleting my crew ( saving them on a array ) and loading them back in within the hull.

    Currently I have them teleport to the cockpit which isn't super reliable, because you can remove the cockpit and move it around, I don't wanna remove any of these capabilities as it makes ship creation more versatile.

    I'll try to figure it out myself but Ill probably be back here asking for help on a solution to my loader to fix this.

  • Thanks for the in-depth, all of you had been a massive help.

    I would send each of you a free copy of the final project but steam SDK for C2 is genuinely impossible to set up even with documentation and scouring the specific files needed with a time machine-website.

    Doing it any other way, like with a repository like github, wouldn't be super attractive to download from, that plus they have a file size limit.

    Anyway, back on the subject I have set up the entirety of spawning ships in since last night, ending it on part count logic, I quickly figured out you can get the size of the loaded file before spawning the ship from the paste-bin array,

    comparing its width (X) and checking to see if the file is too large to insert into the layout.

    Additionally, I have a part count limit which checks during a spawn attempt for redundancy.

    It is still alittle finicky, like the entirety of this game.

    Oh, and I was trying to figure out how to make sure you aren't spawning in parts you don't have/own, used my list which counts down each spawn, then checks if you still have any more of it, I first used this to spawn in parts one by one.

    Only difference is I'm using it in conjunction with my spawning system to spawn multiples, with the correct location and Z order.

    Here is the full script, anything hidden is just object listing, anyone copying this will have to include their own objects within those lists.

    Variables with the number "2" with them I.E "PartCount2" are duplicated variables from the main project file, these will be deleted and replaced with the originals.

    Hmm, what else, Trying to be thorough here, any suggestions?

  • It worked, but I'm again confused, those values were stored on the Y axis, okay,

    I think I might know where my confusion is coming from,

    so, it looks like I'm asking for the X axis instance, but that's only to reference it.

    I'm not specifying where to look on the Y axis with CurX, I'm specifying the instance I'm looking into, then moving up the index, I get the X, Y, and Zindex of that instance.

    In my opinion this is so counter intuitive that even though from here on out I can absolutely apply it confidently,

    If I were to program an array function with search functionality for a game engine, Id have Cur# be a listing expression,

    so if I were to do the same thing I did above,

    Id go, Has Value = "armor" ( this is so that I've already specified which instance on the X axis I'm requesting, I shouldn't have to do it again??? This would do the same thing as CurX in this situation but I wouldn't have to type it out again ) Instance.At()

    And then inside the "()" I'd use CurY to look into the Y axis to retrieve my values.

    I know for a fact I'm not the only one who finds this confusing, I've seen programmers hop on here and say its convoluted, even if they eventually figure it out with the help of this community.

    Alright, I think I can continue from here and exit the prototyping stage, I'm sure some of you noticed the script was pretty small, that's only because it's in its own testing area for safe keeping.

    Time to scale it up and see if it truly works.

    I'll let everyone know if I have issues, but assuming things go smoothly, Ill post the entire save and loading system step by step so that anyone from C2 or C3 can replicate and modify.

  • Almost perfect! I am trying to work on the rest of the functionality so that you three aren't doing all of my homework, the saver is done, and half of the loader is done,

    However I have run into an issue, It doesn't seem to be treating the armor pieces as separate instances, sending them to the same spot.

    Now its entirely likely that I accidentally put them that way in the save file, but I'm quite sure I didn't.

    Good news though, it read all of the data of the armor piece, spawned it and placed it in the correct location...

    But uh, that's the correct location for one of the multiples of the same instance.

    Perhaps I did something wrong?

    Heres the loader portion of script:

  • Documentation states it only works in a loop, I accidentally posted a picture which was before I figured that out.

    Here is it working now, I have the correct *count* of instances being created, now that I can read it,

    Currently I have it set to " CurY " which is obviously gonna give me the current value being read, being 0-based, it is only reading the first value of the Y axis.

    how do I specify which index on the Y axis to read? ( In an expression, to make sure everyone is looking in the right spot, look where I'm spawning the armor piece, this is where I set my filler "CurY" values, which I wish to change to a proper index search )

  • Shrug, I have no clue and I'm not gonna pretend I do.

    How do you illiterate and do an action for each instance on the X axis?

    This was my attempt, to be crystal clear, this is a downscaled loader, I hooked it up to clicking for testing purposes, I have the save file for simplicity.

    Now that its loaded onto my paste-bin array, how do I read it?

    I tried looping and comparing it with " Compare Current Value " on the X axis,

    but uh, its doing ??? idk nothing I guess.

    Doesn't seem to do anything anyway,

    Its description explicitly states it compares a value with a value through a for each loop.

    Doesn't seem to do that at all in practice, perhaps it doesn't know where to look?

    Edit: I got it working lol

  • Awesome.

    Yeah, it works perfectly.

    I went ahead and made a paste-bin style loader, using the Ajax method.

    There are two arrays, one which stores data and can be cleared for new save data, lets call it " ShipArray ", this is the ship's current layout, technically.

    The next is called " ShipPaste ", this is the paste bin which I'm reading from.

    I got this working here, now, how would I read the data on this sheet for each entry on it and create objects?

    ( Im not sure if this gif is gonna work, I hope it does )

    Edit: It did not, hold on let me just send the link by itself

    i.gyazo.com/38ca21f14db7d602bce5879a93aee365.gif

  • Not scalable, I had a feeling this would be mentioned but learning to save stuff by array gives me more avenues.

    Also, it consumes alot of memory from my tests, I had to run javascript code to clear memory for my game's save file system which is incredibly dangerous.

    So technically I already use this but not for this purpose.

    I'm doing a precision save on a group of objects which allows me to do a whole slew of things,

    like making a ship purchase system where instead of buying parts separately, buy a whole ship.

    I could use arrays to save enemy ship designs, making encounters possible.

    I could even repurpose it to make planetary generation with presets, or maybe use it for character customization, hotbars for items or even inventories.

    Anyway, before this comes to a close, ( assuming I don't find any issues ) here is my save system partially set up in action:

    Thank you both of you for your help, I learned abit today.

  • Lmk if this looks right, it looks right to me and it seems to be adding a new entry, so now If I wanted to add the instance name ( which in this case since C2 doesn't have instance naming ) Ill just make a variable which does that for me.

    so itll be, X, Y, ZIndex, InstanceName(A Variable containing the instance's name, because construct runs on reference, if I define what that instance is in the loop, I can set the value to the variable stored in the instance.)

    When I start loading, I check the array, I look across its indexes for the name through a comparison, if object = object then spawn object, then I set the position of object with its other info.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wait never mind I think I got it to work, I had to tinker around with it but it seems you set its size to zero,

    but pushing back on the X axis with Armor.X adds a new entry, in my opinion is super weird.

    Yeah it works and I sort of understand whats going on but it isn't very intuitive.

  • Array set at ( XY )? I don't know which type of setting your using.

    the next part containing the width, not sure what this is for? Is this to get the next column down? If so, what's the point of having a push back at the start?

    both the X and Y data of the object must be stored on the Y axis, which we seem to be on the same page on, but I don't quite understand the steps shown in your example.

    So I'm pushing back everything on the X column ( I assume that's what this means ), so that I can add a new entry, then I'm setting on a new entry my X, Y and ZIndex information on the Y axis?

    Perhaps some more clarification is best.

    Edit: I just realized this isn't going to work anyway, your suggesting I keep the size set outside of the loop, but when I do this in practice, it never adds a new column since I'm using the size set to ADD a new entry.

    I assume somewhere in this there is a different way of doing it?

    To be clear, I can't set the exact size of my array, this is a ship customization system where a player can always add more parts to a ship, so I won't know how many parts are going to be listed unless I add onto the size each time they create a new part.

  • okay, so,

    This is technically a C2 question, but the response time for C2 is incredibly slow.

    And no, I'm not updating to C3 and this question is still valid in C3,

    With that out of the way,

    I have an array, this array will be used to store positional data ( X, Y, Zindex ) and the instance type as a string.

    I haven't gotten to the string part, as it's a last step.

    The point of the array is to save this data to a Json file, which I would then use; how is irrelevant.

    I'm using this for a ship construction system where parts of a ship can be moved around and built, so obviously it would be nice to have a way to save your ship.

    I picked this method as I can expand its functionality to whatever I want, character customization, ship customization, planets, whatever.

    My issue:

    I'm trying to save multiple object's positions to an array, unfortunately, every time I do, it saves it to only one row on the X axis, each row is supposed to be its own instance, the rest of its information is on the Y axis.

    Heres the script:

    Heres the result:

    Heres how it should look like:

    The last image ( how it should look like ), obviously has made up numbers, but it shows how I want it to look, By the way, I only roughly understand how to use arrays, I've been using tutorials, documentation,

    and this is as far as I got; which is pretty far because it almost works.

    So, how would I add information for each new entry?

    I've tried " For each Element " couldn't get it to work as intended but thats likely because I misunderstood how its used.

    To make this clear, I just want to know how to fix this issue, so try to stay on subject, I am well aware there are multiple methods to do this, and that there are also multiple ways I can carry this out from here, but to make sure your point is understood some help on this would be appriciated.

    If you have to correct my use case, thats fine too; the goal is to learn.

CJD's avatar

CJD

Member since 22 Jul, 2018

Twitter
CJD has 1 followers

Trophy Case

  • 6-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

8/44
How to earn trophies