Embedding my game in a web page

So, I've been wanting to get my game to load in a browser page for a while, so more people can see it. The more research I do, the less likely it seems that I can get from Processing to the browser. I could port it to Processing.js, but it's currently using the Minim library for sound, and the file io to load levels from .txt files, and I'm told the libraries would break (which makes perfect sense, they use Java). I just want to know if there is any easy way to set it up to embed it. I haven't done much with Java outside Processing so any and all advice is appreciated!

This is the game, by the way: http://connorses.itch.io/escape-from-candy-world

Answers

  • edited February 2014

    Although my knowledge about it is still very limited, here are some tidbits: /:)

    As long as I know Processing, its Processing.JS counterpart was always at official version 1.4.1.
    Thence, if you manage to modify your program in order to successfully compile under the old Processing 1.5.1,
    it's pretty much more than halfway done for conversion compatibility's success rate for JS Mode!

    To guarantee that all of the external resources be loaded & ready in time, we gotta use Processing.JS's directives:
    http://processingjs.org/articles/p5QuickStart.html#synchronousIO

    Now the hardest part: I dunno about any cross-mode sound library for Processing.
    Seems like we need to request sound using a separate JavaScript program w/ HTML5! :O

    Another option is a bold 1: re-write your whole program in CoffeeScript Mode.
    We'd have access to both Processing's API plus any JavaScript 1s!!! >:/

    Take a look at 1 of my CS conversions below. Got some more if you need more! >:)

    # Square Flower (v2.1)
    # by  Jordan Orelli (2013/Dec)
    # mod GoToLoop
    # 
    # jordanorelli.tumblr.com/post/70910152988/square-flower
    # gist.github.com/jordanorelli/8100924
    
    DIM = `040`; CURVE = `-010`
    NUM = `050`; FRAMES = `0200`
    RAD = `0200`; LARGE = `0120`; FORM = 5
    BG  = -1; FG = 0xff0000FF
    
    SAVE_FRAMES = true; path = null
    
    setup: ->
      size 500, 500; frameRate 60
      smooth 4; rectMode CENTER
      strokeWeight 2; stroke FG; fill BG
      #path = dataPath "###.png"
    
    draw: ->
      background BG; translate width>>1, height>>1
      drawRect i for i in [0...NUM] by 1
      #saveFrame path if SAVE_FRAMES and frameCount <= FRAMES
      return
    
    drawRect = (i) ->
      n1 = TWO_PI * norm i, 0, NUM
      n2 = TWO_PI * norm frameCount, 0, FRAMES
      offset = RAD + LARGE * sin FORM*n1 + n2
    
      do pushMatrix; rotate n1
      rect offset, 0, DIM, DIM, CURVE
      do popMatrix
    
  • Another option is to export it as an applet. This will require your users to change their Java settings though, so it's probably not optimal. The other choices are to deploy it as a runnable jar or as a packaged application. More info here: http://StaticVoidGames.com/tutorials/deployment

Sign In or Register to comment.