javascript json export for indie games

General discussion about the R.U.B.E editor
Post Reply
headwinds
Posts: 11
Joined: Sat Dec 29, 2012 8:14 pm

javascript json export for indie games

Post by headwinds »

I started a discussion about javascript in the other box2D forum but it also applies to the R.U.B.E. editor too.

I just started using R.U.B.E. today and am interested in using it to prototype javascript games and other toys before tackling something larger and more complex in C++ or Objective-c - I'm daydreaming a bit that perhaps one day js will be fast enough to not have to go the C route.
metalbass_92
Posts: 18
Joined: Wed Dec 26, 2012 12:27 pm

Re: javascript json export for indie games

Post by metalbass_92 »

I've never found how this scripting languages are better than native ones in any way...

Once you get yourself into C++ you can't get out of it :D
Xavier Arias
Cocos2d-x Game Programmer
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: javascript json export for indie games

Post by iforce2d »

Being able to run your game in a browser is obviously the main advantage, but there are many others... cross-platform by nature, instant distribution to any browser on the planet, less worries about memory management, no compile time, easy networking capability, easy image loading, easy serialization of object structures, easy integration with a web page, easy communication with server back-ends.
metalbass_92
Posts: 18
Joined: Wed Dec 26, 2012 12:27 pm

Re: javascript json export for indie games

Post by metalbass_92 »

Haven't seen anything more cross platform than C++ by now: works on PS3, Xbox360, Wii, iPhone, Android, Windows, Mac, Linux... everything! (except browsers ;) )

Sure you need to compile the code, but it's also faster because of it.
About memory management... a garbage collector is something you don't want to deal with in big games.

Using C++ opens you the big doors. You won't see any AAA title in JavaScript :lol:
Xavier Arias
Cocos2d-x Game Programmer
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: javascript json export for indie games

Post by iforce2d »

Well, "horses for courses" as they say. I agree that if there is any single language that could be nominated as the most useful, practical, efficient etc over the past, present and no doubt long into the future, C++ would be it. But that doesn't mean scripting languages don't have any advantages in any way. I don't use them all that much but I find that when I do, I get a lot more done in less time.

This is not an AAA title, but it demonstrates that Javascript can run a 3d game ok:
https://developer.mozilla.org/en-US/dem ... ananabread
headwinds
Posts: 11
Joined: Sat Dec 29, 2012 8:14 pm

Re: javascript json export for indie games

Post by headwinds »

have you considered creating a Javascript project feature?

I'd like to click New Scene and be able to configure it as a javascript or flash project so I get the proper coordinate system and some basic rulers so that I can define my canvas. I know the inverted solution to flip the y axis but if you can include it as part of a javascript project (which works for Flash) it would be a small win.

The rulers are the most important thing to me though - since Javascript games are usually embedded on the page and limited to a defined canvas - I'd like to be able to setup these dimensions in the editor.

I've cobbled together what I mean, stealing the rulers and the concept of a stage from the Flash editor.
Image

It would also be nice to design in terms of pixels not units. Let's the engine worry about the units and save the designer's brain cells :D

Right now I have to export the scene a few times until I get it to properly fit my canvas - but I might be missing something in the editor - I can select all my bodies and scale them down but I'd like to scale the entire scene to specific dimensions - for instance, 700 x 400 pixels - how would I do this?
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: javascript json export for indie games

Post by iforce2d »

I have found it useful to set up a static fixture so I can visualize the boundaries of the screen ( eg. as in the screenshot in this thread: viewtopic.php?f=4&t=58 ), would that help at all?

For the vehicles demos in Javascript, I just set a starting PTM and view center ( in the setNiceViewCenter function in http://www.iforce2d.net/rube/loaders/ja ... es_bike.js ). These numbers are found by running once in the browser, panning/zooming to get something I like and then using the numbers showing at the bottom (check the 'Show stats' box).

About working in pixels rather than units, do you mean like how you can display angles in either degrees or radians? For example if you could set a PTM somewhere, all the units shown in the properties panel would simply be scaled by that?
Post Reply