MetalFarm2 Flash Game

not yet completed.
http://www.sketchbookgames.com/MetalFarm2/MetalFarm2.html

CONTROLS:
wasd - move
left mouse click - spray water
space bar - dig forward
space bar + up or down - dig up or down

been working on this for the last few days.
some of the art was reused from MetalFarm1

quite a few exciting things going on here.

-Rotational Joint causing sun and moon to orbit my square tile world
-sun acting as a light source (ray casts).
-water gun.
-pulling data from Google SpreadSheets
-data debug panel
-upgrades

*seeds and plants don't function yet.
*magic bag of tricks does not function yet.
*store hoping to integrate through gamer safe, not existing yet.

i hope to be able to integrate gamersafe, for achievements and buying special features...
waiting for a response from them.

hope you guys like it so far,
looking for feedback.
there is a slight unexpected bounce in the raycast lighting.

I'm pretty sure this is because the rotational joint is slowly rotating the Sun, and the ray casts are dependent on the Suns rotation.

I'll work on that tomorrow some.

-also this is not my first box2d game, but its my own project so it's one that I'm not restricted from showing it around.
I think you are getting these "bounces" due to your ray casting method. You have only a few rays, s as the sun rotates, you can see a pop each time an extra ray is obscured or unobscured.
i have a feeling it will be more "natural" if the raycasts were of a fixed rotation.
the sun obviously still needs to revolve around "world"
but a raycast facing downward should stay facing downward rather than spinning as the world changes its angle.

should be a simple math change, for the second raycast point, rather than the local to global position which uses the local angle.

I'll let you know how that progresses.

as far as how many ray-casts
its currently set to 300, but the sun is somewhat far away from the planet.
im considering writing the function so that it sub-divides more between raycasts that are hitting something.
i also need to do some filtering on the raycasts removing sensors, the hero, and water from its list of targets.

btw, thanks soo much for the raycast contribution to box2d.
once i added a zoom feature i could see that you were right borris, nothing to do with rotation.

however even at 3000 devisions it bounces some.
i will add the light to a bitmap and fade it over a few frames, and lower devisions to 100 or so.
should run smoother than 500 devisions and look better than 3000 devisions.

----edit----
-bitmap lighting now enabled
ColorMatrixFilter used just for alpha.
when the hero moves. it alphas the light faster to prevent screen bleeding.
-there may be a parent/child structure i couldn't think of to prevent screen bleeding on its own, but I'm happy with how it is here.
scaled Bitmap to (using CS3, this got past the size limit) it also might makes it lighter (fewer pixels to process), or heavier (scaling to process)

quite happy with lighting. might make it less yellow later.
Sketchbook - you should have everything except the GUI inside one big movieclip. And then move that to scroll the game. Then work backwards (screen->movieclip coords) to crop stuff for efficiency.
already scrolling the game that way.
as for cropping. do you propose just the graphics?
visible=false
or removeChild()

or do you mean also have something in mind for the physics bodies them selves?


also i may be able to rework the sun to only bitmap the data within view of the screen.

and i hope to eventually have a few quality settings to offer improved frame rates with lower quality settings (perhaps a simpler way to depict sun raycasts, and or fewer raycast devisions.)

thanks for your feedback as i was planning to increase the size of the world quite a bit, and that will be a an important feature to add while doing so.
This game was on flash game license. Played it quite a while ago. Tis good
i have not put this game on FGL.

Original thread: https://box2d.org/forum/viewtopic.php?t=3409