-
Advanced Programming
Hey guys, I have a concept or two that I am not completely sure how to implement into my games. I will ask each concept individually and will work my way from simplest to most complex.
1.) Custom Gravity - Is there a way to always tell the player to have his feet facing a specific direction and always fall in that direction if in a specific area?
Basically, Mario Galaxy gravity. I would like the ability to walk around in perfect circles if need be. Any ideas?
2.) Physics - I have asked about this in chat and was told it is impossible. I'm sure it is not for a flash game. Is it possible to implement 2D sidescroller physics to objects. So if an object hits another, it will respond accordingly? For instance, your character is moving at a specific speed and runs into it, I would like to to move/roll based on size, shape and the speed of the character. Also the ability to affect the density of that object would be nice.
3.) Particle Manipulation - For instance, I have what looks to be a pool of water. It is composed of a large amount of tiny particles. Is it possible to 'pull' up the water in the pool to react to the mouse as if the mouse was pulling at the water and have different reactions? One time, the water may come up and stop at a point, or another, it may come up at a rounded edge. Any ideas?
4.) Mass distribution, filling - Ok, this is my last and most complex issue. I want to have water fall from any source and hit the ground. Doesn't sound too hard right? I want when the water hits the ground, to actually spread out and detect how far away in both directions an object is and to continue to spread to those objects. Once it has spread to those objects, the water level will 'rise' until the source of liquid has stopped. I need the particles to be programmed in a way that I can use them as a source (without lagging the machine in a flash game) to fill that area and possibly overflow if no more water is touching it. The amount of time it takes for the water level to rise will be dependant on how far about the 2 objects that are 'containing' the water are from each other. In my case, a backdrop used as an obstacle.
-
Re: Advanced Programming
1: Theoretically, but you'd need to code it yourself.
2: 3: 4: Not in MMF, sorry.
-
Re: Advanced Programming
Of course 2) is possible. There are two physics extensions available that allow this. I would recommend Phizix - Box 2D (the other being Phizix - Chipmunk), which I am also porting to the Flash runtime myself.
-
Re: Advanced Programming
3: 4: Performance allowing, surface object + fast loops? Or lots of tiny actives (like that falling sand example ChrisB did years ago)
With HWA this is certainly more possible.
-
Re: Advanced Programming
Sorry, I misread 2 as you wanting it for a flash game. Looki's right, it is possible normally.
-
Re: Advanced Programming
These are all quite complicated things that could take some time to understand. Each would take large amounts of coding, engines unto themselves.
Mario Gravity:
This is how it works:
http://www.gamasutra.com/view/feature/3593/games_demystified_super_mario_.php?page=1
Heres an example in MMF2:
http://create-games.com/download.asp?id=7299
Basically it works by finding the surface normal of the position your character is standing at, which would require some algorithm to find the surface normal. Like the one I posted here:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=207486#Post2074 86
Beyond that its nothing more complicated than any other platforming engine.
Physics:
The only way to do physics is to have the entire interactions of physics coded, ie a physics engine, like havok or whatever else. You can do this yourself, but its a very time consuming project. Theres nothing simple about it- its just exhausting work of modeling how objects interact through different formulas. No tricks to go about it.
There are already existing physics engines, including some for MMF2
Particle Manipulation & Mass Distribution:
These are done by modelling these objects as discrete interactions, rather than model each finite object. Its impossible for modern technology to model the interactions of every particle of water in a pool- instead cheap tricks are used to give likenesses of how these work. Even in modern games, these are often the most basic cheap effects, like having the water level simply be a value that rises over time in some scripted event, and then have the water valve shut off. Nothing fancy, no physics going on.
More complicated water 'effects' typically just do things like adjust the surface of a pool along some kind of wave mapping array, just for example having the surface vertices adjusted dynamically according to wave reflections inside of a pool. These again don't model actual water physics, but instead just give basic facsimiles only of the graphics, not the underlying physics.
-
Re: Advanced Programming
Thanks for all the responses guys.
Just to clarify the particle manipulation, I mean to give an example as I am not 100% how to explain in words.
Though a bad picture, imagine the water is made of particles. I want that when the user swipes his mouse pointer (while holding the left click button), for some of the particles to attract to his pointer and give an alike effect. Because of this specific point, it will have an impact on gameplay, for instance, the spike will hurt an enemy. I apologize for my lack of time to produce a decent image.
[img:center]http://grab.by/8sj5[/img]
-
Re: Advanced Programming
Thats the difference between having your water count as 'particles' and having it a single object who is simply stretched to look like particles. For example, you might have the water drawn as a polygon, normally a rectangle showing it at rest. When it is spiked upwards, it becomes a 5 sided polygon, using a new vertex at the spike point.
-
Re: Advanced Programming
You won't do it as particles in MMF, but you could just animate it easily enough.
-
Re: Advanced Programming
You won't do it as particles in any language, actually. Unless you want it to take 2 hours to render 1 frame