Fengist's Forum Posts

  • 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

  • With the future of Construct being very open now that 3's runtime has surpassed 2's, I'm personally optimistic for a shift from game engine to "experience engine" that truly embraces HTML5+.

    This is real blue sky optimism, but would open the engine up in ways suggested above.

    As an aside, Ashley and Tom recently hinted on a great game dev podcast that there was possibly a change coming to C3 this year that would reinvent how developers use the product.

    One of the problems with C3 is that Ashley and Tom have always focused on the 2D aspect of the engine. They assume that platformers and other retro style games is what C3 should do. While those games do sell on the market, C3 can and could do a lot more. For example, in C2 I wrote teleprompter software for Android devices. While it did work and work well, Google kinda screwed me over on placement and I never could get them to fix it, thus, it never sold. But, it was a concept to prove, at least to me, that Construct could build working apps and not just games.

    Point is, Construct can handle multiple genres of games including HTML5 browser games like Grepolis. The biggest problem to making those kinds of games in Construct is the woeful lack of controls. If for example, you wanted to create a scrolling list box of items, it becomes a nightmare to create and manage. In other IDE's like C# and Delphi, they're easy drag and drop items. Even Unity has a host of plugins developed to make a listbox an easy thing.

    With those form type elements, C3 could be a lot more than just be a game engine.

  • In game ads work only with Flash games, which is basically useless these days.

    Since web site ads are basically html, something could be worked out to add them to Construct games.

    You can do it right now if you use iFrame to display them, but there should be a better solution.

    And they do have separate mobile ads I think, you do not get access to those unless you sign up specifically for them.

    I don't know if this would work but there is a plugin HTML Element: construct.net/en/make-games/addons/190/html-element

    This plugin essentially allows chunks HTML5 to be incorporated into C3 with full JS and CSS without having to pull in a full page in an iframe. One of the cool features is, you can use JS onclick events to call CS functions and pass parameters. At present I have a working HTML 5 menu (even with mouse-over events) that easily switches C3 layouts.

    I'm guessing that with some PHP backend and Ajax calls that pretty much any HTML can be integrated with C3, including advertisements.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Kinda curious if anyone has had any luck with Patreon, or similar services.

    Seems like it might be better than Kickstarter, or Gofundme.

    Especially if supporters are giving feedback.

    I tried this and I have lost all faith in humans. Once upon a time, I modded for a game. Over the years, I spent hundreds and hundreds of hours writing code in C#, plugging all that into Unity, creating 3D models, texturing, making videos, etc. Over 100,000 downloads of just one mod which was always in the top 30 out of 2,100+ mods in popularity. Thousands of downloads of other mods for the same game. All of the forum posts for the mod were linked to a Patreon account and the forum thread for the big mod had well over 100,000 views.

    My donations? $1.00 in Patreon + around $50.00 in PayPal donations.

    I've stopped modding because I'm of the opinion now that if you can't or don't somehow twist people's arm into 'donating' they won't. They'll go out and chuck $5.00 into a really crappy cup of coffee. Donate a stinking $1 willingly? Well yes, there are some games that have succeeded at that. They're few and far between. I'm personally not going to be that stupid any more. If I invest my time and energy creating entertainment for someone else (especially when it benefits another game company's bottom line) I expect to be compensated with more than just someone clicking a stoopid like button on a forum.

    My next attempt will be most likely a freemium model.

    (Can you tell I'm a tad salty about the topic of people donating for entertainment?)

    <--- the like button is there. Feel free to click it on these forums as I'm not selling anything yet.

  • And there's one more comment that needs to be made when considering writing any software, game or otherwise, profitable or not, and this is from someone who has a somewhat successful shareware product on the market (written in Delphi).

    Creating any piece of software to do what you want is relatively easy.

    Creating a piece of software that's idiot proof is almost impossible.

    In working on my next creation I've spent weeks on just the login and registration process trying to consider all of the things people can possibly put in text boxes that would cause issues. Don't ever assume that the end user will use the software exactly as you expect, because they won't.

  • As I see it, making a living off creating any game using any engine (C3, Unreal, Unity, etc.) is entirely possible, even as a solo indy dev. I'm aware of one game that is pure HTML that the owner was claiming to make $750 a month off Google advertisements alone.

    Whether it's possible or not isn't the question. The proper question is HOW to make a living off any game.

    There are a number of approaches as to how to earn a living. Dwarf Forest went for years with two brothers making a living off of crowdfunding alone. It's now been accepted into Steam and will likely rocket beyond it's previous income.

    Placing your game on any host type service (Google Play, Steam, Epic, etc.) is probably a good idea but then, you get buried in the thousands of other games in those services. The two brothers from Dwarf Forest focused on one game for years and constantly added to and updated it before going for the Steam platform. Their approach was one product focused on one specific segment of the market.

    Other gaming companies go for the shotgun approach. Lots and lots of games that are quick and easy to develop with each one making a small income. Or, one game with lots of players making small incomes off of some of them. The CEO of World of Tanks once said he'd rather have a million players occasionally paying a few dollars rather than a hundred players paying every month. This strategy created a huge player-base that helped him advertise the game. The thing you have to worry about there is an old sales adage: A happy customer will tell a friend, an unhappy customer will tell 10 friends.

    In the world of gaming you either make loads of cheap, pink bubble gum and sell tons of it it for a few pennies each or, you make designer bubble gum in a pretty package and sell a lot less for a lot more.

    So, the first decision is, a focused approach to a limited market making money off all of them (subscriptions) or, a broad approach to a wide market and making a few bucks off of some of them (in game purchases).

    Regardless of how you make money, the key to any games success is multi-fold. Foremost, you need a game that entertains people. Most game dev's create a game for their own liking. What they forget is they aren't in the game-making business, they're in the entertainment business. You game needs to be entertaining. If it's not fun, people won't keep playing it.

    Nextly, it needs to be engaging. You don't want people completing the game in a few hours. They'll consider themselves to have won and will quickly look for another game to beat. The longer you entertain people, the better the odds of you earning an income.

    The BIGGEST key to any games success is marketing. And I don't just mean buying ads on Google. By that I mean getting the word out and in the proper channels. For example. Albion Online just went free to play. If you look at the Steam charts prior to f2p it had around 400-600 players. Two days after going f2p it had 10,000 players. Their marketing team blasted out press releases to all of the major game review sites prior to going f2p and many of them picked up on that story. As a result, Google News grabbed those stories and showed those news articles to people who are interested in gaming (like me). As a result, I saw it and I decided to go play (and subscribe for a month). There are gobs of ways to market your game for free. Journalists who write stories about gaming love it when their job is made easy by press releases. It means they don't have to go digging for a story.

    If you want your game to succeed you need to promote it. Mark Twain once said that the perfect place for a spider to build a web is in the doorway of a business that doesn't advertise. In today's flooded game market, that's even more true. It does no good to create a game if nobody knows that it exists.

    So, as I see it, those are a few of the things you have to consider when creating a game and making it profitable. It's more than just writing code. Construct is a great gaming engine with lots of possibilities and flexibility and the potential to make a living is definitely there. And the ability to create entertaining, captivating games is there.

    Creating the game though is only part of the equation.

  • Did you actually add parameters to the function ? This is an additionnal step that you did not have to do before. Right-click on the Function event, and "Add parameter".

    That was what I was missing. Wow, ok. Thanks.

  • Inside your function event, you'll have access to your parameters as expressions directly under System > Global & Local variables.

    I still don't get it. That's what I was doing before.

    If inside the function I select system.setvalue, in the variable list I get all of my global vars which I'd expect. But in the value, there's no way I see to add in either function.param(0) or anything with the function name.

    With the old way, I could set a global to function.param(0). Now, function doesn't appear in the list nor does the function name appear in the list and gives an error when trying to set it.

    What am I not seeing here???

  • New function's parameters are treated as local variables.

    I don't get it, you mean an instance variable? How do you get the value of one?