Main Menu

New game idea.

Started by ScottieB, December 24, 2010, 02:19:10 PM

Previous topic - Next topic

ScottieB

Please give this a look.
The closes I've seen is a nitendo ds game but it's still not the same.
It's kinda like a reverse snake game.
It's not done but you can see the objective.
You have a time limit and you must get the bombs to safety area before all bombs go off.
I know the game ain't done but I was hopeing someone could see my idea as a good game basis.
All game started as an idea and so did this.
bombs burn wick down and they must be disposed of in time or they blow up.

I would love to see any re-makes of this idea.
It's not like the 3 million asteroids clones ect...

even snakes had it's origin ect..


Wicks and bombs is falls under what then? I don't know.
The closes someone showed me is one bomb game for nitendo ds but there where no wicks burning.


kevin


   The example graphically looks good,  but i'm really struggling with the description though.   So player would places bombs (timed ?) and these blow up walls,   Or they're meant to stop the bombs from blowing up.    Either way you probably come up with some objective based on either.     

   A possible objective could be to rescue some trapped characters by placing bombs at the right times to blow certain walls/doors up without killing the characters inside.   





stevmjon

hi

i had a look at this, and made a few adjustments to make it render faster.

the game play is still the same though. i did add an explosion sequence using sprites, with new images i made.

the way it was, adding more features would have slowed it down even more. it was running at a max speed of 75 fps on my system (quad core , 8800GT graphics card), which is basically bad for a game using only video graphics, at 800 x 600 screen size. video cards don't like drawing lots of small images, they prefer large images.

i changed it to draw one large background image, and also drew the grid to each individual image before pasting them down to the background image (this gained more speed).

see the image posted for a comparison.

hope this helps for the next person who adds to it.

   stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin


  ahh, good to see some of that wisdom passing on...


  Looking over the program, there's a lot of opportunities for using built in features (ie. Maps) or just tuning the code up so they're more efficent.

  For example, In the tile drawing loop, it's constantly pulling the tile value from the same location in the array and falling through a list of IF/THEN statement to draw blocks.    Running this is a 2d loop eats an awful cpu time.

  So the first thing to do would be remove the all the array polling and replace it by grabbed the array value into a temp variable then running the compares against that.




For y = 1 To ysize
  For x = 1 To xsize
    ThisTile=level(x,y)
     If ThisTile= 7 Then DrawImage 1,x1,y1,0   ; danger tile
     If ThisTile = 8 Then DrawImage 2,x1,y1,0   ; floor tile
     If ThisTile = 9 Then DrawImage 3,x1,y1,0   ; metal tile
     If ThisTile = 10 Then DrawImage 8,x1,y1,0  ; dirt tile under box tile*
     If ThisTile = 0 Then DrawImage 8,x1,y1,0   ; dirt tile
     
     If ThisTile = 15 Then DrawImage 13,x1,y1,0  ; top-left corner
     If ThisTile = 16 Then DrawImage 14,x1,y1,0  ; top-right corner
     If ThisTile = 17 Then DrawImage 15,x1,y1,0  ; bottom-right corner
     If ThisTile = 18 Then DrawImage 16,x1,y1,0  ; bottom-left corner
     
     If ThisTile = 19 Then DrawImage 17,x1,y1,0  ; top wall
     If ThisTile = 20 Then DrawImage 18,x1,y1,0  ; right wall
     If ThisTile = 21 Then DrawImage 19,x1,y1,0  ; bottom wall
     If ThisTile = 22 Then DrawImage 20,x1,y1,0  ; left wall
     
     If ThisTile = 23 Then DrawImage 21,x1,y1,0  ; right-intersect
     If ThisTile = 24 Then DrawImage 22,x1,y1,0  ; up-intersect
     If ThisTile = 25 Then DrawImage 23,x1,y1,0  ; left-intersect
     If ThisTile = 26 Then DrawImage 24,x1,y1,0  ; down-intersect
       
     ; Overlay and Multi-tile for trees.
     
     If ThisTile= 11 Then DrawImage 8,x1,y1,0:DrawImage 9,x1,y1,1   ; tree a
     If ThisTile = 12 Then DrawImage 8,x1,y1,0:DrawImage 10,x1,y1,1  ; tree b
     If ThisTile = 13 Then DrawImage 8,x1,y1,0:DrawImage 11,x1,y1,1  ; tree c
     If ThisTile = 14 Then DrawImage 8,x1,y1,0:DrawImage 12,x1,y1,1  ; tree d
             
     x1 = x1 + xcell
 
  Next x

x1 = 0
y1 = y1 + ycell
 
Next y 




another easy opt's would be to add a split test, 



For y = 1 To ysize
  For x = 1 To xsize
    ThisTile=level(x,y)

if ThisTile<17
     If ThisTile = 0 Then DrawImage 8,x1,y1,0   ; dirt tile
     If ThisTile= 7 Then DrawImage 1,x1,y1,0   ; danger tile
     If ThisTile = 8 Then DrawImage 2,x1,y1,0   ; floor tile
     If ThisTile = 9 Then DrawImage 3,x1,y1,0   ; metal tile
     If ThisTile = 10 Then DrawImage 8,x1,y1,0  ; dirt tile under box tile*

     ; Overlay and Multi-tile for trees.
     If ThisTile= 11 Then DrawImage 8,x1,y1,0:DrawImage 9,x1,y1,1   ; tree a
     If ThisTile = 12 Then DrawImage 8,x1,y1,0:DrawImage 10,x1,y1,1  ; tree b
     If ThisTile = 13 Then DrawImage 8,x1,y1,0:DrawImage 11,x1,y1,1  ; tree c
     If ThisTile = 14 Then DrawImage 8,x1,y1,0:DrawImage 12,x1,y1,1  ; tree d

     If ThisTile = 15 Then DrawImage 13,x1,y1,0  ; top-left corner
     If ThisTile = 16 Then DrawImage 14,x1,y1,0  ; top-right corner

else


     If ThisTile = 17 Then DrawImage 15,x1,y1,0  ; bottom-right corner
     If ThisTile = 18 Then DrawImage 16,x1,y1,0  ; bottom-left corner
     
     If ThisTile = 19 Then DrawImage 17,x1,y1,0  ; top wall
     If ThisTile = 20 Then DrawImage 18,x1,y1,0  ; right wall
     If ThisTile = 21 Then DrawImage 19,x1,y1,0  ; bottom wall
     If ThisTile = 22 Then DrawImage 20,x1,y1,0  ; left wall
     
     If ThisTile = 23 Then DrawImage 21,x1,y1,0  ; right-intersect
     If ThisTile = 24 Then DrawImage 22,x1,y1,0  ; up-intersect
     If ThisTile = 25 Then DrawImage 23,x1,y1,0  ; left-intersect
     If ThisTile = 26 Then DrawImage 24,x1,y1,0  ; down-intersect
endif       
             
     x1 = x1 + xcell
 
  Next x

x1 = 0
y1 = y1 + ycell
 
Next y 



   In the original version of the loop each tile falls 20 comparisons every for every tile.  By adding a split test, that's down to 11.   

   There's a bunch of others, but you get the idea. 


stevmjon

to kev

you have always got good ideas.

i was thinking of making that section of above code you pasted into 'select - case - end select'. i remember you saying that this is even faster than using 'if - then' statements. i didn't bother because it is only being read once in my revision02.
also, i loaded my 32 bit alpha explosion images as video. does this automatically ignore the alpha layer? i used "imagemaskcolor argb(0,90,90,90)" just in case. on my system it doesn't matter if i use argb(x,x,x,x) or rgb(x,x,x). it still displays the same.

i think more people should post their code because they could get hints from forum members and learn better techniques. not only does it help the original programmer, but it helps others as well, including myself for the above question. i experimented with something i haven't tried before.

stevmjon

It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin

#5
  I wasn't actually referring to your version,  rather more generally in terms opt'ing out redundant operations from inner loops.  As per A Crash Course In Optimization  


Quotei was thinking of making that section of above code you pasted into 'select - case - end select'. i remember you saying that this is even faster than using 'if - then' statements. i didn't bother because it is only being read once in my revision02.

  Select case resolves into a set of operations that are slightly lower priority than an IF's compare/branch statement say.   But YES, it's bound to be quicker/cleaner solution assuming the distribution of the values in Level() are ordered from the mostly likely to least likely cases.  So the tiles that are the most frequently used appears as the top cases, and the least at the bottom.

  Select has a few benefits over falling through IF/THEN statements,

    *  It's cleaner in terms of syntax  (harder to make a mistake with :) )

     *  The case matching can check many cases values at once, providing the series of cases are constants.  


   select SomeValue
         case 1
         case 2
         case 3
   endselect

 
     The VM can check all 3 cases during the single test.


   select SomeValue
         case 1
         case SomeArray(100)
         case 3
   endselect


     In this example it can't.    As when falling through the cases, it has to abort the process and go find the value that's in the array.  Making this about the same speed as a series of IF/THENS.
   

     *  When a match is found the select case structure can skip out avoiding future comparisons.  So if a tile is matched in the third case of 20, then the next 17  are jumped over.  


     The best option in terms of fixed speed for changing control with a set list of cases would probably be the "On Variable GOTO",  which would make the selections virtually a fixed speed.   But it's more setup work from the programmer.  


     Let's having a look at some benchmarking results..




Tests=5000

Do
Cls
Frames++

t=timer()
Variable=0
Counter=0

for lp=0 to tests
Variable=(Variable+1) and 7
if Variable=0 then Counter++
if Variable=1 then Counter++
if Variable=2 then Counter++
if Variable=3 then Counter++
if Variable=4 then Counter++
if Variable=5 then Counter++
if Variable=6 then Counter++
if Variable=7 then Counter++
next
tt1#+=Timer()-t
print "IF/Then Fall Through:"+str$(tt1#/frames)
print COunter

t=timer()
Variable=0
Counter=0
for lp=0 to tests
Variable=(Variable+1) and 7
if Variable<4
if Variable=0 then Counter++
if Variable=1 then Counter++
if Variable=2 then Counter++
if Variable=3 then Counter++
else
if Variable=4 then Counter++
if Variable=5 then Counter++
if Variable=6 then Counter++
if Variable=7 then Counter++
endif
next
tt2#+=Timer()-t
print "IF/Then Split Test Fall Through:"+str$(tt2#/frames)
print Counter

t=timer()
Variable=0
Counter=0
for lp=0 to tests
Variable=(Variable+1) and 7
if Variable<4
if Variable=0 then Counter++:continue
if Variable=1 then Counter++:continue
if Variable=2 then Counter++:continue
;if Variable=3 then
Counter++
else
if Variable=4 then Counter++:continue
if Variable=5 then Counter++:continue
if Variable=6 then Counter++:continue
;if Variable=7 then
Counter++
endif
next
tt3#+=Timer()-t
print "IF/Then Split Test Branch:"+str$(tt3#/frames)
print Counter


t=timer()
Variable=0
Counter=0
for lp=0 to tests
Variable=(Variable+1) and 7
select Variable
case 0
Counter++
case 1
Counter++
case 2
Counter++
case 3
Counter++
case 4
Counter++
case 5
Counter++
case 6
Counter++
case 7
Counter++
endselect
next
tt4#+=Timer()-t
print "Select/Case Branch:"+str$(tt4#/frames)
print COunter


t=timer()
Variable=0
Counter=0
for lp=0 to tests
Variable=(Variable+1) and 7
if Variable<4
select Variable
case 0
Counter++
case 1
Counter++
case 2
Counter++
case 3
Counter++
endselect
else

select Variable
case 4
Counter++
case 5
Counter++
case 6
Counter++
case 7
Counter++
endselect

endif
next
tt5#+=Timer()-t
print "Split Select/Case:"+str$(tt5#/frames)
print Counter

t=timer()
Variable=0
Counter=0
for lp=0 to tests
Variable=(Variable+1) and 7
on Variable goto Label0,Label1,Label2,Label3,Label4,Label5,Label6,Label7
Label0:
Counter++
goto Cont
Label1:
Counter++
goto Cont
Label2:
Counter++
goto Cont
Label3:
Counter++
goto Cont
Label4:
Counter++
goto Cont
Label5:
Counter++
goto Cont
Label6:
Counter++
goto Cont
Label7:
Counter++

Cont:
next
tt6#+=Timer()-t
print "On Variable Goto:"+str$(tt6#/frames)
print Counter



Sync
loop




    No surprises which one is fastest.  


Quote
also, i loaded my 32 bit alpha explosion images as video. does this automatically ignore the alpha layer? i used "imagemaskcolor argb(0,90,90,90)" just in case. on my system it doesn't matter if i use argb(x,x,x,x) or rgb(x,x,x). it still displays the same.

  The blitter ignores alpha channel.
 

Quote
i think more people should post their code because they could get hints from forum members and learn better techniques. not only does it help the original programmer, but it helps others as well, including myself for the above question. i experimented with something i haven't tried before.

 yeah, that would benefit many projects as you often see the same mistakes made over and over and over again... but then again, many people like to keep their source private.. their loss