Battleships for Arduboy!

My little project, that’s how far i came today.

https:/uploads/arduboy/original/2X/7/7d6c54faf009c490bd7e55057c2dc9b7fff2a138.mp4

I love this little boy.

11 Likes

Graphics look cool:) lol but wait till the little squares pop up for the actual game play;)

I looking forward to this btw:)

2 Likes

I need to post more WIP, i rly love this little thing.

Added a VS screen which show who plays. Enemy is picked randomly.
Love the animations.

https:/uploads/arduboy/original/2X/1/1c6a18414e1d4b8b09407f7c739d6191c4ca3801.mp4

2 Likes

Could you show me how you did the graphics?

Sure,

The characters, the ship background and the VS-symbol are made in Photoshop then exported to this great tool for chrome.
Here s a sample project with a photoshop file War themed 8x8 sprites

All other animations as the selected BG and the swipe stuff are made by code.

1 Like

More progress!

This time HUGE changes. Only the game logic itself is missing.
Sadly i reached 98% memory so i needed to kick one artwork.

Also i never coded something this low level so i have no idea about code optimization so i could lower the size.
I will need to kick more bitmaps which wouldn’t be a problem if there where a smaller font since a couple of my assets are only there for UI… xD

Hope i can finish it on the next weekend! :metal:

https:/uploads/arduboy/original/2X/1/13a28e0ffa171d564ffda39e188243859c94fd20.mp4

1 Like

Are you using the Arduboy library and do you use arduboy.begin(); in setup()? If so, you can gain back a bit of code space by eliminating the ARDUBOY boot logo that scrolls down before your code starts. Replace
arduboy.begin();
with
arduboy.beginNoLogo();

4 Likes

Yeah thank you, i know that, but i like this logo so much. <3 It belongs there like the gameboy logo on the original gameboy!
So i will use it as last resort but will try to safe space elsewhere. xD

2 Likes

So i rewrote the game the past couple of days without using any lib functions like print/drawLine/fill/whatever.
I’ll replace all things i did with them with sprites as far as it works.

Until now i’m down to 22 kb which is great. Now i have around 6k left which should be enough for some nice sounds or whatever.
I’ve also had an idea to switch from an 8x8 tileset to a scrolling 16x16 one which would only cost 384bytes in asset data more and possibly looks way cooler.

Anyway, now i have to wait for my new arduboy to continue, since right now i’m doing everything in the dark without testing. :sweat_smile:

3 Likes

I really want to get rid of memory restrictions! It’s for sure a challenge to make things small but it also makes other things impossible. Keep up the amazing work!

2 Likes

But it also help to find creative methods to save space for more cool stuff. :slight_smile:
Anyway i understand you and yeah it would be great to have a bit more room…
I wish i would be possible to optimize the whole draw methods so they won’t eat up that much.
Sadly i have no background in such low level graphic coding so i could help, don’t even know if it’s possible. :frowning:

2 Likes

New Arduboy arrived! back to coding :smiley: So glad.

2 Likes

I’m so frustrated. Weird things are happening and i don’t know why.

I have started to rewrite the whole game class based which is really nice but the arduboy keeps restarting at some random (reproducible) point. Sounded like an memory issue but i don’t believe that use that much RAM.

Then i tried to run it with the Arduino IDE (I’m coding entirely in PlatformIO) and the the game stops at the Arduboy-Logo.

This is really really frustrating because i’m just debugging for two weeks and i don’t know what’s the reason for this.

Can anyone look over my code and help me?

Here’s the repo.
To run it on Arduino IDE simply cpy the /src folder and rename it to BattleshipAdvanced.
Pls don’t clone it if you expect a working game.

Update 1:

Well now i have tried freeMemory() which magiclay returns me how much RAM is free. Sadly it returns magic values (it starts with 40, dunno if potatoes, percent or whatever. If it’s really just 40 bytes left, then something else wrong since i tried it in an empty sketch only with an arduboy instance) but i see it shrinking while i going deeper in the methods down to 90.

Update 2:

My mistake, in a fresh sketch freeMemory() says 1270, which is fine. so it’s definitely my class and code wich eats all RAM. - DAMN it’s so hard to debug this :cry:

Update 3:

I just noticed that 1270 byte free is not alright in a clean sketch just with an Arduboy instance.
Does the arduboy system really eats the half RAM?!

Update 4 FIXED!!!:

Wow really dumb issue which i finally have fixed after 2 weeks.
I’ve initialized a second instance of arduboy instead of referencing it. Sadly the Arduboy lib uses up 1 whole KB of Ram.
freeMemory() is very handy for debbuging.

3 Likes

i think sketch have double Arduboy Memory(BAInput and BAGame).
it is double sBuffer.

unsigned char sBuffer[(HEIGHT*WIDTH)/8];

https://github.com/yinkou/BattleshipAdvanced-Arduboy/blob/master/BattleshipAdvanced/src/BAInput.h#L49
https://github.com/yinkou/BattleshipAdvanced-Arduboy/blob/master/BattleshipAdvanced/src/BAGame.h#L67

i fix BAInput.h and some souce code.

before:

Arduboy arduboy;

after:

Arduboy *arduboy;

i can see title screen.

edited: oops my advice is too late :slight_smile:

3 Likes

Nevermind, i really appreciate the help! <3

2 Likes

@akkera102 may you tell me how you did find it so fast?
Do you have some nice tools i don’t know about or are you just a genius? :wink:

i dont use nice tools. lol
only // and any functions.

first, i found freeze arduboy title. so i look for normal running point.

BAGame::BAGame(){
  arduboy.begin();
  arduboy.setFrameRate(30);
  arduboy.initRandomSeed();
  arduboy.audio.on();

//  arduboy.clear();
//  arduboy.display();

  // init input
  // input = new BAInput(arduboy);    // <---- bug??

  arduboy.clear();     // <---- Arduboy "runed" clear screen
  arduboy.display();

  activePlayer = NULL;
  opponentPlayer = NULL;
}

if Arduboy use BAInput, it broke.
I write BAInput instance of all comment out.

BAInput::BAInput(Arduboy &arduboy){
  // fireContinuous = false;
  // refireAfterMillis = 500;
  // this->arduboy = arduboy;
  // reset();
}

but it broke… why? why? i see header file.

class BAInput{

  ....

  private:
    BAButton buttons[6];
    Arduboy arduboy;
}

It was often seen. not pointer!

i found answer. :grin:

4 Likes

hahaha nice, simple as that :smile:. I failed for about a week. :sweat_smile:

3 Likes

soooooooooooooooo any progress? im eagerly awaiting this one

1 Like