Fengist's Forum Posts

  • I'm not quite sure what's going on. When I first uploaded it, it crashed to a white screen. Ashely correctly diagnosed this and clearing the browser cache fixed it. On another run, the ants were all blinking.

    Since I don't own any apple products, I can't help you there.

  • Found this to be a fascinating subject. Apparently there's been a lot written on group behaviour and lots of code written to simulate ants, flocks of birds and schools of fish.

    So, I decided yesterday to play around with this a bit. Here's my half-assed attempt at ant AI

    twistedvoid.com/antz

    I'm only using a maximum of 300 ants so that it runs on my old laptop well. Since each ant is animated I didn't want to lag things out with gobs of ants.

    Ants exit the ant hill periodically and begin searching for food in a mostly random pattern. If food is located, it then uses the pathing behaviour to find it's way back home. As it travels back home it looks for a trail of 'pheromones' to see if another ant has found the food and went home. If so, it refreshes the trail. If not, it lays a new trail. The trail lasts 10 seconds if not refreshed.

    Rather than pathing, the trail is used to help ants find the food source (somewhat like real ants).

    Ants that step on the trail examine it to see which way the trail points and then, attempt to follow it's direction to the food source. Since they don't yet know if the food exists, they don't refresh the trail.

    Each food item has 100 points and each time an ant takes some it reduces those points by 100. If the food reaches 0, it despawns.

    When ants carrying food return to the ant hill, they despawn.

    If an ant has been wandering around for a while and steps on the ant hill, it despawns.

    You can download this very crude experiment here:

    twistedvoid.com/antz/Antz.c3p

  • When I ran it, UID2 was the obstacle.

  • Oh I see.

    UID2 is the obstacle. If it exists ANYWHERE you're telling the ant to not find a new path so it stops. You have the original one off to the side of your layout so ID2 does exist.

  • JSON: Has key "dayOfTheWeek"

  • I'm not sure what your object with UID2 is, but apparently it does exist so the ant stops because it has nothing to do.

    It found the last path, so failed to find a path is false so it doesn't execute that.

    It arrived at the destination but object ID 2 exists so that's false and it doesn't execute that.

    It has nothing left to do so, it stops.

    + Zombie1: On Pathfinding arrived

    + [DISABLED] System: [X] Object with UID 2 exists

    -> Zombie1: Set Pathfinding acceleration to random(60,150)

    -> Zombie1: Set Pathfinding speed to random(60,150)

    -> Zombie1: Set AntPosX to random(0, LayoutWidth)

    -> Zombie1: Set AntPosY to random(0, LayoutHeight)

    -> Zombie1: Find path to (random(0,LayoutHeight), random(0,LayoutWidth))

    -> System: Wait for previous actions to complete

    -> Zombie1: Move along path

  • Well, if you click on that link that you posted, you'll see that it's display's a JSON so, if you're using that URL, it's definitely not a 0.

    If you run in debug mode, what's loaded into the Ajax.LastData?

  • I haven't worked at all with JS files loaded locally so I can't be of any help in that department. You may have to put them in the scripts folder at which point, they may load automatically. I do not know. You'll likely need to include the path to them though if you do need to load them.

    I did a quick search for mathjax offline and apparently it does work locally. What other files you need to include, no idea. That's going to take some research and experimentation on your part. I did see that most examples only link to the MathJax.js with the config query on the end: ?config=TeX-MML-AM_CHTML

    I can tell you that if you look at the capx I uploaded, there is one line of JS that you're likely going to need to include in your project. MathJax was only parsing the text when the project was first run until I added that line of JS.

    As for the /'s, that's normal and I believe built-in to C3 as the text boxes will do that as well. It's 'escaping' the text, replacing things like carriage returns with their string representation /n and // to display a backslash.

    As always, when your project is running in Google, hit F12 and look for errors in the console.

  • You'll have to download the MathJax.js file and add it to the 'files' in your project.

    You can then change the location in Inject CSS from External JS to JS Files and give the path to the MathJax.js.

    That should work.

  • There are a number of 'tricks' you can use to determine if the date time has changed, like saving the date time to local storage the first time the app is run. The next time it's run, check to see if the current date is later than the previously stored one and if so, update it. You could also have periodic checks throughout the game to see if it's changed.

    If you're really concerned they may change it your best option is to get the time from a server using AJAX and compare it to the browser time.

    Here's a quick project I slapped together to get the time from worldclockapi.com

    + System: On start of layout

    -> AJAX: Request "http://worldclockapi.com/api/json/utc/now" (tag "time")

    + AJAX: On "time" completed

    -> JSON: Parse JSON string AJAX.LastData

    + AJAX: On "time" error

    -> (no actions)

    + JSON: Has key "currentDateTime"

    -> Text: Set text to JSON.Get("currentDateTime")

    It does get and display the proper time but, because it's a http and not a https, Chrome initially blocks the AJAX request. You have to click on the 'shield' to allow unsafe website requests. But, it shows you how it could be done.

    Ultimately though, if they really, really want to cheat by changing the system time, they will. You just need to find ways to make it difficult.

  • Just tested exporting my current project to NW.js and no sound either. They're MP3. Will C3 be eventually converting those or will NW.js eventually support them. I've been reading posts from over a year ago that hinted the support was coming 'soon'.

  • twistedvoid.com/latex

    You can either click on a button to show some example formulas or, you can paste your own latex in the white text box on top and it will automatically parse and display in the HTMLElement below.

    Pardon if this looks ugly, I spent 0 time making it pretty.

    Download

    www.twistedvoid.com/latex/C3LaTex.c3p

    You will need the HTMLElement and Inject CSS plugins I linked above if you plan to play with this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't know how I can make it much easier. You paste a link, paste some text and it works.

    Install the HTML Element and Inject CSS plugins.

    Paste that JS link above into the Inject CSS in the 'External JS' box.

    Paste your latex in the HTML Element Text and check 'text like HTML'.

    CSS has nothing to do with this.

  • If you use a text object you'll have 2 types of fonts to choose from. Local or one of the web fonts you uploaded.

  • The easiest way is to download them as ttf or woff, right click on the font folder and import them.