Solar2D Playground

I posted about this to Slack about 20 minutes ago, but I thought it’d be worthwhile to post here as well.

Over the past few weeks, I’ve been working on something really cool that we can use to promote how easy to use Solar2D is, how fast it is to develop with Solar2D, as well as how much fun it can be, and that is:

https://www.solar2dplayground.com/

It is an interactive website where you can create and run Solar2D programs directly online.

Special thanks to Michael (Ponywolf) for the images and for creating a few sample projects. I’d also like to thank Jonathan (sporkfin) for his cool sample project.

Feel free to share that link. If anyone else comes up with a cool little project, preferably less than 50 or 100 lines, then let me know and I’ll add it there as well! Also, if you have any suggestions for the site, then please let me know.

22 Likes

Awesome :heart: I hope this will help to attract new members to the Solar2D community!

2 Likes

I said on Slack and I’ll say it again: great work! Hope this will be a great starting point for those willing to experience Solar2D. Thank you!

Nicely done ‘X’. … I hope to participate in some way. It really seems like a great idea and should be good fun. Hope it promotes Solar2D big time.

This is a really good Idea! Though I am new to solar2D I already like it a lot :wink:

But this site is not working in my Browser (“Failed to load .bin file”), Chome Version 81.0.4044.138 (Offizieller Build) (64-Bit), behind company firewall.
Same problem with old Internet Explorer …

Christian

@KristianFogel

On your Chrome, if you press F12 and reload the page, then what messages do you specifically see in your console? I’d appreciate it if you could let me know so that I could look into the issues.

1 Like

index.html:196 GET https://www.solar2dplayground.com/app/playground.bin 403 (Forbidden)

does this help?

Not really. 403 just tells me that the server received the request, but didn’t fulfil it for whatever reason. It could be that your company’s firewall is blocking it, but whether or not that is the case or why, I have no idea.

WOW! Amazing work! I had fun playing around with the examples, and they sure show how easy it is to get started with Solar2D. :+1: :grinning: :+1:

Fantastic work! This idea is so cool! This will be useful for some simple prototyping for example
:grin:

2 Likes

Really impressive.
Especially because the lines of code are very few but everything remains extremely clear .

Renato

Nice! Can you say, how you launch an engine on a web page? Or it some kind of a js interpretation?

What do you mean by “launch an engine”? It’s just a standard HTML5 build.

Sorry, when I saw the playground website, I read the code and, because of prbly sleepiness, I decided that it can be written directly in the browser and this will have an effect on the example.

Update


  • Solar2D Playground now remains active even if the user clicks outside of the app or leave the tab. Most browsers will, however, not let these events fire if the tab isn’t visible, so you may encounter some weird behaviour if you are using timers or enterFrame listeners and leave the app in inactive tab for a long time.

  • The Playground will also now run the sample projects upon selecting a new one.

  • The Playground features new Solar2D branded visuals on launch.

  • One new sample project, Prey Joystick, thanks to @sporkfin.

  • Other under the hood improvements and changes.


These changes aren’t yet live on the Solar2D subdomain, but only on the main Solar2D Playground site.

If you want to have your sample project on the Playground, then let me know and we’ll add it. I’m working on a few other features to the Playground over the weekend, but if you have any suggestions, at any time, please let me know.

3 Likes

Actually, I can see where stalxerhd is coming from. You can just write up a project and run it without having to build, which surprised me. It also gave me an idea. If you could create and link to projects via url a la repl.it, it would be a great way of spreading the word about solar2d. My own coding knowledge is largely limited to solar2d, so I have no idea how feasible that would be, but I might as well put the idea out there.

I am currently looking into some form of external storage so that users can save and load their projects.

I doubt there’s any easy way of integrating the playground with repl.it, but you can take a look given how the playground is fully open source.

Update


  • Solar2D Playground now features custom projects! You can either start with an empty project or upload your own .lua file from your computer. Your changes will be automatically saved for the duration of your session.
  • All projects, i.e. sample and custom projects, can now be downloaded. This will make it possible to save your progress and continue later.
  • Arrow key default behaviour is now blocked, so if you use them in your projects, your browser window will no longer scroll if the app window selected.
  • Added Spyric Font Loader for faster custom font preloading.
  • Added a link to Solar2D documentation.
  • Using print() will now also output the contents to browser console (in addition to display console, if it is open).
  • Improved error handling and other code performance and usability changes.

These changes are live on both the main site as well as Solar2D subdomain.

4 Likes

Update


It’s been a busy weekend and here’s another big update.


  • If a mobile device is detected, the Playground app needs to now be manually started. This prevents the site from throwing an error upon initially loading the site on some mobile browsers.

  • The Playground is now enforcing a minimum window width of 960 pixels to ensure a “desired minimum user experience” by preventing the app frame from becoming too small and blurry and the editor frame from being too small to be of any real use.

  • New error handling system: Lua based error handling is removed and errors are now handled by the site. Playground will terminate on first error instead of getting caught in a loop. Errors will have a clearer stack trace and upon encountering an error, the Playground will restart itself (or let the user manually restart it, if they so choose).

  • New staging environment for Playground. Fixes, changes and new features will now be applied at www.solar2dplayground.com/beta before deploying to live. The Solar2D subdomain version doesn’t have this new staging environment.

  • Added noscroll = true to app Iframe to prevent scrollbars from appearing.

  • Playground is now prevented from trying to start if not run on a server.

  • Further improved mobile device detection.

  • “Prey Joystick” sample code update (thanks Jonathan!)

  • Cleaned up and fixed indentation in app index files.

  • Updated Solar2D launch visuals for the app frame.

  • CSS fixes and improvements.


These changes (apart from the beta environment) are live on both the main site as well as Solar2D subdomain.

3 Likes