Pages:
1
2 |
MikeDX
|
|
Challenge #1 - Falling Rock
Make a falling rock game in the fewest bytes of code:
requires:
- player spaceship (controlled via mouse OR keys) which is destroyed when rocks hit it.
- bullets fired from player
- rocks / enemies falling from top of screen - destroyed when hit by player bullets
whitespace (spaces, carriage returns) and comments do not count, so no need to minify your code)
you can use any graphics you like, but if you made them in the div editor, thats best
Smallest code wins.. I'll submit my entry in a few days
|
|
RKSoft
Game Making Machine!
Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline
|
|
When is closing? I mean when should i finished my minigame?
|
|
MikeDX
|
|
Let's leave this open for a while, maybe a week or so?
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
>> Smallest code wins.. I'll submit my entry in a few days
Should all the entries be revealed at the same time?
And considering code minimification; aren't variable names going to matter? :autism:
|
|
MikeDX
|
|
The variable names will matter yes!
I don't think it's too bad to show entries as they are created...
If this format doesn't work, we'll change it to an "upload" method.
|
|
RKSoft
Game Making Machine!
Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline
|
|
uh, only a week? i haven't many time -.-
|
|
MikeDX
|
|
ok well i'll leave it open until we have a few entries
|
|
RKSoft
Game Making Machine!
Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline
|
|
sounds better thx
|
|
Dennis
Loyalty Card Holder
Posts: 84
Registered: 26-2-2016
Location: Belgium
Member Is Offline
|
|
I don't want to sound stupid but... where do I upload my entry ? :O
|
|
MikeDX
|
|
you could attach a zip of it here and paste the code in [ code ] blocks
|
|
Dennis
Loyalty Card Holder
Posts: 84
Registered: 26-2-2016
Location: Belgium
Member Is Offline
|
|
Score: 237 (confirmed by Mike)
Ok. I may even inspire others with my code. It's not very enjoyable to play but it seems to work :P
Code: |
program a;
begin
load_fpg("a.fpg");
p(1,1,1,180);
loop
p(9,3,rand(0,320),0);
frame;
end
end
process p(t,graph,x,y)
begin
repeat
if (t==1) x=mouse.x;
if (mouse.left)
p(-5,2,x,y-9);
end
else
y+=t;
end
frame;
until((collision(type p) and (t==1 or t==9)) or y>220 or y<-9)
end
|
Attachment: a.zip (2kB) This file has been downloaded 4169 times
|
|
MikeDX
|
|
Nicely done dennis. i should have added that rocks should stop once player is dead though.
|
|
BreadCaster
Loyalty Card Holder
Posts: 321
Registered: 2-3-2016
Member Is Offline
|
|
Does it have to be both a falling rock game, and also good/engaging? If so then this is a game design challenge, if not it's a programming one :p
~*~ Princess of Pies and Pastries ~*~
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
Quote: Originally posted by BreadCaster | Does it have to be both a falling rock game, and also good/engaging? If so then this is a game design challenge, if not it's a programming one :p
|
The definition for good/engaging in this case is fewest bytes of code.
Then again, it might be nice to be able to say "whatever, it's still much better to play than that thing Dennis did. Dennis' thing is just small."
|
|
MikeDX
|
|
Quote: Originally posted by BreadCaster | Does it have to be both a falling rock game, and also good/engaging? If so then this is a game design challenge, if not it's a programming one :p
|
No I already did the design
Anyway Dennis is winning :P
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
Score: 204 (Confirmed by Mike)
I thought I'll give it a go and whoa! It compiled! ...apart from parameters for signal() and I may have checked mouse stuff from the manual before
compiling. BUT it was 320 chars and on top of that less optimized performance wise than Dennis'. :') I hate your genius Dennis.
So, I optimized Dennis' code somewhat further and it's now at 203.
Code: |
program a;
begin
load_fpg("f.fpg");
p(1,1,1,200);
end
process p(t,graph,x,y)
begin
repeat
if (t==1) x=mouse.x;
if (mouse.left)
p(-5,2,x,y-9);
end
p(9,3,rand(0,320),0);
else
y+=t;
end
frame;
until(collision(type p) | y>240 | y<0)
end
|
Maybe someone can skim it even further? If you were to go evil and take the off screen optimization out, which is not needed per rules, the score
would be at 194.
|
|
MikeDX
|
|
Quote: Originally posted by iWizard | If you were to go evil and take the off screen optimization out, which is not needed per rules, the score would be at 194. |
Well, you could but then div would (eventually) crash and then you'd probably be disqualified.
I can see a couple ways to trim a few bytes off even this implementation so there's still room for improvement with some hacking.
You should post your 320.
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
Quote: Originally posted by MikeDX | I can see a couple ways to trim a few bytes off even this implementation so there's still room for improvement with some hacking.
|
Yay, so we will see yet another implementation. What could it be? Did DIV allow one line IFs, ie without an END? Maybe something with the choise of
loop? Or maybe bit shifting? Nobody but asm-autists know about bit shifting! And in DIV? D:
The mystery 320 is pretty much that with own processes for bullet and rock. And I noobisly initialised video mode. But even my fpg used the same graph
codes :3 Yeah, I didn't put much thought on to the challenge itself - just happy that it ran and enjoyed how simple the code seemed.
|
|
MikeDX
|
|
I've got this down to 198, using a new fpg and some dirty tricks.
Code: |
program a;
begin
load_fpg("f");
p(1,1,180);
end
process p(t,x,y)
begin
graph=abs(t);
repeat
if(t)
x=mouse.x;
if(mouse.left)
p(-8,x,y-9);
end
p(6,rand(0,320),0);
else
y+=t;
end
frame;
until(collision(type p)|y>240|y<0)
end
|
Attachment: a198.zip (2kB) This file has been downloaded 4184 times
|
|
Sandman
Loyalty Card Holder
Posts: 56
Registered: 26-2-2016
Member Is Offline
|
|
Score: 1 million (disqualified)
Nice tricks done here. Awesome start, Dennis!
Code: |
program a;
begin
load_fpg("f");
p(1,1,9); // 180 can be 9, makes it rather unplayable though...
end
process p(t,x,y)
begin
graph=t*t; // you need to update the fpg with the new code here
repeat
if(t)
x=mouse.x;
if(mouse.left)
p(-8,x,y-9);
end
p(6,timer%99,0); // Don't like this, one, but as per rules, rocks don't NEED to be spread out when falling
end
y+=t-1; // shaved off the else
frame;
until(collision(type p)) // like iWizard said, the y comparisons can go as per rules. Not a big fan of it either.
end
|
Try that.
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
I think BreadCaster's note is soon starting to become rather relevant.
And on that bombshell it's time to conclude that the mystery 320 char code wins.
|
|
MikeDX
|
|
Quote: Originally posted by Sandman | Nice tricks done here. Awesome start, Dennis!
Code: |
program a;
begin
load_fpg("f");
p(1,1,9); // 180 can be 9, makes it rather unplayable though...
end
process p(t,x,y)
begin
graph=t*t; // you need to update the fpg with the new code here
repeat
if(t)
x=mouse.x;
if(mouse.left)
p(-8,x,y-9);
end
p(6,timer%99,0); // Don't like this, one, but as per rules, rocks don't NEED to be spread out when falling
end
y+=t-1; // shaved off the else
frame;
until(collision(type p)) // like iWizard said, the y comparisons can go as per rules. Not a big fan of it either.
end
|
Try that. |
DIV Crashed after a while.. and you didnt supply the fpg, also unplayable. disqualified :P
|
|
Sandman
Loyalty Card Holder
Posts: 56
Registered: 26-2-2016
Member Is Offline
|
|
Score:189 (Confirmed by Mike)
Unplayable games are still games, though. Also don't play it so long, you have better things to do! Here's a cut down version anyway:
Code: |
program a;
begin
load_fpg("f");
p(1,1,99); // 180 can be 99
end
process p(t,x,y)
begin
graph=t*t; // smaller way of abs
repeat
if(t)
x=mouse.x;
if(mouse.left)
p(-8,x,y-9);
end
p(6,timer%99,0); // Don't like this, one, but as per rules, rocks don't NEED to be spread out when falling
end
y+=t-1; // shaved off the else
frame;
until(collision(type p)|y>240|y<0)
end
|
Attachment: bla.zip (2kB) This file has been downloaded 4114 times
|
|
MikeDX
|
|
Quote: Originally posted by Sandman | Unplayable games are still games, though. Also don't play it so long, you have better things to do! Here's a cut down version anyway:
|
I dunno, unplayable games are just animations.
Liked this version better. Some good hacks there
|
|
BreadCaster
Loyalty Card Holder
Posts: 321
Registered: 2-3-2016
Member Is Offline
|
|
also uh, why have people not just made the shapes/graphics using the draw commands? :S I mean this is a totally uninteresting sort of topic to me
because i'm not logically minded enough to program much, let alone program things efficiently, but is there some reason everyone is using an fpg or am
i just missing something here
~*~ Princess of Pies and Pastries ~*~
|
|
Pages:
1
2 |