Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Jul 2011
Offline Last Active Today, 02:12 PM

#5307249 Is it inefficient to use Unity to turn 32kb of Javascript into a mobile app?...

Posted by on 22 August 2016 - 12:13 PM

They may not really need everything that std::string provides, but you may as well have it.


Hmm, its closer to pointing people towards Qt, just to use QString to concatinate two char* together ;)


But yes, I see your point but I still do see too many Javascript developers dragging in JQuery for very trivial things.

#5307213 Is it inefficient to use Unity to turn 32kb of Javascript into a mobile app?...

Posted by on 22 August 2016 - 09:57 AM

Followup Question: Is using a massive library for a single function also inefficient?  (I suspect it's a different process than what's going in with Unity.)


Personally I feel that dragging in a library just for a single function is a bad decision overall. It is not elegant and often causes problems with maintanance later on.


However... I must be wrong on this because I see so many Javascript developers drag in all sorts of crazy dependencies for doing extremely simple tasks. I am sure you have already seen the word "JQuery" pop up many many times on help forums. Always, without fail just to split a string, some weirdo will suggest JQuery.


But that said, I am in the fortunate position of being able to avoid working with developers such as these ;)



It reminds me of the time when someone dragged in the GLM maths library into our database project just to use the vec3 length function. The compiler we had on our build server didn't support such an old version of GLM and so when it came out why he had done this, It certainly didn't inspire much confidence in any of his later decisions. I think he later went on to use glm again, just for glm::detail::tvec1<T> or something just to zero initialize member variables... I did chuckle ;)

#5306997 Is it inefficient to use Unity to turn 32kb of Javascript into a mobile app?...

Posted by on 21 August 2016 - 04:18 AM

I personally don't like Unity, I find it time consuming and messy compared to other solutions but I know it has a lot of marketing behind it and many of my students do seem to like it.


Perhaps just be aware that Javascript in Unity (actually called Unityscript) and Javascript for web browsers are very different. So you might have to end up recoding quite a lot of your work if it is already standard Javascript.


You can make an app that just surrounds a web browser and run your game in that, it would work. I don't know what the components are called but you can pretty much just drag and drop it in using the visual designers.


Edit: What unity does for web exporting is convert its compiled .NET code (Unityscript/C# etc...) to C++ with il2cpp then it uses Mozilla's free and open-source transpiler to compile the c++ to very low level Javascript (asm.js). This is faster than normal javascript because it can be optimized well (although isnt very human friendly to develop with directly). The output binaries are very large because Unity, as an off the shelf product provides a lot of things even if you dont use them and doesn't strip out everything you dont need.

#5306875 Implementing PvP for a simple, non-trivial, javascript mobile game app

Posted by on 20 August 2016 - 08:19 AM

HTML5, or more specifically WebSockets does not allow a client web browser to host a server so regardless of if using Emscripten (via Unreal or Unity) or directly writing Javascript, it cannot work. You will need a server somewhere that can act as the game server for all your clients to connect to.


If you are interested in writing an app for phones or tablets, then these can of course host the server.


However, a slight hack you might be able to get away with if your game does not require much bandwidth to play: Use free Internet Relay Chat (IRC) servers to act as the "game server". Some of these support WebSockets or provide websockify proxies so that Web browser javascript can connect.


IRC such as irc.blitzed.org or freenode employ anti flood protection and limit clients to about 30 messages a minute. So if your game can get away with this, then it could work for you. I actually use this technique as a cheap and dirty list server for my multiplayer games.


If you need to scale up and host your own IRC servers one day (and remove the message cap) IRC is a standard (albeit pretty ancient though still popular) and you can find loads of very robust and tested open-source IRC servers.


As a rule of thumb, if your game is 2D, just plain Javascript and HTML5 canvas are often the easiest development platforms. If it is 3D then perhaps look at using an engine or perhaps Three.js (WebGL is a little too time consuming to use directly for most games). As for a database, then you are going to need a server anyway, perhaps use a RESTful type API in PHP and then SQLite? Loads of similar solutions here.

#5305911 Handling concurrent random access of shared resource on peer to peer system?

Posted by on 15 August 2016 - 03:17 AM

Right, I have uploaded the paper. It is actually one of my short papers (which I always find very difficult to fit enough information in) but hopefully it might give you some starting point.




Just waiting on permission to release source code. The problem is that the project utilizing this code has been Greenlit on Steam but we haven't been bothered to do anything about it haha.

#5305619 Handling concurrent random access of shared resource on peer to peer system?

Posted by on 13 August 2016 - 04:39 AM



As SeanMiddleditch suggested, you cannot lock resources on other computers directly. However you can create an API which makes it appear as though you have (which is how network filesystems such as NFS, SMB etc... work).


I wrote a paper a while back on how to provide and sync a tree-like structure to all clients and allow them to share / lock the resources in a multi-player shooter game. You might find it useful: http://dl.acm.org/citation.cfm?id=2662601


If you are working with C++, I might be able to rip the source out of our existing product and share some things.

This stuff is also still very relevant to my PhD so I would be very interested in hearing if you have come up with any of your own nifty solutions to this.


Edit: Darn, just noticed that the ACM Digital Library is not open-access and is only accessible behind a University address range or for paid subscribers. I will grab the .pdf paper and upload it on Monday. Sorry!

#5303532 Virtual Machines

Posted by on 01 August 2016 - 01:24 PM

You can use Virtual Machines to get OpenGL 3.0 since LLVMpipe on most modern Linux distributions provides a software renderer advertising OpenGL 3.0 compliance. Unfortunately it does not go higher yet to 4.x.

It's also quite slow (though surprisingly not too bad) and only really useful for certain testing.

#5303202 Compilers

Posted by on 30 July 2016 - 10:02 AM

Since much of the world is still using Windows 7, if you *must* use Visual Studio, I recommend 2010 (2010 express if you don't want to pay). That way your beta testers / friends do not need to download and install extra runtimes just to give feedback on your software.


Personally I recommend getting away from Visual Studio since I have seen so many developers get locked into it and missing out on really cool innovative compilers like Emscripten. So perhaps give GCC a shot (via the MinGW distribution) or better yet, Clang (since there is so much great work done on this tool these days). As a bonus, you do not need to install runtimes to get the output working on other machines (single portable .dll instead).


Some IDEs you might like if you want something more than a text editor:






These can all be made to use Clang, GCC, Emscripten etc...


But... remember, a lot of professional software developers do not use IDEs, perhaps have a think as to why and decide if you really need one. You will be so much more dynamic if you can make do without.


I personally use vi on OpenBSD and Notepad++ on Windows. Both help me keep my sanity and also allow me to clearly see where Visual Studio has fscked up the formatting when I mark my student's assignments.


Also Visual Studio 2015 Community requires logging in before you can use it. I never trust this kind of stuff.

#5297428 Microsoft Checked C

Posted by on 21 June 2016 - 03:57 AM

Just thought I would explain my interest in Checked C a little bit more. I am not here to recommend writing a game in it, I am suggesting that this could be a great technology to use for the parts of software that are currently needing to be written in ANSI C. For example things like SDL, Mesa, glew, glut, compilers etc...

No matter how much we (effectively the consumers in this context) prefer our own different languages, sooner or later we all depend on a C library that could potentially be made safer by using Checked C.

So things like Rust a C++ would still potentially benefit from Checked C. And that I think is pretty cool.

Rust is written in ~1.6% C (which is a massive amount of code, larger than many games in fact)
The Clang compiler is written in ~21.6% C (again massive and that's forgetting the standard library wrapping a lot of C)

If Checked C can alert us to bugs in these projects, then everyone's a winner :)

#5296928 Microsoft Checked C

Posted by on 17 June 2016 - 03:02 AM

It also most definitely does not include anything even close to weak_ptr.

Are you sure? When reading it through, it looked like ptr<T> was designed to NULL out when the original data was invalid. That is the functionality from std::weak_ptr<T> that would be very nice.

No. This doesn't solve anywhere near enough real problems compared to just using modern C++.

C++ can't solve this issue because it itself is based upon potentially dangerous C libraries. As a library consumer, C++ (even Java and C#) seem better than C but remembering that underneath all their hoods, the same dangers can (and almost certainly do) still lurk, it removes all the fun ;). Plus these languages end up running more C than a C program due to their additional layers written in C so they are still not ideal.

Checked C aims to remove these issues at a much lower level than possible by just bolting on another random language.

#5295626 Why is it so hard to do animations?

Posted by on 08 June 2016 - 09:10 AM

The Wavefront .obj format does not support animations but it does support "parts". You could write your own animation system to perform keyframe based animation (probably with interpolation). However you would also have to develop your own tool to create the animations. Personally this work is worth it since keyframe animation is really simple and fast and for small models (especially on mobile it looks quite good).


I wrote a tool that does this a while back that I can dig out for you if you would be interested in it (might take a couple of days to find it ;)). Here is a video of it:



I also provide an API for OpenGL that reads in the data and displays it you can use as a reference for the engine you are using.


You might also want to look at other file formats such as fbx or COLLADA which do embed animation data into them. It also means that you can do animation using Blender, Maya etc...


Some links to stuff:

http://www.autodesk.com/products/fbx/overview (FBX SDK to help load the FBX animation data).

http://threejs.org/docs/#Reference/Loaders/ColladaLoader (Example COLLADA loader for Three.js).

#5292039 Best gaming platform in the future with marketing perspective.

Posted by on 17 May 2016 - 05:30 AM

Develop for Linux because that's the only platform I want to buy games for. ;-)

Heh, I agree but preferably also provide source code so it is possible to support the many Linux distros, now and in the future with a newer libc and kernel.

But anyway, with cross platform development like Unity, why do you need to worry about the platform until you have made a few games and actually have a product to sell?

Unity provides a massive worry about cross platform support. If you want to support a platform that Unity doesnt support (older or newer Linux distros), there is very little you can do and will need to change engine.
Not to mention the Linux support provided by Unity is only really Ubuntu :/.

Also, after porting a Unity 2.x project to 4.x, I realized I would rather port to an entirely different engine!

SDL and C++ is such a better option here.

Every time I get comfortable with something, the market makes me move. I learned the bulk of what I know in XNA. Microsoft abandoned it. I learned DX11. Microsoft is pushing me to Linux; so now I need to learn OGL4.5.

After your experience, why the heck would you recommend the OP locking himself into Unity? ;)
Its not like Unity is going to be around for any great period of time (Game Engines are often short lived). I actually started working on an open-source Unity to soften the blow (in a similar fashion to MonoGame). But then realized that there were better engine designs to use haha.

#5292024 Best gaming platform in the future with marketing perspective.

Posted by on 17 May 2016 - 03:06 AM

The "hip and trendy" money making platforms change a bit too fast to really simply choose one and be done with it. Ideally you should write your games in such a way that they can be ported to a new platform in a short time span. This is not actually too hard but what it means in reality is not to lock yourself down to vendor specific languages or tools.


Remember that being locked into things like Unreal Engine and Unity will mean you will miss the boat when a new platform comes out because thay do take a long time to port their chunky engines across.


What I generally recommend is what you are using. C++ and SDL (and OpenGL if you need 3D). However learn to avoid Visual Studio because it will make you more flexible to port to other platforms. Some platforms that it does already support is:


Android: Using NDK and SDL, a game can often be ported in a couple of days

iOS: SDL has been ported. iOS apps can be written in C++ (and C which SDL is written in).

HTML5: Using Emscripten, your SDL code can be compiled into Javascript (asm.js) which can run in a browser (automatically using the HTML5 canvas do display.)

Windows: Standard platform

Linux: Standard Platform

*BSD: Standard platform

Mac OS X: Standard platform


Remember that 99% of software is still written in C. This really does make C the most portable language. Unfortunately it is a bit hostile to write games in so that is why I recommend C++ because it trades in a slight loss of portability with a very nice language (if you ignore the manky bits ;).

There are also hundreds of custom C and C++ compilers available (including C++/CLR that outputs to .NET IL like C#) making it very unlikely to lock you into a specific language or platform.


As for really locked down platforms (and I predict future platforms will be like this), Emscripten will likely be able to run your SDL / C++ game at about 70% speed. You can do this by using whatever crap they force you to write in to develop a very minimal http server (~20 lines of code) and open up the platforms web browser pointing to "localhost". Its a bit hacky but it gets your game out there :)

#5290661 Will Unity or Unreal Engine 4 suit better for me?

Posted by on 08 May 2016 - 09:17 AM

Remember that with Unreal Engine 4, they are allowing developers full access to their source code of *everything* (engine, editor, build system, test framework etc...).


At first, this may not mean too much to hobby developers just looking to use the engine for their own games but rest assured this will guarantee that Unreal Engine 4 will keep on being available forever. Whereas since Unity is closed source, it is very likely that it will fade out of popularity and existence like products before it (XNA 4.0, Adobe Flash, etc).


Developers who are willing to improve the Unreal Engine will port it to newer technologies (such as alternative operating systems like FreeBSD and less known distributions of Linux). This cannot happen with Unity. This is also the reason why UE4 could output to Flash and HTML5/WebGL almost an entire year before Unity could even though UE4 is a much more complex engine to port.


Also researchers trying new things out will gravitate to Unreal Engine 4 to try out new and innovative technologies (such as I am attempting to do for my own PhD). This means that Unreal Engine will just be more interesting to everyone in the long run. I actually see prosumer software like Unity as a product rather than as real development tools.


Not to mention, C++ is simply a more portable language than C#(any .NET language) so will remain available well beyond our lifetimes :). Like Microsoft VB6 (and Java to some extent), C# will become "uncool" one day and simply no longer be used for many things (especially in the game industry).


As for "getting into", UE4 has blueprint which is very friendly but a little bit inflexible or C++ which is very flexible and as long as you only use simple features (like you would in C# anyway), can be fine for beginners. Typically a mix of both Blueprint for the general flow and C++ for more involved logic are used and seems to work well.

I personally find that with Unity, you are thrust into a pretty much lifeless game world after dragging in a bunch of models and there is not much fun to be had until you get used to the design of the code and have followed at least a couple of video tutorials.

#5286453 programming language for android.....

Posted by on 12 April 2016 - 05:55 AM


Just because C++ has been around for a long time doesn't guarantee that it will be around forever.   Just about every survey I can find shows that C++ usage has been declining for years.

Other languages are almost always written in C or C++. So whilst C++ popularity may be declining (which it honestly isn't), it doesn't mean the technology is going away... ever.


Yes, it may not be cool. I remember the day when people told me that C and C++ was already obsoleted by Java 1.5... Haha did I have the last laugh ;)


The fact that C and C++ both have hundreds of compilers available to them whereas languages such as Java and C# have only a few does speak very highly for how critical C and C++ is for software development and how much they are "the" standard technology that all others are based upon.


For a beginner, it may not be relevant but for any technology have a look at its dependencies, such as what the runtime requires, what the compiler requires etc... This will almost always be C or C++ but also gives you a good idea of the lifespan of the language.