Community
Message Board

Chat room - users
Game Over
( 394431 downloads)
Work In Progress
( 523201 downloads)
Links

Code Exchange
Downloads
Tutorials
Add to Favourites

Submit news

DIV ARENA FORUMS
Not logged in [Login - Register]
Go To Bottom

Printable Version  
 Pages:  1  
Author: Subject: Challenge #1 - Falling Rock
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 15-3-2016 at 05:26 PM
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 :)
View user's profile View All Posts By User
RKSoft
Game Making Machine!
******


Avatar


Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline


[*] posted on 15-3-2016 at 06:16 PM


When is closing? I mean when should i finished my minigame?
View user's profile Visit user's homepage View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 15-3-2016 at 06:19 PM


Let's leave this open for a while, maybe a week or so?
View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 15-3-2016 at 07:32 PM


>> 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:
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 15-3-2016 at 07:34 PM


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.
View user's profile View All Posts By User
RKSoft
Game Making Machine!
******


Avatar


Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline


[*] posted on 16-3-2016 at 02:57 PM


uh, only a week? i haven't many time -.-
View user's profile Visit user's homepage View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 16-3-2016 at 03:08 PM


ok well i'll leave it open until we have a few entries :)
View user's profile View All Posts By User
RKSoft
Game Making Machine!
******


Avatar


Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline


[*] posted on 16-3-2016 at 06:16 PM


sounds better :) thx
View user's profile Visit user's homepage View All Posts By User
Dennis
Loyalty Card Holder
******


Avatar


Posts: 84
Registered: 26-2-2016
Location: Belgium
Member Is Offline


[*] posted on 16-3-2016 at 09:03 PM


I don't want to sound stupid but... where do I upload my entry ? :O



View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 16-3-2016 at 09:07 PM


you could attach a zip of it here and paste the code in [ code ] blocks
View user's profile View All Posts By User
Dennis
Loyalty Card Holder
******


Avatar


Posts: 84
Registered: 26-2-2016
Location: Belgium
Member Is Offline


[*] posted on 16-3-2016 at 09:19 PM
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 4116 times




View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 16-3-2016 at 09:24 PM


Nicely done dennis. i should have added that rocks should stop once player is dead though.

View user's profile View All Posts By User
BreadCaster
Loyalty Card Holder
******


Avatar


Posts: 321
Registered: 2-3-2016
Member Is Offline


[*] posted on 17-3-2016 at 05:12 AM


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 ~*~
View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 06:38 AM


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. :smilegrin:

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." :ninja:
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 08:59 AM


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
View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 10:39 AM
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.
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 02:04 PM


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.
View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 03:00 PM


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:
Quote: Originally posted by MikeDX  

You should post your 320.

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.
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 04:02 PM


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 4128 times
View user's profile View All Posts By User
Sandman
Loyalty Card Holder
******




Posts: 56
Registered: 26-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 05:34 PM
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. :)
View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 05:52 PM


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.
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 05:55 PM


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
View user's profile View All Posts By User
Sandman
Loyalty Card Holder
******




Posts: 56
Registered: 26-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 06:34 PM
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 4064 times
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 07:07 PM


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

View user's profile View All Posts By User
BreadCaster
Loyalty Card Holder
******


Avatar


Posts: 321
Registered: 2-3-2016
Member Is Offline


[*] posted on 17-3-2016 at 09:12 PM


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 ~*~
View user's profile View All Posts By User
 Pages:  1  

  Go To Top

Powered by XMB
XMB Forum Software © 2001-2012 The XMB Group
[Queries: 18]