pirx's Forum Posts

  • So expressions like rgb() and ColorValue return an integer number that can then be used to color something via an action.

    That is useful for me as my game has a parser that uses pure text to generate various items on screen. The source text contains colors in hex so I'd like to write a function that would convert these to the C3 format and then the other way around. But how is this number calculated from rgb values? The C3's color format does not seem compatible with any color-to-whatever calculator I found.

    Thanks!

  • dop2000

    Indeed in this use case it's hard not to see the utility of duplicating function names.

    I think the problem here comes down to scoping: there are no local functions in C3 whereas global ones cause problems mentioned by Ashley above. If you could make a function local to a layout this problem would be non-existent. Good that this was mentioned; I'd rather not discover this limitation in the middle of creating something important!

    Other than that I think the new function system is way more elegant and easier to work with for most purposes.

  • In general you will need backend mechanics. There are three routes to achieve this:

    1. Get a hosting server and write your own backend in php, mysql etc.

    2. Get a hosting server and a self-hosted backend system (such as Parse Server).

    2. Get a backend-as-a-service thing that handles all technicalities and lets you send/receive data using Construct's actions. Google Construct Firebase.

    Route 1 can easily amount to more work than the game itself, and it will be very hard to to make it secure, reliable, scalable etc. so you can skip it upfront. Route 2 will also require skill and then you will need to use third party plugins or JS. So the best option is to use route 3 to create an online database for storing users and then create a system of sign-up/sign-in within your game.

    Just a heads up: this is an undertaking that still can prove more cumbersome than coding the actual game.

  • The result of any color expression (rgba, rgba255, rgbex, rgbex255) is an integer number. So you can just store this number in a variable and re-use it when you need it.

    > Set c to rgba(100,20,20,100)
    Sprite set color to c
    

    Great thanks! Would you happen to know how is this number calculated? I.e. is it possible to convert it to some other format externally (hex?) or pre-calculate it from rgb values and use directly without reading ColorValue?

  • Hi,

    What would be the best approach to store color of a sprite (as in set by "set color") so that in can be later retrieved and set to another sprite?

    So far I found the ColorValue expression but I'm not sure how is it calculated? Can individual values of r, g and b be extracted from the long number it outputs?

    Thanks!

  • That is great! Would you care to explain why the "wait 0" is needed there?

  • Try Construct 3

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

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

    So in my game there's a little hero avatar picture appearing one screen multiple times at once.

    The avatar is composed of replaceable parts (hair, eyes, nose etc) -- the user creates it when first starting the game. It doesn't change ingame.

    I feel it would be way more memory efficient and generally better to have a static image for this avatar instead of spawning multiple (up to 200-300) copies consisting of ~10 elements pinned together.

    I was wondering what would be the best approach to just spawn the avatar once, then flatten it and use the image?

    Probably the way to do it would be to screenshot the avatar and create a sprite based on the image? I searched the forums and found that to screenshot part of the screen I'd need to resize the canvas back and forth which feels a bit clunky and I'm not sure if it's not noticeable for the user?

    Or maybe someone could suggest a better way?

    Thanks!

  • Ok identified the problem. It appears functions which return values can only be called inline while ones without returns can only be called via actions. That makes sense. So the function in question couldn't be called not only from within itself but also from anywhere else in the project.

    However, it's still a bit confusing. The function had an in-line reference to it somewhere in the project but I deleted the set return value action from it. Therefore there was no immediate indication that this was still a returning function; and on top of that even upon editing it I couldn't set return to none (choice grayed out). Once the inline reference was deleted I could change to none and the function became available for calling in actions.

    Ashley I suggest adding some kind of an indication to distinguish between returning and non returning functions or a persistent warning if a function is called inline but there's no set return action in it.

  • Hmm so it appears this should be possible. Weird. Maybe I'm missing something obvious?

    As for the purpose, this is for a simple text parser that analyzes text line number X then calls itself on next/another line. Rinse and repeat until end of file. Can't just straight up repeat/loop because the parser is non-linear (jumps to a specific line upon encountering a trigger). Well technically I could do that with some logistics but why do that when there's recursion...

    doing something like this is also a bad idea unless you cache the value for recursive function (dynamic programming) this gets really expensive on the bigger the number, you can run out of stack memory very quick

    I think my use case is actually a pretty textbook example of where recursion is legit. But I might be wrong.

  • Can't find it in the documentation. Basically I just want a function to call itself, but when adding the call action inside it only other functions appear.

  • Impressive. It never ceases to amaze me how a group of talented people can build something as complex as say Witcher 3 or this demo. Every stone or architectural detail needs to be created and polished... unbelievable.

    I'm wondering how much further this can go. At some point, I imagine, the amount of work that would need to be done to come up with a full scale game of that quality will outweigh the potential payoff, even if it's the most purchased game in the world. But keeping fingers crossed for games to look like this.

    That said, I somehow feel when it comes to actual games on PS5 we'll be in for a bit of a "expectactions vs reality" reality check. ;)

  • Guys I translated quite a lot of expressions a few years back, now going to pick up and hopefully bring the Polish translation to a successful finish. We are 80% there, but even when complete the sheet will require some work to go over and ensure consistency and correctness.

    This is just to let anyone interested know that contributions are still welcome!

  • Yesss the animation thing has been a minor annoyance since forever

  • My biggest one yet is a pseudo-3D dungeon generator; it runs at 4K resolution using textures reaching up to 3000x3000px along with a dynamic shadow system I concocted; all of this without so much as a dropped frame.

    Using construct2 I couldn't even dream of reaching this, C3 is an absolute powerhouse in comparison.

    Wow! A few years back I made a simple but fast moving space flying game in C2. Completely flat 2D and around 20-30 objects on screen at any given time. It tended to stutter. No doubt both Construct's engine and generally hardware have come a long way...

  • Welcome on board!

    As I understand you are asking about whether it's possible to create a platformer with large complex levels and a parallax background? Yes, that is absolutely possible and you will find lots and lots of features and tools in Construct that make this sort of thing easier.

    Depending on the actual complexity of your game, the amount of objects on screen etc etc you may hit upon performance issues - i.e. choppy framerate - kind of sooner than you would in lower-level/native/traditional programming tools (and by kind of sooner I mean a lot sooner) but frankly the ease of use of Construct outweighs it for most purposes. You then just go and optimize stuff or find more efficient solutions which you might want to frame to yourself as part of the fun;)