I haven't fooled around with game engines in a long while, and I recently learned about Defold. It's an engine bought over by King (of Candy Crush fame), and it's primarily for 2D development, though it's a 3D engine at heart.
I've been playing with it for over a week, mainly learning Lua and going through the various tutorials. For what it's designed for, it's superb.
However, when I started to deviate from its roots, I found it quite challenging to work with.
For a start, the camera. In Unity for example, it's quite straightforward to setup/position the camera, ortho or 3D, and do stuff like space transforms from screen space to world. It's all worked out in the api.
In Defold, things get a little more tricky.
The camera is pre-defined to work in a certain way, with the camera centered at the bottom left of the screen, which is perfect for what the engine is designed for. Given the genre of games that King develops, as well as a fair amount of games I've seen in the forums, this is perfect. It works out of the box, not much tweaking required.
For me, I wanted to try something different, a camera centered at 0,0 and that's when things got tricky.
To do so, you'll need to figure out a projection matrix for it. It's challenging, as I'm not a strong maths person. Embarrassing, considering what my job is. Hours were spent on Scratchapixel trying to understand exactly how it all works. I've definitely walked away with an improved understanding of the rendering pipeline, as well as a refresher course on matrices :)
On the flip side, the html 5 export is an interesting thing, it would be cool to dev mini games for my chromebook and stuff like that. I'm also quite fond of the way they handle input, some of my basic tests for mouse/keyboard input went flawlessly. Haven't yet tried touch, but given as I'm not as fascinated with mobile game dev as before, I don't think I'll bother.
I think the key draw for me is the engine's dev team. Defold was original developed years ago before it was bought over, and the development team, including the original developers, are active in the forums. That's houdini-like levels of awesome!
I've read many arguments why not to use an engine by King, (Banner Saga trademark thingy). That's really icky, but you know what, the engine itself was created way before King, and the folks developing Defold are responsive on the forums. For that reason - plus I'm not a game developer - I've decided to stick with Defold as my fun engine for choice for the time being.
Showing posts with label Unity3D. Show all posts
Showing posts with label Unity3D. Show all posts
Thursday, August 31, 2017
Wednesday, October 28, 2015
Google Cardboard & Unity
Tuesday, June 16, 2015
Quadcopter Simulation in Unity
Sunday, May 31, 2015
Using BSP Tree to generate random levels
I've also tested this on mobile devices, however, it's excruciatingly slow. I need to figure out what's wrong. I wrote this as a recursive function, and there have been some blips on google about mobile platforms and small heap sizes, but nothing conclusive.
Wednesday, March 04, 2015
Unity 5.0, my kindle, and a banana.
No, they are not related at all. As the self-proclaimed Most Boring Person with a Blog, I have to put in something more boring in addition to the boring stuff I post.
I ate a banana today*.
So, with regards to my Kindle - it's the 3rd generation keyboard, 5 years old now? - has been acting up recently. Freezing and resetting suddenly. Been _slightly_ tempted to used this excuse to upgrade to one of the new ones with the backlight - would be super to read in bed without the ceiling lights on.
But anyways, as I'm saving up for my dream aircraft carrier and can't really justify buying a new kindle, a quick google search had me taking the kindle apart, and lo and behold, the rattling that was going on inside, was due to loose screws! Those little buggers must have been the cause of my freezes. Got them screwed back in what I hope are their correct positions. Will know shortly if this is truly the cause, or if I truly need to speak to my banker about buying a new kindle.
For all the electronic toys I have, the kindle is probably the one I keep in the highest regard, and will definitely replace if lost or damaged.
Finally, Unity 5 got released today! Surprisingly, the free version (rebranded to "Personal Edition") comes with many coveted features only previously available in the pro editions - which cost a pretty penny - the profiler is now available, as well as render to texture and other nifty toys. This is apart from the new toys released in 5. And it's "free".
Basically, if you earn more than 100k gross a year, you need to get the pro version. This is perfectly fine for dabblers like myself, but many people are grousing that the key feature that they want, in the pro version is the removal of the Unity logo at the start up of apps and games.The cost to remove the logo can run up to several grand, in order to obtain the pro version. And now, with all the key pro features available in the Personal Edition, and not everyone needing the pro features, makes it sort of a tough sell. This, is from someone on the outside looking in.
Drawing a parallel to Houdini, which has 3 tiers - Apprentice, which is Non Commercial, Indie (my license!) which is valid for those who gross less than 100k a year with minor restrictions, and of course the full blown commercial licenses for Houdini/FX. Indie has got to be popular, I got it mainly to support sidefx, and because its 200 bucks. It's finally finding use with Unity.
I would think Unity would gather a fair bit of support (and maybe revenue!), if there was a middle tier that caters to devs who earn less than 100k, but would like the logo removed. It would slot right in perfectly with Hindie. But that's the random pitter patterings of the Most Boring Person with a Blog.
Right, unity's finally downloaded. Time to launch!
*and bananas are delicious.
I ate a banana today*.
So, with regards to my Kindle - it's the 3rd generation keyboard, 5 years old now? - has been acting up recently. Freezing and resetting suddenly. Been _slightly_ tempted to used this excuse to upgrade to one of the new ones with the backlight - would be super to read in bed without the ceiling lights on.
But anyways, as I'm saving up for my dream aircraft carrier and can't really justify buying a new kindle, a quick google search had me taking the kindle apart, and lo and behold, the rattling that was going on inside, was due to loose screws! Those little buggers must have been the cause of my freezes. Got them screwed back in what I hope are their correct positions. Will know shortly if this is truly the cause, or if I truly need to speak to my banker about buying a new kindle.
For all the electronic toys I have, the kindle is probably the one I keep in the highest regard, and will definitely replace if lost or damaged.
Finally, Unity 5 got released today! Surprisingly, the free version (rebranded to "Personal Edition") comes with many coveted features only previously available in the pro editions - which cost a pretty penny - the profiler is now available, as well as render to texture and other nifty toys. This is apart from the new toys released in 5. And it's "free".
Basically, if you earn more than 100k gross a year, you need to get the pro version. This is perfectly fine for dabblers like myself, but many people are grousing that the key feature that they want, in the pro version is the removal of the Unity logo at the start up of apps and games.The cost to remove the logo can run up to several grand, in order to obtain the pro version. And now, with all the key pro features available in the Personal Edition, and not everyone needing the pro features, makes it sort of a tough sell. This, is from someone on the outside looking in.
Drawing a parallel to Houdini, which has 3 tiers - Apprentice, which is Non Commercial, Indie (my license!) which is valid for those who gross less than 100k a year with minor restrictions, and of course the full blown commercial licenses for Houdini/FX. Indie has got to be popular, I got it mainly to support sidefx, and because its 200 bucks. It's finally finding use with Unity.
I would think Unity would gather a fair bit of support (and maybe revenue!), if there was a middle tier that caters to devs who earn less than 100k, but would like the logo removed. It would slot right in perfectly with Hindie. But that's the random pitter patterings of the Most Boring Person with a Blog.
Right, unity's finally downloaded. Time to launch!
*and bananas are delicious.
Monday, February 16, 2015
Houdini - Unity - Vertical Cross from Lat Long map HDA
Monday, February 09, 2015
Houdini + Unity FTW
No idea what I'd do with this info hmm.
Saturday, January 31, 2015
Exploring A* in Unity!
Pathfinding isn't something new, and I've actually coded A* in C++ years ago... not sure if it's still on the blog somewhere. But I was like.. yeah, pathfinding rules! Let's code it up in Unity! Plus I've not had a chance to play with the new UI in 4.6, so this was good fun.
The distance parameter, H, changes the results quite dramatically. Originally, I used the Manhattan Distance (I was following this tutorial) and while you get a solution, it was quite meh. Changing it to simply the distance between the selected node and target provided a much improved result.
Thursday, October 23, 2014
Perturbation Search
I was thinking about this, and solution spaces that contain many optimum solutions. The approach above simply uses the first agent that has a solution and attempts to improve on the solution. This solution, will be located "nearby" in the search space. Every generation without an improved result increases the search area by increasing the range of perturbed values.
If it goes on long enough, this will simply devolve into a purely random search.
I'm also pondering if I were to extend the random search; instead of using the first found individual to lookup a best result, we can continually use the random search, and every individual found put through the perturbation search. That could help locating another optimum solution in a different space.
Interesting questions, however I want to explore other such stochastic search methods. Onwards!
Monday, October 13, 2014
Genetic Algorithm-like algorithm thoughts
So I'm working on an idea that I came up with that _seems_ to work - a way to quickly optimize results around the local optima, and it seems to work. It is no longer a genetic algorithm, but something that will give a *local* optimal result faster, but will take longer to locate solutions in another space.
First, I begin with a broadband random search for an agent of a certain fitness; in my test case, it is to locate an agent that will complete the course under 10 seconds. Once this agent is found, the algorithm will optimize in the local space.
This is not done via crossovers; it is even simpler. The next generation of agent simply starts with the fittest agent of the last generation, and the control values are jittered by a certain delta. This delta is increased when a new generation does not find any fitter results, and is reset to a low value when a new fitter agent is found.
In my tests, the results are quite striking. The modified genetic algorithm yesterday required over 360 generations to find a really fast result; the method mentioned above located an even faster agent under 100 generations.
While running the simulations, the spread of the delta got me thinking about the number of agents looking for a solution.
When the delta is small, the X number of agents cover a certain search region; when the delta gets larger, but with the same number of agents, there are many "spots" where we are blind to the results; there are far more problem space versus agents to run them.
Hence, it is in my opinion that for my particular problem space, with a limited number of agents, the rate of increase of the delta should be smaller, so as to allow the agents more time to search before casting the net wider.
On the other hand, due to the algorithm searching in a very local space, it will take *forever* to relocated to another area with a more optimal solution space (if such a space exists).
I will probably spend another day exploring this, but I want to explore neural networks next :)
First, I begin with a broadband random search for an agent of a certain fitness; in my test case, it is to locate an agent that will complete the course under 10 seconds. Once this agent is found, the algorithm will optimize in the local space.
This is not done via crossovers; it is even simpler. The next generation of agent simply starts with the fittest agent of the last generation, and the control values are jittered by a certain delta. This delta is increased when a new generation does not find any fitter results, and is reset to a low value when a new fitter agent is found.
In my tests, the results are quite striking. The modified genetic algorithm yesterday required over 360 generations to find a really fast result; the method mentioned above located an even faster agent under 100 generations.
While running the simulations, the spread of the delta got me thinking about the number of agents looking for a solution.
When the delta is small, the X number of agents cover a certain search region; when the delta gets larger, but with the same number of agents, there are many "spots" where we are blind to the results; there are far more problem space versus agents to run them.
Hence, it is in my opinion that for my particular problem space, with a limited number of agents, the rate of increase of the delta should be smaller, so as to allow the agents more time to search before casting the net wider.
On the other hand, due to the algorithm searching in a very local space, it will take *forever* to relocated to another area with a more optimal solution space (if such a space exists).
I will probably spend another day exploring this, but I want to explore neural networks next :)
Sunday, October 12, 2014
Exploring Genetic Algorithms 2
This has given me ideas to possibly make the algorithm locate results faster... but we'll see when I get to coding it.
Wednesday, October 08, 2014
Exploring Genetic Algorithms
The last month I've been spending a short while each day coding up an exploration into Genetic Algorithms. Being the King of Procrastination, I've decided to blog about what I've completed over the weekend, and my next steps.
So, basically my problem is the optimal selection of values for agents to traverse a short course in the shortest time. Several parameters are available, such as maximum forward speed, maximum rotation speed, length of the lookahead sensors, spread of the sensors etc.
We can probably figure out what a good setting is, but the GA will allow us to explore this big problem space on its own, and perhaps evolve a solution that is not logical, but will work very well.
I got the GA working on Monday, and, depending on the run, is able to seek out solutions to the problem. One of the lucky runs found a really fast solution, but the exploration space was not as focused as I liked.
One of the reasons is the way I generate the next generation of agents; they are simply created from roulette wheel selection of the fittest, but it seems like I need to look more carefully into the roulette function as the random function I am using _may_ be more gaussian than uniform distribution, so there is a bias to which parents are chosen. More checking is needed.
While I was pondering about this, I have decided to try a more "directed" kind of GA:
First, I will allow the GA to run, and then choose an "elite" agent, one that fits a certain set of parameters. In my case, my target is to have agents complete the course under 5 seconds (the GA I have now, evolved agents that did it in 4.6 seconds). So, I'll just evolve them as before, *until* I get an agent that can not only complete the course, but can do it under 10 seconds.
(Assuming the GA's run is not soo lucky it gets under 5 seconds on the first run. As the first generation is randomly generated, I've seen some really fast results on the first generation... but I digress.)
This "elite" agent is then kept on, and used as a starting point for future generations. It does not directly enter the pool, but will be used as the one of the two agents to be mated for the next generation. Talk about some serious polygamy here.
The current elite is only replaced by one of its descendents when the descendent has a higher fitness score i.e. faster.
This of course leads to a more localized search of the solution, since it will evolve around the elite agent. To search further, mutation is probably the only way to jump to another possibly more optimal area.
At the moment, my mutation rate varies depending on the spread of the scores of the agents; if the agents have similar scores, the mutation rate jumps to a higher one, in order to search further. If the scores are wide spread, lower mutation will occur.
The theory I have right now is to have a low mutation rate once an elite agent is found, so the GA will explore the nearby solution space for more optimum solutions. As time goes on, the mutation rate will increase if no improved solutions are found; this will, in theory, allow the GA to gradually search further afield. Perhaps, even after X number of generations, the elite idea can be dropped and the GA can go back into the original exploration of the space without being "led" by an elite agent.
So, basically my problem is the optimal selection of values for agents to traverse a short course in the shortest time. Several parameters are available, such as maximum forward speed, maximum rotation speed, length of the lookahead sensors, spread of the sensors etc.
We can probably figure out what a good setting is, but the GA will allow us to explore this big problem space on its own, and perhaps evolve a solution that is not logical, but will work very well.
I got the GA working on Monday, and, depending on the run, is able to seek out solutions to the problem. One of the lucky runs found a really fast solution, but the exploration space was not as focused as I liked.
One of the reasons is the way I generate the next generation of agents; they are simply created from roulette wheel selection of the fittest, but it seems like I need to look more carefully into the roulette function as the random function I am using _may_ be more gaussian than uniform distribution, so there is a bias to which parents are chosen. More checking is needed.
While I was pondering about this, I have decided to try a more "directed" kind of GA:
First, I will allow the GA to run, and then choose an "elite" agent, one that fits a certain set of parameters. In my case, my target is to have agents complete the course under 5 seconds (the GA I have now, evolved agents that did it in 4.6 seconds). So, I'll just evolve them as before, *until* I get an agent that can not only complete the course, but can do it under 10 seconds.
(Assuming the GA's run is not soo lucky it gets under 5 seconds on the first run. As the first generation is randomly generated, I've seen some really fast results on the first generation... but I digress.)
This "elite" agent is then kept on, and used as a starting point for future generations. It does not directly enter the pool, but will be used as the one of the two agents to be mated for the next generation. Talk about some serious polygamy here.
The current elite is only replaced by one of its descendents when the descendent has a higher fitness score i.e. faster.
This of course leads to a more localized search of the solution, since it will evolve around the elite agent. To search further, mutation is probably the only way to jump to another possibly more optimal area.
At the moment, my mutation rate varies depending on the spread of the scores of the agents; if the agents have similar scores, the mutation rate jumps to a higher one, in order to search further. If the scores are wide spread, lower mutation will occur.
The theory I have right now is to have a low mutation rate once an elite agent is found, so the GA will explore the nearby solution space for more optimum solutions. As time goes on, the mutation rate will increase if no improved solutions are found; this will, in theory, allow the GA to gradually search further afield. Perhaps, even after X number of generations, the elite idea can be dropped and the GA can go back into the original exploration of the space without being "led" by an elite agent.
Saturday, July 26, 2014
Steerin' Behaviours
Still in the downtime between job contracts, so I'm spending it by learning new stuff and pretending to be an author. The later isn't going too well, but I have been making good progress learning more about steering behaviours!
It's great fun figuring out how all the forces react, maybe one day I can get to use it for some kinda stuff at work.
Saturday, July 12, 2014
Jos Stam's Stable Fluids
For example, the advection of the density field it was quite eye opening to see how the reverse lookup worked, and then how the sampling is done by bi-linear filtering. On the flip side, the pressure projection I really have no idea what's going on. That, was utterly a black box for me. It has _something_ do do with the gradient of the velocity field, or so it seems, so maybe another look through the code would help.
It's been fun, perhaps I can find a simple sph simulation I could cobble together.
Friday, July 11, 2014
Gray-Scott Reaction Diffusion
Unity Webplayer link here :)
Reaction Diffusion has peaked my interest on and off, and I thought what the hell, since I was on a coding high, might as well take a stab at it. I followed this tutorial, which was marvelously well explained, and got it working very quickly.
Jerry Tessendorf's iWave in Unity
Interactive build for Unity Webplayer here.
It's one of those days when you get struck by inspiration, and I was like "OMG OMG! I must implement this in Unity". So I tried, and with some luck managed to get a version of it done. The source code was attached to "Simulating Ocean Water", which frankly, most of it I am puzzling over.
Adapting the code to C# was quite straightforward, however, there was a function used to generate a 13x13 kernel that utilized a j0() function. I was like.... was that some kind of typesetting error? Some googling indicated it was a bessel function. This does not appear to be part of C#'s math libraries, but it is for C/C++. Odd. Anyways, I found - after much searching - source code for the j() function in C that I adapted for C#.
Don't really know why this kernel was chosen, and I was wondering how different kernels like Gaussian would work. Something to explore another time.
The emission also uses a kernel, but only a 3x3 grid that I put in some pre-calculated values. A better solution really, would be to interpolate between positions. Now that I've figured out stuff like this, it's time to explore other stuff!
Monday, February 24, 2014
Memories of Moto
Monday, December 30, 2013
Game Jam!
Monday, December 23, 2013
What do Cellular Automata sound like?
Alternative modulation schemes could include taking into account the number of neighbours adjacent, or even a few steps out and use that to modulate say, volume. So many ideas.
Originally, I had planned to have the vertical axis be for the notes, and the horizontal axis for instruments, but I do not want to go there as I want to quickly finish this experiment and move on to my next experiment.
Game is here.
Saturday, December 07, 2013
Subscribe to:
Posts (Atom)
