jobel's Recent Forum Activity

  • is the id just +1 from the array index at all times?

    no the id is a unique number.. it can be anything. but in my "master table" it is sequential, my array is just a subset of this table. The player can have many pieces of equipment from this master table (only 8 of them are guns). So dealing just with the guns, I'm putting what the player has into an array, so when the player switches guns it's easier to code.

    In testing I'm "loading the deck" so the player starts with a bunch of guns, so I can test swapping. But looking at arrays in C2 is painful and not readable without Action level comments or // comments you can put to the side.

    Start of layout

    function call "initGun" (1, 10, 400, 1)

    function call "initGun" (2, 5, 400, 1)

    function call "initGun" (3, 40, 300, 3)

    function call "initGun" (4, 100, 200, 10)

    On function "initGun"

    GunArray Set value at (function.param(0)-1, GUN_ID) to function.param(0)

    GunArray Set value at (function.param(0)-1, DAMAGE) to function.param(1)

    GunArray Set value at (function.param(0)-1, SPEED) to function.param(2)

    GunArray Set value at (function.param(0)-1, FIRE_RATE) to function.param(3)

    here the function call gives me problems because a month later looking at those values 2,10,400,1 I have no idea what they mean! I could guess, but never be 100% sure.

    And you can also make a comment by adding another parameter that you don't use. ex:

    Start of layout

    function call "initGun" (1, 10, 400, 1, "pistol")

    function call "initGun" (2, 5, 400, 1, "rifle")

    function call "initGun" (3, 40, 300, 3, "shotgun")

    function call "initGun" (4, 100, 200, 10, "pea shooter")

    This I like better but seems more work to code. And you still don't know what those fields are looking at this a year later. Although it depends if you have a lot of things to init... you could put it in a block or group and comment at the top... still a little cludgy.

  • BTW it's the rows not the columns

    well it works either way you look at it.. But I'm looking at the array like an excel spreadsheet. A "row" is a "record" in the "database". I look at columns as "fields". this is just my db background coming through...

  • Paradox and edwardr

    One of the problems is when initializing values to an array..because you can't comment inside the Action area. The code looks very confusing, you forget what is what. So I think I came up with a solution that works for me.

    if I had 4 columns of a "Gun" array: gunID, damage, speed, firerate

    and if I wanted to initialize my array with 4 guns, my code would look like this:

    GunArray Set value at (0,0) to 1

    GunArray Set value at (0,1) to 10

    GunArray Set value at (0,2) to 400

    GunArray Set value at (0,3) to 1

    GunArray Set value at (1,0) to 2

    GunArray Set value at (1,1) to 5

    GunArray Set value at (1,2) to 400

    GunArray Set value at (1,3) to 1

    GunArray Set value at (2,0) to 3

    GunArray Set value at (2,1) to 40

    GunArray Set value at (2,2) to 300

    GunArray Set value at (2,3) to 3

    GunArray Set value at (3,0) to 4

    GunArray Set value at (3,1) to 100

    GunArray Set value at (3,2) to 200

    GunArray Set value at (3,3) to 10

    ^^ this is bad to look at because it makes no sense unless you remember which columns are which.

    So I figured to make constant (read-only) variables.. like #defines in c/c++ and I make them all caps as well.

    Global constant number GUN_ID = 0

    Global constant number DAMAGE = 1

    Global constant number SPEED = 2

    Global constant number FIRE_RATE = 3

    so it reads:

    GunArray Set value at (0,GUN_ID) to 1

    GunArray Set value at (0,DAMAGE) to 10

    GunArray Set value at (0,SPEED) to 400

    GunArray Set value at (0,FIRE_RATE) to 1

    GunArray Set value at (1,GUN_ID) to 2

    GunArray Set value at (1,DAMAGE) to 5

    GunArray Set value at (1,SPEED) to 400

    GunArray Set value at (1,FIRE_RATE) to 1

    GunArray Set value at (2,GUN_ID) to 3

    GunArray Set value at (2,DAMAGE) to 40

    GunArray Set value at (2,SPEED) to 300

    GunArray Set value at (2,FIRE_RATE) to 3

    GunArray Set value at (3,GUN_ID) to 4

    GunArray Set value at (3,DAMAGE) to 100

    GunArray Set value at (3,SPEED) to 200

    GunArray Set value at (3,FIRE_RATE) to 10

    ahhhhh I feel better..

  • the thumbstick has a range of values.. for example in my top down space game, the player's ship can spin left or right. So I take the value from the thumbstick to dictate how fast to spin:

    IF Gamepad(0) Left analog X axis < 0 (meaning the player is pushing the stick to the left (since 0 to -100 are the values to the left)

    THEN Rotate PlayerSprite (abs(Gamepad.Axis(0,0)) * ThrusterAmount) * dt DEGREES CounterClockwise

    So, I take the absolute value to invert the negative number... so now my rotation is varying on how far the player pushes the stick to the left.. they can be really delicate and spin really slow or jam the stick to the way left and spin at max speed...

  • The reason I went with Distance instead of Is on screen, is because I'd rather have the moving objects doing their thing before I see them to avoid awkward moments where you can see static object for a moment "turning itself" On.

    sure for movement stuff that makes sense... but other AI behavior that is less visible OnScreen works.

    I mean, it all depends on the game and what your objects are doing when not in the players viewport.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • >

    > >Enemy On collision with Rock

    > AND Enemy is OnScreen --- DO THIS

    >

    As far as I know, the engine works in a way that it checks collisions for every object every tick.

    The "Enemy On collision with Rock AND Enemy is OnScreen" event will only trigger when an enemy is collided with a rock and it happened on screen. The engine still checks for collisions for every object (not sure for the objects off-screen), but you can turn off this by setting the "Collisions" setting to "Disabled" in the object's properties.

    Yes exactly, shutting off collisions when not on the screen will definitely improve performance. There's a good tutorial on that. I just was trying to explain it in simple terms don't process objects that are not on the screen. Better to get the UID of the specific object you want or only deal with the ones the player can see. The question was "what is dealing with per-instance objects?".

  • Honestly, if you're not interested in consoles (<be really sure of this, all consoles), I don't see why you shouldn't pick C2 for your game. No engine is perfect, and this one is very good, very fast, very cheap and have a GUI designed by a brilliant mind. Wish you the best with your game!

    this pretty much sums it up...^^

  • Everade

    What exactly does per-instance work mean?

    An instance means 1 copy of an object.

    Say if you have a bunch of enemies (copies of 1 object you created) in your game called "Enemy" and there have been many created, some not even being visible in the "view" but they are there in the game. He's saying try not to continually reference those objects that the player can't even see.

    i.e. a collision event trigger

    Enemy On collision with Rock ---- DO THIS

    instead only do this code for when the player is seeing it. That way you avoid doing all this processing while no one is even seeing it.

    (Or you can make the object Collisions DISABLED, unless they are on the screen.)

    so instead:

    Enemy On collision with Rock

    AND Enemy is OnScreen --- DO THIS

  • in Bullet Behavior there is value called DistanceTravelled

    Reference it like this:

    System (compare two values) Sprite.Bullet.DistanceTravelled > 400 then do whatever

    and make sure to place a System -Trigger Once While True so you don't keep triggering the same code since once that statement is true it will execute once every tick (60 times per second!).

  • thanks edwardr

    never thought to use Event Sheets like that either... good idea!

  • best to star with small projects, but finishing them is not always necessary. I've done lots and lots of different test projects over the few years in C2 and learned much about streamlining things and how to make the project easier to control in the grand scale.

    yes I understand but that's not what I mean. When you actually finish a game -- completely finish and put those finishing touches on it. That's when a lot of stuff you never knew about comes out to play. When your core gameplay is complete and you get into the overarching gameplay, level design and "packaging" of your game, there's a whole new level of development that needs to happen.

    Like sqiddster was saying about performance issues when you put the whole polished game to the test on multiple machines (playtesting). And other things that come out like, "The Next Penelope" not being able to stream on Twitch and some other issues with captures because of HTML5 etc... or Save Game data, or Leaderboards or Greenworks etc... it's definitely not easy!

  • I'm working on a decently large game myself so I won't know that answer until I'm closer to finishing. But so far so good. In any game development project there are limitations. But I find those limitations help me be creative and I always manage to relay whatever I need to the player. Bottom line is you can make a great game with any tool. You just have to be somewhat familiar with what C2 can do well and try to keep with it's strengths.

    I wish I produced a bunch of small games (with finishing touches) before I tackled this larger project I am currently working on. Seeing a game all the way through definitely teaches you something special, and can really help.

    For example, those scenes in Valiant Hearts would take some serious setup time in C2. Not impossible, but tricky with all the timings. You're going to need to do a lot of "camera work" using tweening.. lerp or cosp. You might be able to come up with a good system on how to do it, but I'd try it first. Try to do like 15 seconds of one scene, and embed it in a one of the example games and you'll immediately see what your limitations and hurdles are...

jobel's avatar

jobel

Member since 27 Jul, 2013

Twitter
jobel has 8 followers

Connect with jobel

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x4
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

18/44
How to earn trophies