The Daily Click ::. Downloads ::. Miscellaneous ::. Simple Smash Bros Engine
 

Simple Smash Bros Engine
Author: Pixelthief Submitted: 16th October, 2007 Favourites:0
Genre: Miscellaneous Downloads: 446
Rated:


This is a very simplistic, open sourced TGF super smash bro's style engine that I cooked up in the last couple hours. It is a fairly tight platform engine that can handle pretty titanic velocities applied to the character before he can clip through a wall or anything else that might break the physics, AS well as running at 50 FPS.

*Runs at 50 FPS
*Has handle for imput of simply X-velocity and Y-velocity to apply to the target
*Supports variables friction, bounce constants, and gravity
*Fully function edge-grabbing
*Velocities and accelerations are subject to a damage percentage, allowing for weaker characters to fly farther.


Bear in mind, it requires Fastloop, Advanced Math Object, 1000 variable object, and Drawline, all of which are included in the zip (put them in your GFACT32 folder)


Feel free to use this in any projects; it might need a bit of polishing up; I didn't do anything to stop characters that hit a ceiling from being projected 16 pixels left/right due to the fast-loop displacement, like I did with characters hitting the ground.

I might make something, myself

Review This Download



 


http://claniraq.googlepages.com/Smash.zip (132 kb )



Posted by Pixelthief 16th October, 2007

Oh, and controls are:

Shift: Jump/DoubleJump
Arrow Keys: Move

Left click anywhere to apply a force to the character (amplitude is based off of the distance to the character, and his current %damage)
 
Posted by DaVince 17th October, 2007

The ultimate solution that makes a character NEVER clip through a wall: don't push him back afterwards, but prevent he can even get stuck so far in the first place.

How? Fastloop on the gravity. (start loop "add to Y" GRAVITY amount of times; on loop "add to Y": set Y to Y+1, plus collission detection code)

Um, I haven't even checked your engine yet. Time to check!
 
Posted by DaVince 17th October, 2007

Oh bah, I can't. I only have MMF2 demo available right now, and there's no fastloop extension for that. Compiled version please?
 
Posted by Pixelthief 17th October, 2007

I actually implemented a complete "move 1 pixel at a time" in fastloop code, but it reduces the FPS to 30 with just a single character using it. So this is the best I could do while keeping it tolerable in terms of FPS.


Compiled:
http://claniraq.googlepages.com/Smash2.zip
 
Posted by Pixelthief 17th October, 2007

Anyway, the problem with the "safe movement" idea of moving 1 pixel at a time and checking for collisions, is that while you only need to move perhaps 30-40 pixels per frame, thats 30-40 times you need to run through a loop and check for all directions of collisions, running 50 times a second. Overall it stacks up a ridiculous amount of CPU usage.
Its basically the concept of a posteriori v a priori, and 99% of all computer games ever made are forced to use a posteriori. So simply tricks such as limiting the maximum velocities, so that the character can not physically clip far enough to set off multiple detectors do the job with no noticable difference. I was just lazy and forgot to implement a check for ceiling based collisions like I did with the bottom.

A more standard approach, taken by alot of modern games and physics engines, is to record the position before each update, and if an update would place the character INTO a wall, it moves back to the previous step.

I probably should have implemented that, and I may very well if I actually make a game out of this. The method I used was really just a cheap trick; I did an extremely basic "if bottom detector is in wall, move character up" kind of fast loop to offset. Obviously, this becomes a huge problem if more then 1 detector is in a wall; for example both left and right become lodged. So my workaround was to only let the "pusher" loops run if the characters velocity was headed in the opposite direction; if you are moving right, it wont ever push you right, just left/top/bottom.

I might post a rebuild if I modify it to use a position track sort of offset
 
Posted by Dr. James MD 18th October, 2007

Doesn't want to open in MMF2? 1000gv problem.
 
Posted by Pixelthief 18th October, 2007

I made a new, much more stable version:
http://claniraq.googlepages.com/Smash2.zip
 
Posted by DaVince 19th October, 2007

That worked pretty well! Thumbs up.
 
Posted by Bibin 19th October, 2007

OH god no, that's not how you do a fastloop engine. You don't use a fastloop to check things! You use it to move him in the first place.
 
Posted by Pixelthief 20th October, 2007

Eh? The fastloop is only activated when he collides with a wall to prevent clipping. In the updated engine, theres no fast looping at all.

I don't see how fast looping would help move him in the first place; he would still be moving 30-40 pixels at a time with a decent velocity, irregardless of if its in a loop or not. If I did an algorithm to move 1 pixel at a time, it would lag horribly as it eats up CPU usage (already attempted).

The updated version I have really works quite well.
 
Posted by Zephni 26th October, 2007

~ Loops only when it needs to..

+Repeat while left or right is pressed
-Start loop "Xloop" Abs(AltValX("Detector")) Times.


Sets back one pixel until not touching backdrop..

+On loop "Xloop"
+"Detector" is overlapping object
-Set "Detoctor" X position to;
X("Detector") + (0-AltValX("Detector"))/Abs (AltValX("Detector"))
-Stop Loop "Xloop"
 
Posted by Zephni 26th October, 2007

~ Therefor its running the loop before he touches the wall..

Alough i duno what you meen Bibin bout actualy moveing the character with fastloops.. Maybe i misunderstood.. coz that too seems quite uneccersary..


(Edit) OH! and just incase any one fort that the diamnod active object IS the collision detector and they saying that THATS clipping.. i think there wrong.
 
Posted by Airflow 14th March, 2008
Rated :

nice engine!
 
Posted by Devernath 15th March, 2008
Rated :

It be even cooler if you made the backgrounds spin.
 
Posted by Piqutchi 21st September, 2013

Is there any way to open this in MMF2?

I just can't find the required extensions!
 

 



Author

Favourite



Advertisement

Worth A Click