GamebuinoClassic archive

Archive of the Gamebuino Classic forum (2014-2018), rebuilt from the pages kept by the Wayback Machine: only part of the topics and pages were captured. Read-only. Removal on request: hi@gamebuino.com.

Forum › Project Guidance & Game development

S-COPTER, a Choplifter - Like

clement Sat Jan 03, 2015 5:50 pm
Hi,

I ve commit lastest change of S-COPTER

Image


The code is on GitHub : https://github.com/Clement83/Copter


enjoy :)


----- last post ---
Hello,

I begin a choplifter-like

some screen-shot :

Image
Image

The code is on GitHub : https://github.com/Clement83/Copter

enjoy :)
honolulu Sat Jan 03, 2015 8:17 pm Re: Choplifter - Like
Excellent !!

Great Idea !! Love this game.
clement Sun Jan 18, 2015 10:34 pm Re: Choplifter - Like
I change the style of game !

Now is modern warface choplifter ;)

Image
frakasss Mon Jan 19, 2015 10:22 am Re: Choplifter - Like
Looks great!! :)

Would be good to have the 'landscape' in grey instead of black?
Else, it will be difficult to differentiate 'obstacles' and 'landscape', don't you think so?
jonnection Mon Jan 19, 2015 8:45 pm Re: Choplifter - Like
Looks awesome! Choplifter is one of my all time favourite games.

2 ideas for you:

1) in your drawBitmapAngle, you are calculating sin(angle) and cos(angle) in every loop of your bitmap code (inside the for (i = 0; i < w; i++) { loop)

You can calculate the sin(angle) and cos(angle) only once at the beginning of the routine and store them in variables (calculer seulement une fois au debut de la routine). Then you can use those values inside the loop. That way you can save a lot of processor cycles.

2) draw another helicopter bitmap where you have the whole helicopter including windows in black (tous pixels noire, et aussi les fenetres)

then you can change the bitmap code to:

void drawBitmapAngle(int8_t x, int8_t y, const uint8_t *bitmap, const uint8_t *mask, float angle)
...
// read from mask if pixel should be drawn
if (pgm_read_byte(mask + j * byteWidth + i / 8) & (B10000000 >> (i % 8))) {
// determine colour of pixel from bitmap (black = body of chopper, white = window)
gb.display.setColor(pgm_read_byte(bitmap + j * byteWidth + i / 8) & (B10000000 >> (i % 8))); // ... or something like this
gb.display.drawPixel(x + desX, y + desY);

In this way, you can have a masked bitmap of your chopper == it will stand out from the background !

Happy coding !
clement Tue Jan 20, 2015 6:51 pm Re: Choplifter - Like
Thank for your Advice frakasss and jonnection. :D
clement Sat Jan 31, 2015 8:03 pm Re: Choplifter - Like
Hi,

I'v work on the game :

Image

Change log :
  • Core game optimisation (thank jon)
  • Take prisoner in chopper
  • Save it on base camp
  • Kill ennemies, and prisoner
  • Ennemies can kill you
  • new ennemie


I'v update Git hub repository, in the .zip you can get the S-COPTER.HEX for test it : https://github.com/Clement83/Copter

todo :
  • IA
  • Start/win/die screen
  • Rocket luncher
  • Prisoners are in jail and you need to break it to save them
  • improved graphics and readability
  • OverCharge getline
  • chopper Life in HUD
clement Wed Apr 08, 2015 7:27 pm
last update :

change log :

  • die screen
  • improved graphics and readability
  • OverCharge getline
  • chopper Life in HUD
  • the game is more difficult
  • restore life COD 'style
todo :
  • IA
  • Start/win
  • Rocket luncher
  • Prisoners are in jail and you need to break it to save them
jonnection Wed Apr 08, 2015 8:16 pm
Starting to look very nice Clement !

I also checked out your code for drawing the helicopter. It is much better optimized now, and looks better too.

One more thing:

you can replace the modulus operator (%) with a bitwise modulo in line

Code: Select all
if (pgm_read_byte(mask + j * byteWidth + i / 8) & (B10000000 >> (i % 8)))


Because in powers of 2, i%8 is the same thing as i&7. So you can write it as:

Code: Select all
if (pgm_read_byte(mask + j * byteWidth + i / 8) & (B10000000 >> (i & 7)))


http://stackoverflow.com/questions/3072665/bitwise-and-in-place-of-modulus-operator

Bitwise modulo is should be faster than the modulus operator (%), although mayber the compiler optimizes correctly.

Also, in powers of 2, division by numbers that are 2^n can be replaced by bitshifts, so:

i / 8

is the same as

i>>3

Again, it might be that the compiler does this correctly, but it is fun to know about these small tricks !

Keep on coding, looking good !
clement Mon Apr 13, 2015 6:20 pm
thx for your advice jonne!

I change it in the future version.
clement Sat Jun 27, 2015 6:57 am
HI,
I've Patched this game.

IA are more aggressive
-Jeep follow chopper
-tank bullet are affected by gravity
-half track : no change

Overcharge of the helicopter's machine gun is less frustrating.

Image
Marcus Sat Jun 27, 2015 10:29 am
I can't state enough how amazing that is. Good work! If I had your skills, my programs would be progressing much faster :-)
clement Sat Jun 27, 2015 1:32 pm
Thx a lot :D.

and I would add, if I have your skills, my games would be really more beautifull!

In this game the background are paint by my 8 years old daugther ;).


TODO list :
  • Rocket luncher in copter
  • All rescaped are visible in helipad
  • Add more sound (need to list all missing sound) in multiple chanel
Marcus Sat Jun 27, 2015 3:40 pm
Really? Then she's a good artist! :-)
erico Sat Jun 27, 2015 3:49 pm
yep, the buildings have a cool perspective.
Congrats.
Sorunome Sun Jun 28, 2015 12:44 am
IMO the buildings look weird when moving around, is that only in the gif or also on real hardware?
erico Sun Jun 28, 2015 1:05 am
Probably the flickering grey from the emulator but I haven´t tried on the real hardware to make sure.
clement Thu Jul 02, 2015 4:45 pm
The gray is not very good in real hardware too.

But it is better than emulator.

The original picture from my daugther :
Image
Marcus Thu Jul 02, 2015 4:49 pm
Awesome :-)
erico Thu Jul 02, 2015 5:16 pm
Building´s perspective and colors are awesome!