RPG game + LED pixel game system hardware

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

User avatar
Saimaster13
I practically live here!
I practically live here!
Posts: 176
Joined: Mon Aug 13, 2012 4:23 am
Location: Sarasota, Florida
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by Saimaster13 » Fri Nov 02, 2012 2:40 pm

I looked at the FAT SD card websites, but couldn't figure out how to use them. What I will probably end up doing is having 3 different save options: internal eeprom, external eeprom, and SD card. If the game ends up not taking up too much memory, this will allow for a UNO version. It may need to be toned down a bit, and may not have as many features (definitively won't have the SD thing, unless I can find a low memory one), but it should be mostly the same.

Also, I got an N64 controller hooked up to the Arduino and was able to control my character with it. I think I figured out how to use multiple N64 controllers, so I'll try that tomorrow.

As for coding, I haven't gotten too far. I made the enemies easier, swords now knock back enemies, and I made a small grocery store. Hopefully I'll get a lot into coding pretty soon, although it would be easier with bigger displays (which I am waiting for the parts to come for.)

Overview:

controllers:
*able to have my custom controllers or N64 controllers
*ability to choose which type of controller is not fully coded
*ability to choose and code your own controllers (NES, SNES, etc.) not fully supported (but will be)

screen:
*still a lame-ish 8x8 bicolor display
*coded to show a 7x7 screen
*waiting on parts to upgrade (should be a few weeks)

LCDs:
*they are there.
*only 2 fully coded in, but to add the other two, the only thing needed to do is define their enable pins (in other words it'd be super easy to hook them up and they are fully supported, but I just haven't physically hooked them up yet.)
*pretty much done, only thing left would be to take them off the breadboard and put them on a circuitboard.

Code:
*enemy AI is not very smart, but I am currently okay with how they are and may or may not change them before the game is finished
*almost all values are able to be redefined (enemy and player health, movement speed, immunity time, etc.) - which will make it easy to integrate "better swords" (more damage done, knockback, or etc.) and respawning waves of enemies (like a survival zombie type thing... only... with dots.)
*I believe the level designing is poor (I do not believe I am very good at it)
*the fighting style needed to do well in this game is rather unique and takes some getting used to.
*pretty stable code, a few glitches when enemies knock you back (if you run towards them, sometimes they knock you forward through them, but it doesn't really matter)
* frame rate at ~70fps with the one 8x8 screen - I am scared it will drop too low with more coding and screens, but for now, this frame rate is very good. If it drops too low, I was thinking I would use Arduino to Arduino communication with the main Arduino constantly telling the other ones what their cathode data should be. This will actually not make the fps any better, but it hopefully should eliminate any potential flickering of the screen caused by low fps.
*code needs a bit of cleaning up here and there, but a lot of it is cleaned up already
*a few house interiers (like player 3 and 4's houses) are planned but still need to actually be added
*story line needs to be developed and improved
*a grocery store was added with items, enemies, and the ability to walk in and out of it. However, the items currently do not do anything and need to be coded in. Also, it is planned that after the enemies are defeated, a few waves of stronger enemies will "walk" into the front of the entrance (a few waves of increasingly harder, but not by much, enemies.) This feature needs to be coded in along with a reward for killing them.

And I believe that is pretty much it. I'll look into making a video soon if you guys are interested. However, to really expand the game, I believe a better screen needs to be added so it is easier to tell who is who and what is what.
Joshua

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by brad » Sat Nov 03, 2012 8:58 am

Thanks again for the update :)

Once again I am amazed at how much you have been able to do in such little time.

I unfortunately have not been able to get your level editor fixed up yet, I just haven't found the time to do it. Make sure you let me know if you would really like it to be done by a certain time and I will see about finishing it off for you. It shouldn't take me long but if I have certain deadline then it would give me some motivation :)

If you were interested in making this onto a circuit board, we could help you get started in the PCB design software (which is free for a limited number of component pins - but the free version would be more than enough for you project) The program is called diptrace. After using it for probably 10 - 15 mins you would be well on you way to easily designing a board for it.

You can then get boards made up from itead studio. you can get 10 x (10cmx10cm) boards for around $30 delivered. I would be keen to give you $10 to put towards getting the boards made. if I could get just one of those boards :)

By the way - great idea to have a store! you could even make it so the player loses some health over time if he does not get to the store to buy food / drink etc... or maybe he just loses some attack strength from being a bit weak...

User avatar
Saimaster13
I practically live here!
I practically live here!
Posts: 176
Joined: Mon Aug 13, 2012 4:23 am
Location: Sarasota, Florida
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by Saimaster13 » Sat Nov 03, 2012 10:06 am

you could even make it so the player loses some health over time if he does not get to the store to buy food / drink etc... or maybe he just loses some attack strength from being a bit weak...
Actually, the store is filled with cannibals and is ransacked... another store with food to buy is a pretty good idea though. As for the consequences of not eating, I was thinking of harsher penalties, like dying if you go too long without food (but I would be sure to give the player plenty time to actually get the food before they die.) This would add to the sense of a starving world and force you to move forward, although I would make sure the player has enough time to search through everything without starving to death.

As for the map editor thingy, I'm starting to get to the point where it would be very helpful if I could use it. I should be receiving the MEGA in around a week, so it'd be great if you had it done by then.

p.s Just a reminder, the map is made up of 64 bits per line and has 48 lines. Each line is made out of 2 unsigned long datatypes like this:
0b10000000000000000000000001010000, 0b00001000001001110000000000011111, //line 1
0b10000000000000000000000001010000, 0b00001000001001110000000000011111, //2
0b10000000000000000000000001010000, 0b00001000001001110000000000011111, //3
0b10000000000000000000000001010000, 0b00001000001001110000000000011111, //4
0b10000000000000000000000001010000, 0b00001000001001110000000000011111, //5
...
...
0b10000000000000000000000001010000, 0b00001000001001110000000000011111, //47
0b10000000000000000000000001010000, 0b00001000001001110000000000011111, //48
So 64 wide and 48 tall total.




p.p.s. If you could also make another one that translates 16x16 bits, which would look something like this:
0b0000000101000010, //line 1
0b0000000101110010, //2
...
...
0b0111100101000010, //47
0b0111100101000010, //48


then that would be great, but this is NOT as important as the main one (this one would be used for animations on a 16x16 screen.)
Joshua

User avatar
Saimaster13
I practically live here!
I practically live here!
Posts: 176
Joined: Mon Aug 13, 2012 4:23 am
Location: Sarasota, Florida
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by Saimaster13 » Sat Nov 03, 2012 12:40 pm

I was able to get one N64 controller running, but trying to get 4 working has been pretty rough. With my adaption of the code to 4 controllers, some controller work half the time, some most of the time, and some won't let a certain button work. Anyway, my adaption of the code probably isn't a very good base to work on, but the code I use to run one N64 controller can be found here.

Does anyone know how to run 4 N64 controllers on the Arduino at the same time? Does anyone know how to change the code I just mentioned to work with 4 controllers? I would greatly appreciate help.
Joshua

User avatar
Saimaster13
I practically live here!
I practically live here!
Posts: 176
Joined: Mon Aug 13, 2012 4:23 am
Location: Sarasota, Florida
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by Saimaster13 » Sun Nov 04, 2012 7:53 pm

Okay, so I was messing around with the N64 controller code a lot more, and pretty much got to the same state I was before: instability and unpredictability.

However, I noticed something odd: certain controllers do not work well in certain slots. So, I played around a little, and found out that if I connect 4 certain controllers in a certain order, then it works without any glitches (not that it matters, but that order is grey, black, red, purple.)


Uhh... I'm guessing there is something wrong with... something. Anyone know what could be the problem? My wires are not fully covered (but are not making contact with anything else) and the connecting wire from the controllers to the Arduino is kind of long (a foot max.) Might this have anything to do with it (noise)? This really does not make sense to me.
Joshua

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by brad » Sun Nov 04, 2012 8:00 pm

Unfortunately I haven't ever experimented with interfacing to N64 controllers. I haven't even looked at the protocol of how they work.

It is interesting that in a certain order, you said they actually work. I am guessing the code is the same for each - or perhaps they are all contained within a for loop maybe?

User avatar
Saimaster13
I practically live here!
I practically live here!
Posts: 176
Joined: Mon Aug 13, 2012 4:23 am
Location: Sarasota, Florida
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by Saimaster13 » Sun Nov 04, 2012 8:13 pm

Its coded with a for loop. It looks something like this:

Code: Select all

void N64controller() //the N64 controller function
{
  for(byte p = 0; p < 4; p++){ //the pins and players (pin 0 is player 1, pin 1 is player 2, etc.)
   
    pSquared = 0;       //used to square 2 to the "p"value
    #define N64_PIN p //defines which N64 pin to use
     pSquared = bitSet(pSquared, p);   //2^p
    #define N64_HIGH DDRD &= ~pSquared     //the code needs this
    #define N64_LOW DDRD |= pSquared  //the code needs this
    #define N64_QUERY (PIND & pSquared)  //the code needs this

    playerButtons[p] = N64buttons; //a simplification of the code

  }
}


Just so you know, I have no idea what DDRD, |=, or &= ~ mean or do, but to change the controller pins, those 3 bottom #define values need to be 2^(pin number) (two to the power of the pin that is being used.).
Joshua

User avatar
Saimaster13
I practically live here!
I practically live here!
Posts: 176
Joined: Mon Aug 13, 2012 4:23 am
Location: Sarasota, Florida
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by Saimaster13 » Mon Nov 05, 2012 11:20 am

I finally got it! Four N64 controllers working on one Arduino! How did you do it you might ask? Well, I deleted some of the important looking code, how else would I have done it?

(I had #define-ed N64_LOW, N64_HIGH, and N64_Query to different values throughout my code to change the pins. THe full line looked kind of like "#define N64_LOW DDRD &= 0x08". To fix it, I removed the DDRD and wierd &= stuff in all but the first defining part, so it looked more like "#define N64_LOW 0x08". I do not know why that worked.)


*Edit* Nevermind, this code is still unstable... though it does seem better.
Joshua

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by brad » Mon Nov 05, 2012 7:41 pm

DDRD is basically going around the arduino digital pins and accessing the atmega pins directly.

So DDRD is accessing PORTD of the arduino instead of trying to go about it by eight individual Digital pins.

I am not so sure about |= or &=. i first thought that |= might have been xor but a quite google search yielded nothing...

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: RPG game + LED pixel game system hardware

Post by bitfogav » Tue Nov 06, 2012 3:36 am

Just so you know, I have no idea what DDRD, |=, or &= ~ mean or do, but to change the controller pins, those 3 bottom #define values need to be 2^(pin number) (two to the power of the pin that is being used.).
There known as compound operators, they quite often baffle me when I see them in Code and quite often I have to look them up to remember what they do.. :lol:

Rather than I try and explain them ill just post the links to the pages :)

&=
http://arduino.cc/en/Reference/BitwiseCompoundAnd
|=
http://arduino.cc/en/Reference/BitwiseCompoundOr

x &= y; // equivalent to x = x & y;
x |= y; // equivalent to x = x | y;
The point to remember is that X will hold the result value.

And the weird char ~ is a Bitwise NOT.
http://arduino.cc/en/Reference/BitwiseXorNot
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by brad » Wed Nov 07, 2012 9:13 am

Helpful as always bitfogav!

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by brad » Tue Nov 13, 2012 5:31 am

By the way, I am still working on the graphic converter.

I am making it so it is compatible with Arduino and also swordfish basic :)

User avatar
Saimaster13
I practically live here!
I practically live here!
Posts: 176
Joined: Mon Aug 13, 2012 4:23 am
Location: Sarasota, Florida
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by Saimaster13 » Thu Nov 22, 2012 8:42 am

Hey Brad, in that river raid game shown in the Kickstarter project, what type of screen is that? Looks like it might go well with my game...
Joshua

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by brad » Fri Nov 23, 2012 8:13 am

It would be perfect for your game!

Here is the link, they cost around $35 each delivered (but I am sure with a bit of searching you could find them cheaper)
http://www.aliexpress.com/item/10mm-pix ... 72520.html

or if you bought 10 of them at once, they would end up being around $23 each (although these are the smaller 6mm pixel ones compared to the 10mm ones in the link above):
http://www.aliexpress.com/item/Free-Shi ... 16136.html

I can help you with your display code if you decide to get them :)

User avatar
Saimaster13
I practically live here!
I practically live here!
Posts: 176
Joined: Mon Aug 13, 2012 4:23 am
Location: Sarasota, Florida
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: RPG game + LED pixel game system hardware

Post by Saimaster13 » Fri Nov 23, 2012 12:22 pm

I was going to upgrade from the 8x8 matrix to a 16x16, and I started to work on it, but without etching (which I do not know how to do,) just connecting wires on the bottom of the board would be... impossible, not to mention easy to mess up or break once it is finished. I was going to try to get into etching, but this would be so much easier, and maybe even cheaper (maybe.)

Anyway, I would need 2 of these boards. Do you know if that would be okay or would it have flicker when running it with an Arduino?

And yes, I would DEFINITIVELY need your help with making the code to run it.
Joshua

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 8 guests