CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: matrefeytontias on March 14, 2015, 11:52:39 PM

Title: Metal Slug: Assault
Post by: matrefeytontias on March 14, 2015, 11:52:39 PM
Hey there,

Since I apparently can't get enough of Axe, I started a new not-so-small-but-hopefully-not-so-big project: a game taking place in the Metal Slug universe.

I still don't know if it's going to be like Super Crate Box, when you're stuck on a limited stage killing everybody (and like the fights against Allen in Metal Slug), or a 'normal' Metal Slug type game with actual levels and scrolling.

It started from me wanting to recreate Metal Slug's weapons, so at least there's going to be that.

Stay tuned.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 14, 2015, 11:56:56 PM
Awesome. This seems promising, coming from you. What kind of graphics do you aim for? Will you use Metal Slug sprites or will you use Portal Prelude style?


You could just do a single stage where you must kill stuff and survive as long as possible. :)
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 15, 2015, 12:09:01 AM
I want to use sprites that are big enough to be recognizable as coming from Metal Slug, but I don't know how much that will affect performance, so I'll have to do some tests.

And I guess I could do it Zombie Gun's style, a single but large enough level and you survive to waves.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 15, 2015, 04:09:13 AM
Ah ok I was wondering since you mentionned Super Crate Box (which used no texture). It would be OK and fun to play, although IMHO to be true to Metal Slug actual sprites and textures would definitively be better. And yeah Zombie Gun is what I thought about for the level.

Just make it so it's possible to survive more than three seconds if you are expert :P
Title: Re: Metal Slug: Assault
Post by: novenary on March 15, 2015, 08:41:19 AM
Sounds like fun. Curious to see where it'll go. :)
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 15, 2015, 08:58:08 AM
After having tried to adapt some sprites, I really feel like doing it on the Nspire now :P plus it'll be better because more power means more sprites and wider levels, and I might consider doing actual Metal Slug gameplay. I'll try some more with Axe, and if I really don't feel like it I'll do it on the Nspire.
Title: Re: Metal Slug: Assault
Post by: novenary on March 15, 2015, 09:11:21 AM
Whatever platform you do it on I have it, so I wouldn't mind. :P
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 15, 2015, 09:29:24 AM
I really want to see how will you manage the graphisms, MS used to have a crapload of sprites to have very fluid and detailed animations. I'm quite interested in your project. Godspeed bro o7
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 15, 2015, 03:15:48 PM
Axe would probably be fine, speed-wise. The issue is more that with such small screen a sprite would take half of the screen height. You can always scale them down though, but as you say it might not look ideal.
Title: Re: Metal Slug: Assault
Post by: CKH4 on March 15, 2015, 03:17:21 PM
Sprite scaling like in SSBO? Dynamic camera? Even a user controlled camera like TI Boy would be cool.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 15, 2015, 09:52:06 PM
Sprite scaling wouldn't help. The problem is that the sprites are too big BUT scaling them down would screw too much detail up (I tried, it's horrible). It's kind of a no-go unless I somehow manage to draw sprites that kinda sorta look like Metal Slug characters.
Title: Re: Metal Slug: Assault
Post by: CKH4 on March 15, 2015, 10:23:45 PM
Well good luck on the sprites. I hope that you continue this project, I feel like this would be a nice addition to the calc.

Off topic: we need a giant screened ti 84 plus like the size of the cse screen but monochrome.
Title: Re: Metal Slug: Assault
Post by: Snektron on March 15, 2015, 10:39:33 PM
so... usb hacking time? or should we use the i/o port? :P
Or maybe even something with a RPI
Title: Re: Metal Slug: Assault
Post by: CKH4 on March 15, 2015, 10:42:38 PM
That would be super cool but it'd have to support Axe.
Title: Re: Metal Slug: Assault
Post by: Snektron on March 15, 2015, 10:43:32 PM
ahhhh, m8. There's always axioms :P
Title: Re: Metal Slug: Assault
Post by: CKH4 on March 15, 2015, 10:47:18 PM
Would this work http://m.alibaba.com/product/529197804/2-40-inch-Touch-panel-QVGA.html?hasRedirected=y (http://m.alibaba.com/product/529197804/2-40-inch-Touch-panel-QVGA.html?hasRedirected=y) ?
Title: Re: Metal Slug: Assault
Post by: Snektron on March 15, 2015, 10:53:01 PM
Don't know actually, i don't really do any hardware modding actually :P but i don't think
you an easily add peripherals to a calc, (especially not TI's <_<). The only options left would be
though the existing io lines, so the io port or usb :/
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 16, 2015, 09:37:04 PM
Quote from: CKH4 on March 15, 2015, 10:23:45 PM
Well good luck on the sprites. I hope that you continue this project, I feel like this would be a nice addition to the calc.

Off topic: we need a giant screened ti 84 plus like the size of the cse screen but monochrome.
I would prefer not have the same screen as the older TI-Nspire calcs. Unless you want your games to look like this:

(https://img.ourl.ca/marioblur.gif)
Title: Re: Metal Slug: Assault
Post by: novenary on March 16, 2015, 09:39:20 PM
Oh wow that looks godawful. :P
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 16, 2015, 09:40:53 PM
Yes, and grayscale backgrounds (such as Super Mario Bros Deluxe ROM) were even worse. This is why gbc4nspire frame rate was capped at 15 FPS on grayscale models, because games were unplayable otherwise, and even at 15 SMBdx was godawful).

At least the TI-83+/84+ screen isn't that bad. The TI-82 screen was rather blurry, though.
Title: Re: Metal Slug: Assault
Post by: CKH4 on March 16, 2015, 09:41:16 PM
There is like 2s pixel cooldown. That looks horrible but still, until TI decides to put a 50mhz+ processor into a calculator one with a colored screen is not something that I really want.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 16, 2015, 10:06:01 PM
Same here. Unless it was really programmable. One reason why I am reluctant about getting the 84+CE is that it seems pretty much locked down against any viable (fast enough) hybrid BASIC options.


That said, faster CPU doesn't necessarily mean faster games though. Even if matref made Metal Slug for the Nspire, it's still possible that there might be lag if the LCD driver is too slow to handle this much screen content.
Title: Re: Metal Slug: Assault
Post by: CKH4 on March 16, 2015, 10:07:55 PM
Yep, that's why Axe games are usually not in full. The LCD has trouble keeping up past a certain fps.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 16, 2015, 10:15:39 PM
Haha, trust me if I do do Metal Slug on the Nspire, there will be screen lag. I mean, just with nKaruga which is really lightweight the screen is so slow that it divided the FPS count by 3. It was stuck under 40 for a while, and when I started displaying only 1 frame out of 4 it exploded and went over 140 FPS (it still is to this day).

It's not as much a problem on the CX which has a blur-less color screen as on the grayscale Nspires, which probably have the slowest screen I've ever seen (in terms of CPU speed/screen speed ratio). On the TI-83+, the LCD is actually not that blurry if the room you're in is warm enough.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 16, 2015, 10:45:38 PM
I thought for the Nspires it was the CX that had the slowest screen? ???

As for frame rate I am fine if for a 2D game it's 15 or higher. :P At 4 FPS with so many enemies moving at the same time it might be unplayable, though. :P
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 16, 2015, 10:47:25 PM
I kind of said it wrong ; the CX has a slow-to-access screen, as in every write takes ages, but the grayscales Nspire has a slow-to-react screen, as in the write itself is fast, but the pixel takes a full second to completely turn on and then completely turn off.
Title: Re: Metal Slug: Assault
Post by: novenary on March 16, 2015, 10:48:21 PM
The CX has a slow memory bus. The monochrome has it twice as fast but the display panel itself is laggier.

Meh ninja'd by matref. ._.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 17, 2015, 03:08:20 AM
Thanks for the explanation guys :)
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 17, 2015, 05:15:23 PM
But that could be a neato Prizm project then as the new overclock settings allow us to be (relatively) on par with the Nspire.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 18, 2015, 05:05:41 AM
Indeed. I wonder how long batteries would last, though...
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 18, 2015, 06:48:11 AM
Hmm, not really long, the normal hibernation autonomy of the Prizm is around 160h IIRC. The Nspire has an advantage if using an ARM which is quite battery efficient IIRC but I still can kill the battery in one day of playing GBA games.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 18, 2015, 12:40:59 PM
Quote from: Eiyeron on March 18, 2015, 06:48:11 AM
Hmm, not really long, the normal hibernation autonomy of the Prizm is around 160h IIRC. The Nspire has an advantage if using an ARM which is quite battery efficient IIRC but I still can kill the battery in one day of playing GBA games.
Ah right. Thanks for the info. I'll definitively need to watch out if I play ASM/C games at higher speed on my PRIZM. :P As for the Nspire it depends of the OS and hardware combination. On some hardwares from early 2008, if you install both Ndless 1.0/1.1 and OS 1.1 you will get about 10 minutes of battery life when  playing GBC games due to a power management bug. On top of that turning the LCD ON will be very hard (you need to run a reboot program while the screen is disabled so it's kinda hit and miss)
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 18, 2015, 12:52:22 PM
That's enough off-topic please.

Back on the subject, I successfully implemented the "ground physics" engine I had in mind, so that means non-horizontal ground is handled seemlessly. The algorithm has a constant complexity, so 5 lines or 1000 will make no difference performance-wise :)
Also, I figured out a way of handling those collisions regardless of where the character is, so that means that virtually, no overflow can happen. In practice, that means that any level can be infinitely long, as long as the right-side coordinates fit in 16-bits variables :P

Did I mention that all of this was less than 2 kB ? ;)

I'll post a screenshot as soon as possible.
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 18, 2015, 04:15:57 PM
I really want to have some talks with you to understand the collision system, please.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 18, 2015, 05:08:22 PM
No problem, anytime :P
Title: Re: Metal Slug: Assault
Post by: CKH4 on March 18, 2015, 05:11:19 PM
Will we get a screenshot later today? That physics engine sounds impressive.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 18, 2015, 05:12:28 PM
Yeah, just the time to finish cleaning my guitar and transfer and shoot and stuff.
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 18, 2015, 05:27:21 PM
(Off topic : do you have telegram? Its a fine way to communicate on one-on-one or in group)
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 18, 2015, 05:34:04 PM
No and enough with the off-topic >_< you have PM for those questions (and SMS for instance).
Title: Re: Metal Slug: Assault
Post by: Snektron on March 18, 2015, 05:40:36 PM
Or maybe make a forum post about it (there are probably more users who want to know :P)
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 18, 2015, 05:41:20 PM
Matref please, there are more polite ways to warn people to get back on-topic than scolding them like n00bs. You should not make people scared of replying to your topics.

That said, I am amazed that you managed to fit the engine into 2 KB so far. I am curious how fast this will get with actual sprites.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 18, 2015, 05:50:20 PM
I already asked to stop with the off-topic because there's already one page and a half of that.

Well, it's really because the calculations are really light. There's one loop for finding the line and a single If block to do the calculations, and that's it for the whole frame.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 18, 2015, 08:02:09 PM
Yeah just making sure CW remains  friendly place. Anyway from what I read on IRC, don't forget to backup often. It would suck if after 2 months of development you accidentally introduced a bug you cannot repair in the engine.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 18, 2015, 08:04:12 PM
Well the problem is that I do way too many backups. Like, I erase all my working backups with backups of broken source because I backup before testing, and when I see it doesn't work it's too late. That's what happened, so I'm restarting from scratch (like I said, it's only 2 kB worth of code so it should be fast).
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 18, 2015, 08:45:35 PM
Aw, that shucks. Hope you get that fixed in no time!
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 19, 2015, 01:01:19 PM
Quote from: matrefeytontias on March 18, 2015, 08:04:12 PM
Well the problem is that I do way too many backups. Like, I erase all my working backups with backups of broken source because I backup before testing, and when I see it doesn't work it's too late. That's what happened, so I'm restarting from scratch (like I said, it's only 2 kB worth of code so it should be fast).
A suggestion I have would be to copy your backups in a different folder elsewhere like how for example I got a folder for FFMF called March 17th backup. That way, if you overwrite a good backup afterward you can simply go a few days back.

Anyway good luck matref!
Title: Re: Metal Slug: Assault
Post by: Snektron on March 19, 2015, 01:53:35 PM
i backup tool less. And if i backup i overwite the old backup :P
Title: Re: Metal Slug: Assault
Post by: novenary on March 19, 2015, 02:09:53 PM
Git ftw ? :P

Ok I know you can't exactly use it in axe but still.
Title: Re: Metal Slug: Assault
Post by: Snektron on March 19, 2015, 02:11:50 PM
I don't really like to use git unless i'm uploading source to the public / workng on a project with someone else
Title: Re: Metal Slug: Assault
Post by: novenary on March 19, 2015, 02:13:11 PM
Oh really ? I love it personally, it's very convenient.
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 19, 2015, 03:30:22 PM
Very convenient and useful. If you know enough git, you can swiotch over three (or more) feature programing, bug fixing and documenting! :p

But well, How is Metal SLug going on after the source code loss?
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 19, 2015, 03:41:11 PM
I got back to where I was, with one single bug left instead of an indefinite number like before. This one seems to be tricky though. I'll definitely post a screenshot once I fix this one.
Title: Re: Metal Slug: Assault
Post by: Snektron on March 19, 2015, 03:57:17 PM
Ah great :)
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 19, 2015, 06:00:11 PM
Alright :D finally it's fixed and working. I even show you the size of the program, how nice is that. Also, note that the size includes that fat clipped line routine I wrote and all of Axe's routines.

(https://img.ourl.ca/physics1.gif)

As I said, levels can have virtually infinite length since coordinates are converted to screen coordinates before any test that might result in an overflow.
Title: Re: Metal Slug: Assault
Post by: CKH4 on March 19, 2015, 06:03:50 PM
Oooh, that looks amazing. The size is quite incredibly small. Do you slide if the line is slanted?
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 19, 2015, 06:07:52 PM
You don't in Metal Slug, so I didn't want to implement it. I know how to do it, but I'm afraid it will slow things down too much (remember Metal Slug is a cataclysm worth of sprites).

If you want to know how to implement sliding on steep slopes, here's the theory : when an object hits a surface with a certain velocity, this velocity is reflected according to the normal vector of the surface (ie the vector that's orthogonal to the surface on the point where the object hit it), and eventually reduced according to surface hardness factors.. Steep slopes make you slide because the weight vector of the object is reflected in such a way that it pushes the object away from the surface, which then falls with augmented velocity.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 19, 2015, 06:07:59 PM
Nice Metal Slug sprite and textures. :P

Kidding aside this looks quite good and I'm glad you got slopes working. Making levels like this should spice the game up. :)
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 19, 2015, 06:10:39 PM
I know right, I worked hard on those visuals :P

Actually you won't see those lines in the final game because they are actually hitboxes, not ground. On the other hand, you'll see nicely tilemapped levels, magically matching with the underlying physics system.
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 19, 2015, 06:13:44 PM
Hehe, why not making a tilemapper which would cook the line boundbing box it self? (And how will you manage multiple lines if you ever want to do that?)
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 19, 2015, 06:16:06 PM
Because that's not possible :P and by the way there are multiple lines, I don't really understand what you're asking.
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 19, 2015, 06:17:11 PM
I meant multiple platforms on the same x position? Like floating blocks or things like that!
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 19, 2015, 06:19:46 PM
Remember that what I just did is a "ground" engine. I will only use it to handle ground, ie something you can't be under (I actually made it handle vertical walls as well). I'll have normal tilemap collisions running on top of that (obviously platforms will have to remain horizontal), that's why I wanted that one to be as lightweight and fast as possible (and trust me it is. If you look at the screenshot closely you'll notice the character is only moving left and right one pixel at a time).
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on March 19, 2015, 06:26:39 PM
Yeah, it's smooth and fast enough. With that kind of engine, slopes will be quite epic to climb up and down!
Title: Re: Metal Slug: Assault
Post by: CKH4 on March 19, 2015, 06:34:08 PM
Will we get to see the source at some point? I'd like to study it because that looks impressive.
Title: Re: Metal Slug: Assault
Post by: Snektron on March 19, 2015, 07:49:05 PM
YEah maybe it's a good idea to release it so others ay use this awesome engine :)
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 19, 2015, 08:36:52 PM
Oh those are hitboxes? Nifty matref !  :thumbsup:
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on March 20, 2015, 08:15:33 PM
Alright here's the source code (SourceCoder-compatible), and attached is the 8xp form of the source code. If you have any question, please ask.

[spoiler]
.LINEMAP

Fix 5

DiagnosticOff

[F8F8F8F8F8000000->Pic1

2->^^oCenter
3->^^oHeight

10->^^oBPL

Data(6)
Data(0^^r,10^^r,0^^r,60^^r,0,1)->GDB1MAP
Data(0^^r,10^^r,95^^r,32^^r,48,11)
Data(96^^r,32^^r,151^^r,0^^r,27,~16)
Data(152^^r,0^^r,152^^r,15^^r,0,1)
Data(152^^r,16^^r,200^^r,16^^r,1,0)
Data(200^^r,16^^r,200^^r,60^^r,0,1)

|E8000->^^oCamX+2->^^oCamY+2->^^oDX+2->^^oDY+2->^^oUDX+2->^^oUDY+2->^^oTX+2->^^oTY+2->^^oT1+2->^^oT2+2->^^oCanJump

32->^^oDec
6->^^oFriction
~4->^^oGrav
^^oDec->^^oMaxDX
12->^^oAX

0->CamX->CamY->DX->DY->CanJump

32*^^oDec->X

60*^^oDec->Y

While 1
.Display ground
For(T1,0,{GDB1MAP-1}-1)
T1*^^oBPL+GDB1MAP->T2
CLine({T2}^^r-CamX,63-{T2+2}^^r+CamY,{T2+4}^^r-CamX,63-{T2+6}^^r+CamY)
End

.X collision
X->TX+DX->X
TX//^^oDec->[r3]
X//^^oDec->[r4]
Y//^^oDec-^^oHeight->[r5]
~1->[r1]
While 1
[r1]++*^^oBPL+GDB1MAP->[r2]
If {[r2]}^^r={[r2]+4}^^r
If [r5]-{[r2]+6}^^r/32768
If [r4]-{[r2]}^^r=0 or ([r3]-{[r2]}^^r/32768+([r4]-{[r2]}^^r/32768)=1)
-1->DX
{[r2]}^^r-([r3]-{[r2]}^^r/32768*2-1)*^^oDec->X
1
End
End
End
EndIf  or ([r1]+1={GDB1MAP-1})

.Find what line the player is on
~1->[r1]
X/^^oDec->TX
While 1
[r1]++*^^oBPL+GDB1MAP->[r6]
EndIf [r1]+1={GDB1MAP-1} or (TX>={[r6]}^^r and (TX<={[r6]+4}^^r))

.Y collision
Y+DY->Y
sign{[r6]+9}->[r1]
~sign{[r6]+8}->[r2]
~({[r6]}^^r-CamX*[r1])-({[r6]+2}^^r-CamY*[r2])->[r3]
X/^^oDec-CamX->TX
Y/^^oDec-CamY-^^oHeight->TY
.Must be <=0
!If TX*[r1]+(TY*[r2])+[r3]-1/32768
->DY+1->CanJump
~(TX*[r1]+[r3])//[r2]+CamY+^^oHeight*^^oDec->Y
Else
-1->CanJump
End

.Player input
If abs(DX)<^^oMaxDX
getKey(3)-getKey(2)*^^oAX+DX->DX
End
If getKey(54) and CanJump
-1->CanJump
^^oDec*2->DY
End

If DX>>0
DX-min(^^oFriction,DX)
ElseIf DX<<0
DX+min(^^oFriction,~DX)
End
->DX

DY+^^oGrav->DY

X/^^oDec-48->[r1]/32768?-1,[r1]
->CamX
Y/^^oDec-32->[r1]/32768?-1,[r1]
->CamY

Pt-On(X/^^oDec-CamX-^^oCenter,63-(Y/^^oDec-CamY+^^oCenter),Pic1)
DispGraphClrDraw
EndIf getKey(15)
Fix 4
Return

Lbl CLine
[r1]->Z
[r2]->theta
sub(Region)->D
[r3]->Z
[r4]->theta
sub(Region)->E
0->A->B

While 1
!If D or E
+1->A->B
ElseIf D and E
1->B
Else
D?,E
->F
If  and 1
[r3]-[r1]*(64-[r2])//([r4]-[r2])+[r1]->[r5]
63->[r6]
ElseIf F and 2
[r3]-[r1]*~[r2]//([r4]-[r2])+[r1]->[r5]
0->[r6]
ElseIf F and 4
[r4]-[r2]*(96-[r1])//([r3]-[r1])+[r2]->[r6]
95->[r5]
Else
[r4]-[r2]*~[r1]//([r3]-[r1])+[r2]->[r6]
0->[r5]
End
!If F-D
[r5]->[r1]->Z
[r6]->[r2]->theta
sub(Region)->D
Else
[r5]->[r3]->Z
[r6]->[r4]->theta
sub(Region)->E
End
End
EndIf B
Return!If A
Line([r1],[r2],[r3],[r4]
Return

Lbl Region
0->C
If theta>>63
C or 1->C
ElseIf theta<<0
C or 2->C
End
If Z>>95
C or 4->C
ElseIf Z<<0
C or 8->C
End
C
[/spoiler]

Annoying : code boxes are actually not boxes, just plain formatting. It's annoying when posting long code like that.
Title: Re: Metal Slug: Assault
Post by: Snektron on March 20, 2015, 08:25:01 PM
Nice :D
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on March 20, 2015, 09:18:56 PM
Awesome. Also thanks for reminding me to fix CODE tags. I did that to see if it would let me circumvent the small code in chrome glitch in SMF, to no avail, but I forgot to revert my changes.

I'm gonna download your program when I arrive home.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on May 08, 2015, 09:31:45 AM
Alright so I decided to recode it entirely in ASM while there's not much done. So far I've got gravity and movement working and a decent display system. Next I'm going to add the hitlines thing. Also, a friend of mine decided to help me by taking care of all graphics and level design. That should be very helpful :D

(https://img.ourl.ca/newASM.gif)
Title: Re: Metal Slug: Assault
Post by: Unicorn on May 08, 2015, 07:07:09 PM
Looking good!
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on May 09, 2015, 06:31:05 AM
Ooh glad this is being worked on again. I was a little worried it might have been forgotten or something due to you being too busy with school. I wish you good luck implementing everything and hopefully your friend can help you with the graphics (and not disappear halfway through like it is the case with many projects :P)
Title: Re: Metal Slug: Assault
Post by: Unicorn on May 10, 2015, 06:46:54 AM
Wooo I'm working on this AMazing project right now and...

Ya know what, lets just disapear so this proj never finishes.

Does that happen for reals? :|
Title: Re: Metal Slug: Assault
Post by: Snektron on May 10, 2015, 08:39:09 AM
More often than you think ;D i have about 10 projects i started but never finished
Title: Re: Metal Slug: Assault
Post by: CKH4 on May 10, 2015, 01:35:43 PM
Yes it does, usually I make sure that I'm going to finish the project before I make a topic about it. Anyways I think that part of the reason matref decided to share was that I asked him about it on irc. Usually you can get an author to work on their project more by giving them an occasional poke (its bad if you poke more than once a week because they may feel like they are being bugged).

Also matref was there any benefit of moving to asm besides learning to write a game in asm?
Edit. Also I love the gravity, I can never get mine to work when I try platformers.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on May 10, 2015, 01:43:15 PM
Well I did want to write about it anyway, but I wanted to wait until I had at least something to show. Since you asked for a description, well, there you went :P

It's usually true that developers are more inclined to work on a game if they see that people want to hear about it. I think daily activity is good, but only as long as it is constructive, because if said activity can be summed up as a guy posting "what's new ?" every day, then yes it's going to be annoying.

Of course there are benefits. Programming in assembly lets you make programs that run as fast as they can get, and since the game will be pretty heavy I wanted to be able to perform a maximum of optimization. Besides, and as you said, I've always wanted to make a real game with ASM.
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on May 10, 2015, 03:40:14 PM
It depends of the person. If some people get bugged enough, it can actually produce the opposite effect or even the project demise, because some authors collapse under pressure. Hence why it's best to not do it too often. Also, when newbies bump the topic 1 year after the last update and everyone thinks a new update was posted right before, then it gives false hopes.

Also I hope you don't have too much of an hard time coding this in ASM Matref, especially with all the hit boxes and collision stuff.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on May 10, 2015, 06:18:00 PM
Don't worry about that, that's the fun part :P if it's too easy it's no fun.

Also, I successfully implemented non-vertical lines physics. In the following screenshot, imagine that the lines are there, because I'm too lazy to draw them and they won't even be drawn in the final game anyway :P

(https://img.ourl.ca/asmPrephysics.gif)
Title: Re: Metal Slug: Assault
Post by: Duke "Tape" Eiyeron on May 11, 2015, 10:08:17 AM
Nice work, pal! We can't wait to see moar progress coming!
Title: Re: Metal Slug: Assault
Post by: aetios on May 11, 2015, 10:38:43 AM
Looks very nice :D
Title: Re: Metal Slug: Assault
Post by: Dream of Omnimaga on May 11, 2015, 11:25:44 AM
Quote from: matrefeytontias on May 10, 2015, 06:18:00 PM
Don't worry about that, that's the fun part :P if it's too easy it's no fun.
they won't even be drawn in the final game anyway :P

(https://img.ourl.ca/asmPrephysics.gif)
There will be no graphics other than the square in the final version? O.O


Just kidding, nice progress you got there. I'm glad that diagonal lines did not cause too many slowdowns for collision.
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on May 11, 2015, 11:41:19 AM
Why would they ? Internally they're just like any other line.

Also, I probably said it before but the algorithm I wrote for collision has  O(1) complexity, so that's pretty cool :P
Title: Re: Metal Slug: Assault
Post by: Snektron on May 11, 2015, 03:19:57 PM
Ohh awesome :D. I want to get to know the inner workings of a physics engine too some day, even if it's just a simple one. Anyway nice progress :)
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on May 11, 2015, 04:06:37 PM
This particular "physics engine" if you want to call it that way has nothing particular, really. It's just a trick I thought of that makes use of Cartesian line equations.

I store lines as 10-bytes objects in an array, structured as follows (in parentheses are bytes) : startX (2), startY (2), endX (2), endY (2), vectorX (1), vectorY (1). I store the directional vector as left to right.
Also, I'm tempted to add a vectorC field, that would be the "c" in ax + by + c = 0, a Cartesian line equation. Right now, the equation for a certain line is calculated by vecY * x - vecX * y + c = 0, where c = vecX * startY - vecY * startX (because obviously the point (startX, startY) belongs to the line, so we know the equation equals to 0 and thus we can calculate c). As I'm writing it, I think I'll be precalculating the vectorC value for each line. It's not too much of a hassle anyway.

Here's the current algorithm (note that it's not finished) : for every entity (as in, object that must have physics applied to it) :
This algorithm is pretty good because it has no loop, pretty much. The only loop is the one that finds the correct line, but it's only two comparisons, so it's not that bad.

Because of the way it is designed right now, the algorithm does not allow for platforms because it does not allow an entity to be at the right of a line. That is pretty easy to fix though, or at least that's what I believe. The trick is to, for each line that the entity is above/below/on (there can be several platforms on top of each other), do two check steps, once before applying velocity and one after applying velocity. If the signs of the two results of the Cartesian equation are different, it means that the entity has gone through a platform during this physics iteration, and thus must be put back in place. Another small trick is to check only for the head of the entity if DY > 0, and only for its feet if DY < 0, since he moves according to the sign of DY (its Y velocity). I'll be implementing that after vertical lines, which I'm working on right now.
Title: Re: Metal Slug: Assault
Post by: Snektron on May 11, 2015, 04:24:49 PM
Oh, interesting read :) Does it have a gravity vector?
Title: Re: Metal Slug: Assault
Post by: matrefeytontias on May 11, 2015, 04:31:53 PM
Ah yeah I forgot that bit. Yeah, I have a constant that I keep adding to each entity's Y velocity.