Zack0Wack0's Recent Forum Activity

  • Ashley, if you add file bundling to Construct 2, you can also include custom fonts on the canvas using @font-face.

    Providing a transparent canvas shadow on the text element will also anti-alias it. Providing the option to stylize the shadow would also be useful.

    <img src="smileys/smiley23.gif" border="0" align="middle">

  • Agreed, entirely.

  • Unfortunately there really isn't any options to protect JavaScript files, it's completely open-source and it'd be incredibly dangerous if it wasn't.

    Like Tom said, the only things you can do is make the code hard to read. There's heaps of pretty printers though, so even if you change the variable names you can still format it back to it's original state.

  • I'm assuming you used some sort of Windows Virtual Environment?

  • I mean there's onCreate functions on the instances so it'd make sense to have an onDestroy one as well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hopefully this helps:

    To get the time passed for this tick, use

    ar dt = this.runtime.getDt(this.inst);

    dt is the time, in seconds, that the physics simulation should advance. That should keep the speed steady no matter the framerate.

    To get a callback when an instance is destroyed:

    I just remembered there's already a function for this, because other parts of the runtime need it. Call

    untime.addDestroyCallback(function(inst) { alert(inst.toString()); });

    and it will alert the instance ID whenever something is destroyed.

    To get a callback when an instance is moved or rotated:

    There's nothing for this right now, but for the next build I've added a method for instances:

    nstance.add_bbox_changed_callback(function(inst) { alert(inst.toString()); });

    This will alert the instance ID whenever its bounding box is changed (x, y, width, height or angle is changed). Try to only add one callback and only for instances that really need it, because otherwise it'll add unnecessary overhead.

    Hope that helps, let me know if there's anything else you need!

    Thanks!

    Yep, I already have that code. See the problem is, at least as far as I can see (it might be my logic, who knows) is that currently construct does logic inside the same thread as rendering. So this is what happens:

    1. Engine renders the frame.

    2. The instance triggers the behavior's tick (which at the moment is a bit hacky, I forgot to mention this, is there a way to have a behavior .tick callback rather than an instance .tick callback?) and every instance increments the behaviors ticking count. When the ticking count is equal to the amount of instances with the behavior, the box2d world steps.

    3. As the gap between frames starts to get bigger, the delta between frames increases. Because I'm stepping the box2d world by this amount, it's stepping further in the physics world because the delta is larger.

    You should add an onDestroy callback sometime as well. It'd be a lot more easier. But thanks for that anyway.

    I'll be adding the callback to any instance with the rigidbody behavior. This is so I can move the body in the box2d world whenever you move the sprite's position by events, or rotate, etc.

  • Why everybody hates IE? cause it's microsoft?! or what?

    I'm using it since was added to windows (and had acces to internet)and never had any problems with it. Opera, chrome, firefox why? they are faster? allows you to open hundreds of pages at same time?

    They break standards (other browsers do too, but IE more so than the others), include new standards that are practically useless rather than following working standards, and up until now it was incredibly slow. I will withdraw this opinion on the new versions though, Microsoft are really cleaning their act up.

    EDIT: Sorry, didn't realise how many pages there were.

  • Once again, I'm unable to edit my posts, so I'll just double post.

    I've started the Physics behavior, see the really (broken) test here.

    There's a few problems currently, I also need some engine changes from Ashley.

    1. You'll notice as you click (spawning new objects) the physics processes speed up. This is because I can't get my head around the logic to make it tween properly.

    2. In order for me to continue with this, I need onDestroy functions (so I can remove the rigidbody from the box2d world) and a way to move the box2d body when the object's position and angle are changed from events. These aren't available in the engine at the moment.

  • Well, I'm unable to edit the OP, so I'll just put this here.

    Socket (WebSocket version) - Download 1

    <img src="http://dl.dropbox.com/u/551734/dev/c2/plugins/socket-websocket1.png" border="0">

    The WebSocket version of the Socket plugin works using WebSockets, a new HTML5 standard. Unfortunately WebSockets support has been dropped by Firefox and Opera because the specification was flawed, so this version only works in Google Chrome and WebKit based browsers. You can enable WebSockets by command line though, if you want to play around with it in other browsers, google it.

    Obviously due to the fact that this is a socket you need a server on the other side to communicate with. This version of the Socket plugin supports normal WebSocket servers. If you google 'WebSocket server' you'll find a server that works in a language that you like, and then you can program the server-side stuff.

    I've included an example .capx in the download. This example connects to the echo.websocket.org server, which sends back anything that you send towards it. When the 'Echo test' message pops up (at least it should if its working), that means that the echo.websocket.org server has sent back the 'Echo test' message that the socket in the example sends towards it.

    Socket (Cross-browser version) - Download 1

    <img src="http://dl.dropbox.com/u/551734/dev/c2/plugins/socket-io1.png" border="0">

    The cross-browser version of the Socket plugin is powered by socket.io, which is a JavaScript library that aims to allow real-time streaming web connections for all browsers that it can. Socket.IO first tries with WebSockets, if they're not supported then it tries Flash sockets (which are basically the same as WebSockets - asynchronous, and fast) which are usually supported by every browser because practically every one has Flash. If Flash isn't supported then it tries XHR multiparting, which is a way to make XmlHTTPRequests (ie. AJAX) stream connections. If even that isn't supported, it then tries JSONP polling and XHR polling.

    Unfortunately, Socket.IO has a rather limited amount of servers you can use. I suggest Tornadio, which is an extension of the Python module tornado. Its the module I used to write the test echo server in. The server.py file is also available in the download. You should note, that in order for Flash sockets to work, there also needs to be a flashpolicy.xml file with the server which has been included as well.

    You can see a list of Socket.IO servers here, at the bottom of the page, and there's pretty much a server for all the good networking supported programming languages (perl, ruby, python, java, etc). The default server is written in node.js which is a really nice server-sided implementation of JavaScript for server-networking, it's also using the same JavaScript engine, v8, as Construct 2 (I think..). I had to use version 0.6 of Socket.IO due to the fact that the new version doesn't work too well with Tornadio.

    I'm not too sure about Flash sockets as well, I believe that they will work however if you can't get them to work try including the WebSocket Flash (.swf) files included in the download.

    All in all, it should work nicely. I've written a multi-player game before with the Socket.IO library and I got it working in Opera. If there are any issues with this version, just post them here and I'll try and fix them.

  • Also, I forgot to mention the maximum amount of space the storage can hold. 5mb for most browsers (Chrome, Firefox, Opera, Safari, etc) and 10mb for Internet Explorer 8 - 10.

  • Thanks, I really like the new plugin system.

    I have some more ideas that I'll make:

    Box2D physics (I already implemented this in my game engine so I know what to do)

    Run time image manipulation (again, done this before)

    I also really want to help with the engine

  • Source code available on Github

    Changelog

    07/01/12

    Socket: Upgraded socket.io version. Writing a tutorial.

    19/09/11

    Sockets: Fixed to work with the API changes.

    WebSockets: Now supports the new mozilla version of WebSockets. It's probably going to screw up compatibility on the server side, but if you have a good server it should be able to work with both of them.

    Storage: Fixed to work with the API changes.

    09/08/11

    Socket: Messages are now stored in a data stack to prevent packet loss.

    Plugins

    Socket (Cross-browser version) - Download

    <img src="http://dl.dropbox.com/u/551734/dev/c2/plugins/socket-io1.png" border="0">

    The cross-browser version of the Socket plugin is powered by socket.io, which is a JavaScript library that aims to allow real-time streaming web connections for all browsers that it can. Socket.IO first tries with WebSockets, if they're not supported then it tries Flash sockets (which are basically the same as WebSockets - asynchronous, and fast - however not supported by Construct due to not being able to bundle resources) which are usually supported by every browser because practically every one has Flash. If Flash isn't supported then it tries XHR multiparting, which is a way to make XMLHTTPRequests (ie. AJAX) stream connections. If even that isn't supported, it then tries JSONP polling and XHR polling.

    Socket.IO needs a custom server. The default server is built in node.js, which is actually server-side JavaScript (and powered by the same engine that Construct uses for JavaScript). I would highly suggest using this version of socket.io, as it works perfectly. You can see a list of Socket.IO servers here, at the bottom of the page, and there's pretty much a server for all the good networking supported programming languages (perl, ruby, python, java, etc).

    If you want to use node.js (suggested), then you will need to install it and then install the socket.io module via the command line (npm comes when you install node.js):

    npm install socket.io
    

    There is an example server and client inside the zip file. You can also read the quick tutorial linked in the tutorials section below.

    Socket (WebSocket version) - Download

    <img src="http://dl.dropbox.com/u/551734/dev/c2/plugins/socket-websocket1.png" border="0">

    The WebSocket version of the Socket plugin works using WebSockets, a new HTML5 standard. Unfortunately WebSockets support has been dropped by Firefox and Opera because the specification was flawed, so this version only works in Google Chrome and WebKit based browsers. You can enable WebSockets by command line though, if you want to play around with it in other browsers, google it.

    Obviously due to the fact that this is a socket you need a server on the other side to communicate with. This version of the Socket plugin supports normal WebSocket servers. If you google 'WebSocket server' you'll find a server that works in a language that you like, and then you can program the server-side stuff. You won't be able to make a server as easily as you can make a game in construct, you'll have to put in hard code.

    I've included an example .capx in the download. This example connects to the echo.websocket.org server, which sends back anything that you send towards it. When the 'Echo test' message pops up (at least it should if its working), that means that the echo.websocket.org server has sent back the 'Echo test' message that the socket in the example sends towards it.

    NOTE: DON'T USE THIS UNLESS YOU HAVE TO. The specifications for WebSockets are very dodgy, and this is only here for people who really-must use WebSockets with a pure WebSocket server for some strange reason. The cross browser version of the plugin is much better.

    Storage - Download

    The Storage plugin allows you to store data in the browser. There are two places to store the data: Session Storage, which is available in your current HTTP session; and Local Storage which is available forever (or until the user clears there browser cache, as far as I know).

    The 'Store * data' actions take a key and the value to store. The key is simple something to remember the data by so you can use the data later. The value is a value, simply.

    The '* Storage supported' conditionals are to check whether the browser supports each storage type. You'll find a large majority of browsers that support the HTML5 Canvas support HTML5 DOM Storage, therefore any browser that can render Construct 2 games will support this plugin.

    The '* data exists' conditionals are to check whether the key has data set to something in the storage.

    The 'Get * data' expressions allow you to fetch data from storage. They take the key which is the key that you used to set the value originally.

    NOTE: This is deprecated. This was implemented as an official plugin, so there's no point downloading it.

    Installation

    Simply extract the file into your plugins directory, by default at C:\Program Files\Construct 2\exporters\html\plugins.

    Tutorials

    TODO

Zack0Wack0's avatar

Zack0Wack0

Member since 13 Mar, 2009

Twitter
Zack0Wack0 has 1 followers

Trophy Case

  • 15-Year Club
  • Email Verified

Progress

16/44
How to earn trophies