Fengist's Forum Posts

  • I don't think the fps is going to affect movement or animation when you slow down a game if it stays at 60. I believe what's going to create the choppy movement is how many frames your animation has. If you plan on doing slow motion, you're going to have to create more intermediate frames for the animation to make it look smooth, not increase the frame rate.

    Subscribe to Construct videos now
  • Well, I'm not going to dig too deep but I can tell you this.

    If you're going to import a complete latex document, you're going to have to pre-parse it because MathJax doesn't seem to know what to do with many of the document codes like these:

    \documentclass{scrartcl}
    \usepackage[utf8]{inputenc}
    \usepackage{amsmath,amssymb,amsthm}
    \begin{document}
    

    In which case, MathJax seems to ignore the whole document even if there are formulas inside it. With LaTex, it seems that anything between the (backslash)[ and (backslash)] is acceptable as a formula and it will parse it correctly.

    The HTMLElement has a lot of confusing features and it will take you a while to figure it out. Once you do though, a lot of the stuff at the bottom you won't need. But, I did successfully change font sizes, colors and even imported a .wott font from the MathJax GitHub page and it displayed properly.

    So, learning how to format your formulas will be the first trick. Learning how to get the full power out of the HTMLElement will the be the next. But, I'm now quite confident that you could build a formula designer like the web site I linked in my first post if you really wanted to.

    GL and have fun ;)

  • Another quick test and supposedly this is chopped from a LaTex document, perhaps you can confirm.

    changed the HTMLElement to this:

     [
     \mathcal L_{\mathcal T}(\vec{\lambda})
     = \sum_{(\mathbf{x},\mathbf{s})\in \mathcal T}
     \log P(\mathbf{s}\mid\mathbf{x}) - \sum_{i=1}^m
     \frac{\lambda_i^2}{2\sigma^2}
     \]
    

    and got this:

    That complex enough?

    *edit Oh and that was in Chrome

    *another edit. For some reason this site is stripping out the \ before the first left bracket so copying and pasting the code above won't work.

  • Quick test (naturally if I come up with a crazy idea I HAVE to test it):

    I went to the example on this page (sorry can't post the actual link)

    mathjax.org

    I copied everything inside the <body> of the html so it looked like this:

    <p>
     When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
     $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
    </p>
    

    I then pasted that to the HTMLElement plugin text field and set the the "text like HTML" to true.

    I then copied this JS link

    https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML
    

    and pasted it into the inject CSS plugin as External JS

    Ran it and I got this:

  • Ok, this is a completely unknown area for me but it struck my curiosity so I did some digging. Take it for what it's worth.

    MathML is a markup language that is supported by W3.org which can be added to HTML in order to display complex formulas:

    w3.org/Math

    It appears there are several libraries to convert LaTex to MathML. The problem with MathML is that Chrome doesn't support it.

    However, MathJax appears to be able to convert LaTex into something that displays on all browsers using CSS and webfonts which C3 does handle.

    mathjax.org

    And, it's JS which you should be able to either link to or include in a C3 project.

    So, now that you have it as HTML, what do do with it?

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

    I've been using this plugin to do Ajax calls to a server, grab html and display them in a C3 project. While I have found some minor issues with it, it seems to mostly work. Once you learn it, the HTMLElement also has some other interesting features that might work really well with formulas. First of all, since the HTML is loaded into the plugin, you can parse it and edit it and it instantly changes. You could have a text field, paste in your LaTex, let MathJax convert it and then place it in the HTMLElement to display it. That plugin also has the ability to make clickable elements in the HTML that can be used to call a C3 function.

    Because MathJax uses CSS you can use another plugin from the same author to solve that problem:

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

    I've been using that to successfully load both JS and CSS from a webserver into my C3 project. And the loaded CSS works with the above plugin to display the HTML however you wish.

    With a little creativity, I believe that you could duplicate this website in a C3 project:

    codecogs.com/latex/eqneditor.php

    Therefore, including it in C3, IMHO, would cause unneeded bloat and would divert Scirra's limited resources onto a project that only a handful of end users would need. If the ideas I presented above could be made to work, that would be ideal.

  • Here's the problems you face:

    MP Plugin: While this is probably the easiest solution to implement, it requires use of the signalling server. If it ever goes down, you game goes down. It also means your clients are connected to each other and none of the data or stats are funneled through any service you have so collecting that data requires additional work. It can act as a server but this requires that somewhere on the internet you have to have a dedicated client running inside a browser. To me, that's just a huge, huge overhead for running a server. It just seems silly, though I suppose it does work to a degree, to have a server running inside a browser. And, that also means that if you're going to host the game on fast commercial connections, you'll need a server that you can VPN into to constantly make sure that browser is running.

    Ajax: Connecting to a webserver with Ajax is easy enough. You'll have to write scripts in a language like PHP to make requests of the server. The problems here is you're only making requests, it's one way communication. The server can't 'push' notifications out to your clients using just Ajax. Your clients can 'poll' the server with a request, say every second, and see if there's anything it needs but this has it's own set of problems. You get 1,000 clients polling a server every second and you're likely to run into hosting issues.

    Web push notifications: There are methods out there to send these 'push' notifications to clients and I have successfully made them work in C3. However, each such connection to a server becomes a constant connection. Unlike Ajax which makes a brief connection and then disconnects, this method keeps the connection open. The problem there is, each client is going to need a connection and to get more than say 100 connections on a web server, you're getting into premium server price range. You get more than 1,000 connections and you're going to need some server horsepower to manage them all.

    WebSockets: This method has the potential to have thousands of active connections without using the actual webserver (like Apache). Many games use this along with other communication methods (UDP/TCP) to communicate with clients. The problems here is that you are going to have to write a dedicated server in, most likely, a higher level language like C#, Python or C++, which can be a daunting task. You'll also need hardware sitting somewhere that the server code can run on.

    For a card game, lag shouldn't be an issue. Were I thinking of doing something like this I'd most likely look into using Ajax or a combination of the MP plugin and Ajax to collect stats from the players.

  • You do not have permission to view this post

  • You can make one version of your game with host events only, and a client version that only joins rooms as peers.

    I would LOVE to see a game, demo, something, that uses the official multiplayer plugin in this capacity. I recall a few years ago playing on the official mp demo with a number of other people and found the rubber banding and lag to be horrendous. If anyone has this working smoothly, I'd love to see it.

  • Well, in a quick search I found that you're going to need Acrobat installed on the cell phone. If it isn't, it's likely assuming it's just a file for download and doesn't know how to open it.

  • If you REALLY want to dig into his model, here's Craig Reynolds homepage with just gobs and gobs of info on his simulation.

    red3d.com/cwr/boids

  • nevermind, thot you were trying to detect mobiles.

  • From a quick look at the code it appears that each instance of an ant runs it's own set of code to determine the pathing and searching behaviour. Because of this, I highly suspect that trying to duplicate that many ants in C3, each acting independently is going to be a challenge as the software that runs all of that doesn't have the overhead of a browser to manage as well.

  • Apparently that js isn't maintained any more. Here's a fork of the original updated as of last year. Might try it.

    github.com/shinyshoe/mosleep

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can also tell you this. It appears you created this in C2. I ran it as a C3 project and it didn't do it. My new guess is that this was/is a bug in C2 that got fixed in C3.