farflamex's Forum Posts

  • That's true, performance doesn't matter in a management game (well not much unless it's realllllly bad). I'll look into all the approaches but somehow I always feel like something isn't right and end up starting from scratch. With Construct, I always felt like it was a struggle doing complex calculations with large numbers of objects / array so I thought JS would solve that. It still might be the way forward, I'll try both approaches and see what works best.

    If I can copy large arrays back and forth, that might help. But thinking about it, I should be ok just grabbing one rating at a time anyway.

  • dop2000, yep, that's exactly how I was doing things at first. As you say, it's actually very clean and easy to work with that way. I didn't even need a sprite, I had an array as each player and then the array can itself have attached variables for easy reading (salary etc) and the array can be used for any junk numbers. I suspect that arrays might perform a bit better.

    Another real advantage is that it's super easy to find, for example, all the players in one team just by picking against the 'Team' variable.

    My worry was that I really need a league with 64 teams and ~50 players per team, so that's 3200 objects. C3 doesn't really seem to mind that but I'm worried that down the line it might get a bit heavy.

    But now I think about it, I can't really remember why I decided against this approach. I had a few screens half working but abandoned it (in C2) because it wasn't looking very good. Then recently I saw this JS thing and realised that I really like this idea. I think I just like raw coding when it comes to complex arrays and loads of calculations. But now you mention it, maybe I should give it another crack this way in C3 and see how it handles it. Maybe 3200 objects won't bother C3 at all.

    Diego, thanks, I'll take a look through that and see how it works out. Either way, I like experimenting and seeing how things work. I might try to go raw C3 or I might go mostly JS, need to play around and see what works out best.

    Thanks guys.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm re-writing a complex game (Soccer management). I love C3 for what it does, I set up a little turret game in about 3 minutes before I even knew how the turret behaviour worked. That woulda taken my a month in Unity (mainly because I'm useless at Unity and I can't get anything to work).

    But then I'm also very old-school and started programming in the 80's. I love Javascript. So for my large/complex game, my plan was to write it almost entirely in Javascript but just use C3 for what C3 is really good at, i.e everything on the screen. So C3 = screen, JS = guts.

    Since the JS would have lots of information that it needs to pass to C3 to display, I need to know if I can pass large amounts at once. If there's no built in way, perhaps I'd convert it to JSON or a string and then have a C3 function to reconstruct it in C3?

    I realise that C3 doesn't sound like the ideal engine for a screen packed with numbers and text but it works really well for the graphical elements. Plus I just prefer it in general to Unity or Godot and it'll deploy directly to a webpage.

    And another addition, I've done a fair amount already using C3 arrays but I really don't like the way they work. If the stuff gets too complex, it starts to feel like I'm wrestling with C3 rather than coding.

  • Is there a simple way, or what is the best way, to pass array information between C3 and a JS script? If it's a full array or lots of data, will I need to pack / unpack it, with JSON or something?

  • Re : Arrays. Is there a way to pass entire arrays back and forth or do I need to find a way, e.g a JSON string or something?

  • Yeah I am, I watched that, tried it and it wasn't working. But it's all good now, thanks :)

  • I was following your original tutorial when you first announced Javascript... way back when. I don't think it's an official tutorial so much as you were just showing the basics of how JS had been added.

    Anyhoo thanks, the solutions worked, I can get cracking :)

  • I've only just noticed that C3 has added JS and that might reallllllly solve my problems, because I had some very complex array stuff to do and I really don't like C3 arrays. So I might be able to do my calculations in JS and then pass the results into C3... huzzah.

    However, even the basic 'Alert' tutorial doesn't work at all. I can't find any solutions and I wonder if I'm missing something very obvious. Basically, I put up a button and have that call a simple alert, as in the most basic JS tutorial that Ashley did. I don't get the alert dialog at all.

    I'm using Chrome and I'm on the latest version of Chrome and C3.

    Tagged:

  • Thanks, got it now.

  • I think in C2 you did something like 'variable = Function.call(myfunction(params etc)) but I can't work it out in C3. There's no 'function' comes up in the auto-fill. I know how to set the return value, just not how to retrieve it.

  • Thanks. Ok, I think I see where I was getting confused. I didn't realise that 'Push' with a value of, say 1, filled the entire row with 1's. That's fine I guess, I can push 0's and then fill it manually.

  • I seem to have developed some kind of array dyslexia. I've worked with arrays plenty in the past but for some reason it's not working as I'm expecting in C3.

    Let's say that I have a 2D array and I want to add a new row to it, let's say it's just 2 elements 'wide'

    Do I push twice onto X, onto Y, or insert?

    Everything I try, I seem to get very strange results. I have a loop where I'm trying to add a bunch of new rows, but it all seems to get tagged endlessly onto one row, or the next row seems to inherit the previous row etc.

    Basically, say I'm trying to add a new row, say .at(row,0) and .at(row,1), how do I push/insert them?

  • What would be the best method of resizing lots of UI elements? Would you do it by simply experiementing or setting them to a % of the resized window? Or maybe have the window size fixed (this seems easiest) and just have it auto-scale? Or is there any kind of add-on that helps with UI elements?

    I'm looking at rebuilding my management game in C3. I've never got very far because it doesn't really seem suited to this kind of game but I'm sure it's perfectly capable of it if I can get past the UI / screen sizing issue.

  • Oh cool, nice.

    I was just creating a new array with each instance and then having a variable for the array that matches the instance UID. Not sure if that's easier, it works at least. I'll try out your method, see which works better.

  • And there's no way to have an array attached to a family though? That would be even more useful.