Fengist's Forum Posts

  • C3 doesn't doesn't have direct access to database resources, like MySQL, that you're going to need to manage large amounts of data like account creation, user names, passwords, forgotten passwords, sending verification emails, EULA changes, etc. Your C3 project is going to have to communicate with a server somewhere.

    Perhaps the easiest way is with Ajax and sending requests to a web server. But this is going to require programming in another language like PHP, Ruby, Perl, etc. The advantages of these are they're relatively easy to work with. The disadvantage is, they're a send/wait to receive system. Your C3 project will have to send a request and then, look for a response. The server side scripts will only run when C3 sends the Ajax request. The server won't be able to just send data to the C3 project out of the blue.

    The other viable way is via WebSockets. The advantage of this method is that it's a two-way communication street. Think of it like a chat server. The C3 project can send information any time it wants and it can receive information any time the server sends it. The advantage of this system is that you can have a steady flow of communication back and forth and a WebSockets server can communicate with databases like MySQL. The disadvantage of this method is that it's going to be a lot more difficult to create as you're going to need to create actual server software in a higher language like C# or Python. It's going to be harder to make secure and that server software is going to need to be running on a machine somewhere 24/7. If that server crashes, your game goes down.

    I seriously doubt that the multiplayer plugin can even come close to handling this as it uses a very specific signaling server that's not designed to really accept data outside of what it expects. You could do what I read as one suggestion and have a specific client start up first and act as the server. But even then, since C3 has no way to communicate with a real database you'd be limited to local storage which I'd consider quite volatile. MySQL can sift through millions of rows of data in a fraction of second. C3 has nothing built-in that even comes close.

    Writing a tutorial for this would be possible but it would be out of the scope of C3 as it would mostly involve writing code in another language, setting up databases and making MySQL queries.

  • And I just tested. The only way to get it to stop asking to upgrade is:

    Run the app from the desktop, when it asks to upgrade, decline.

    Click the 3 vertical dots at the top right, uninstall C3.

    Open the browser, go to editor.construct.net.

    Again, it prompts to do an update. Select yes.

    Then, from the C3 menu, install the app.

    If I run the app from the desktop and choose yes when it asks to upgrade, it never gives me the option to upgrade or install the app. I have to uninstall it first.

    It's really no big deal to just keep clicking on the 'upgrade' button. It was just confusing as I expected an upgrade and not a redirect.

  • Fengist - that sounds like the same case as discussed here. Presumably you're visiting editor.construct.net?

    It would be useful to remember: beta releases are never served from editor.construct.net - that only serves the latest stable release (which is what the typical user will want). If you want to be using a beta release you must have the release number in the URL, e.g. editor.construct.net/r146.

    Actually, I'm using the installed app. I just click and open the desktop icon. The confusion arises when it realizes I'm not using the latest beta and asks me if I want to "upgrade". When I select yes, It doesn't actually upgrade the desktop app, It appears that it closes the app, launches the browser and takes me to the latest beta URL. Because it doesn't upgrade, the next time that I launch from the desktop app, it's still not updated and asks me again.

    It would seem that as long as I'm running the beta and using the desktop app, I have 2 choices. Uninstall and reinstall when a new beta comes out or just keep clicking the "upgrade" button.

  • My situation was similar. Relying heavily on functions and just getting started in development I switched to the beta branch in an effort to not have to rewrite functions later. What I expected was that when a new version came out and it asked to update, that it would update the app and keep it. Instead the app seems to be keeping the version installed when I initially switched to beta so that now, every time I start the app, it asks to update.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there a better way to print pages using construct 3 that I'm not aware of?

    I'm going to assume that you'll need to print different cards at different times for different players and that you're going to want these cards in a high resolution. Here's my initial thoughts on how I'd tackle this:

    1. Have a MYSQL database that contains all of the information needed for each possible card including images.

    2. Have C3 do an ajax call to a php script that selects the cards from the database depending on what the POST parameters from the AJAX call is.

    3. Have the php script use one of the pdf libraries available to build a pdf file containing the cards in the proper layout.

    4. Once the php script builds the pdf file, have it reply to the AJAX call with the location of that pdf file and then, C3 provides an external link to it. Once it's displayed in a browser, the end user can decide what to do with it.

    Two minor details. I've only worked with one pdf library and while it does work and the print quality is what you'd expect from a pdf, it's essentially it's own programming language. Getting that set up would be a chore. And, getting rid of the pdf file after a period of time would require some forethought. Of course, you could e-mail it to the player with php and delete it immediately.

  • Yea, it's confusing me. I'm running the beta so I don't have to screw with functions when that goes live. When I run the app from the desktop it keeps asking to update and I keep telling it to update. It apparently doesn't. So, I did something stupid. I told it to install the new version as an an app at which point I had 2 desktop icons. I then ran the old version and told it to uninstall.

    It uninstalled both.

    So now, if I go back to editor.construct.net it's telling me I have r142.2 installed and it wants to upgrade to 145. If I do the upgrade, I can't install as an app. But, if I run the r142.2, I can install as an app.

    So, I reinstalled r142.2 as an app and now, it's back to asking me to update every time I run it.

    *boggle*

  • If you've upgraded to C3:

    construct.net/en/make-games/addons/190/html-element

    That'll allow you to create a box with HTML and CSS instead of bb code and you can add coding into the HTML to call C3 functions based on events like clicks or mouse overs.

  • Nevermind, my stupidity. Six hours of tearing a plugin apart and I find a line in the c3 code I didn't remember adding that adjusted it's width again. Duh.

  • I hope you're subscribed to this thread. I posted a new issue on GitHub.

  • Ok, I'm using this plugin:

    construct.net/en/make-games/addons/190/html-element

    Here's the problem. When the browser is resized, the plugin resizes as well. I need this size to remain static. I've left an issue report with the creator but no response yet. I've attempted to fix this myself but the problem is, I'm a PHP programmer, not a JS programmer and I'm not sure what I'm looking at.

    I think I've narrowed the problem down to one function in the plugin code but can't come up with a solution. Here's the code:

    DrawSize() {
    
    
     if (!this.domStructure.useC3size) return;
    
    
     // conservo la dimensione precedente
     // se è uguale non devo fare nulla
     const exWidth = Dom.width(this.el);
     const exHeight = Dom.height(this.el);
    
     // mi prendo i riferimenti per calcolare le dimensioni
     const wi = this._inst.GetWorldInfo();
     const layer = wi.GetLayer();
     const quad = wi.GetBoundingQuad();
     // prendo l'angolo in alto a sinistra e poi le coordinate in alto a dx e in basso a sx
     const tlx = quad.getTlx();
     const tly = quad.getTly();
     const trx = quad.getTrx();
     const bly = quad.getBly();
    
     // calcolo le nuove dimensioni
    
     const myinstance = this._inst.GetWorldInfo();
     const instWidth = myinstance.GetWidth();
     const instHeight = myinstance.GetHeight();
     const newWidth = Math.abs(layer.LayerToDrawSurface(instWidth,0)[0]);
     const newHeight = Math.abs(layer.LayerToDrawSurface(0, instHeight)[1]);
    
     // se le nuove dimensioni sono diverse da quelle precedenti
     // allora aggiorno la dimensione dell'elemento
     if (exWidth !== newWidth || exHeight !== newHeight || this.memory.resizeWindowForSize) {
     this.memory.resizeWindowForSize = false;
     this.SetStyle({
     'width': newWidth + 'px',
     'height': newHeight + 'px'
     });
     }
     },
    

    If I drop this plugin on a form and do a simple browser.onResized and set the size of the HTML Element box to random(100,500), random(100,500) the height will randomize. The width does not. It adjusts based only on the browser size.

    Any help would be appreciated.

  • Your solution is pretty much how I'm handling it. Ajax requests are sent to various PHP files on a web server. The PHP files then make requests from a MYSQL database and echo the results which C3 picks up as the Ajax results.

    The problem with this method: It's not fast. Depending on the server load (shared hosting), or how much processing the PHP file has to do or ping times, it could be seconds before you get results back.

    Make sure that, if you need to, lock any controls to prevent repeatedly sending the Ajax request multiple times until the request gets and answer or it errors out.

  • Construct could not parse string literals in the way you expected, because it would make it impossible to set some strings. For example if it parsed the string as an expression, you couldn't set a string to the word "newline", because it would interpret it as an expression and insert a newline character; you couldn't set a string to "1+1" because it would evaluate it and set it to 2; and so on...

    Right, I understand the reasoning behind the parsing or lack thereof, it was just a bit unexpected. The logic I was working under was, if I set the string manually and it behaves a certain way, then when I set it dynamically, it should behave the same. I was expecting that anything within double quotes wouldn't be parsed and anything outside would.

    Now that I know the convention, it'll be easy enough to work with.

    Thanks.

  • Well, thanks for the confirmation guys. With the strange C3 conventions on adding strings and newlines together I expected it to parse the &newline& but yea, this works and I have no problem typing \r\n to make it work.

  • Ok, I've tried multiple methods to do this and so far, no success.

    If I manually set the contents of a text.text to "This" & newline & "That" It properly displays: This on one line and That on a second line.

    If I try to set the text.text from a JSON.Get("MyKey") to "This" & newline & "That" I get: "This" & newline & "That"

    I have tried various combinations of removing quotes, adding quotes, etc. Whatever I do, it doesn't seem to be parsing the text field properly and adding in the newline.

    *edit*

    Ok, this was not what I expected as the answer but it works:

    I was creating a JSON in PHP and sending it back to C3 with an Ajax request and having C3 fill in the text field with the JSON value. I stupidly assumed that if I sent the text as C3 expected to find it that it would parse it and add in the newlines. It appears it does not. This solution seems to bypass the need for Construct to parse the line and properly adds in newlines.

    $jsonObject->Error = '"This" & newline & "That"'; // does not work

    $jsonObject->Error = "This\r\nThat"; //does work

  • We can do all necessary ui elements already via events, they're just super annoying to put together.

    I don't think we should be trying to get Scirra to implement their own versions of gui parts however. The existing forms serve as an example of why. They get the basic job done, but are terrible to customise.

    Its likely the same will happen to any other elements made by someone else. Those types of things will never be a perfect fit for everything.

    I think ideally we need to have some sort of push to get a bunch of different plugs made by a bunch of different third party developers to fill that need.

    Construct has been around for years. And while I did see one plugin attempt to make scrollboxes, it was pretty limited. Most IDE's give at least a basic scrollbox that can be customized by the dev. Construct has nothing like that and you can't wait for the community to give away for free what should be a basic control. As I stated in a previous post, I no longer do free work that benefits some other company's bottom line. It's unfortunate, but I like to eat too.

    But this is getting way off topic and needs it's own discussion. The point is, C3 has the potential for an indy dev to make a living. The biggest hurdle is that any solo dev is going to have to learn how to switch hats between a mortarboard, a beret, a bowler, a baseball cap and a host of others, in order to be successful regardless of the engine used.

    *edit

    Oh and regarding customization of basic controls. It's a lot easier with this plugin:

    CSS Inject: construct.net/en/make-games/addons/166/inject-css