Hard Pong

Use this forum to share and discuss Uzebox games and demos.
Post Reply
User avatar
omundodogabriel
Posts: 33
Joined: Mon Mar 18, 2013 9:07 pm
Location: Brazil
Contact:

Hard Pong

Post by omundodogabriel »

Image
Well, I'm new here on the forum, I became interested in Uzebox when I saw on the Internet, I have a Uzebox I asked my father to help make, he is good at soldering and already has several projects. The Uzebox is already up and running :D Now it's time to do some more games for him.

Well, the other day I was playing Pong, but since I only have one control for now, could not play 2. :( So I decided to add an AI. After a few hours trying to figure out how to use the AVR Studio, finally got it. I also colored graphics and added a simple menu ...

So there is my first mod for uzebox. Still missing something here and there, I'll fix later. :mrgreen:
Sorry for my bad English... English is not my first language.

Controls:
Up/Down: Move the paddle
Start: Start the game and release the ball
Select: Go back to menu
B: Speed up the paddle

NEW VERSION 1.1
Changelog
- Better menu (with title!)
- Rewrote AI code (now with random values)
- Ball start at random Y position, and go to random sides (like on real game)
- Updated the kernel to the lastest version
- Added transparency to ball
- Some sprite changes
- Ball is now more fast, and game feels more fluid, thanks to the new kernel...
Attachments
hardpong.uze
(25.09 KiB) Downloaded 457 times
hardpong.hex
(69.17 KiB) Downloaded 433 times
Last edited by omundodogabriel on Tue Mar 19, 2013 11:49 pm, edited 1 time in total.
User avatar
uze6666
Site Admin
Posts: 4823
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Hard Pong

Post by uze6666 »

Hi omundodogabriel, welcome to the Uzebox community! :)

Finally being able to play pong alone, that's a nice surprise! :D Pretty good start for a first effort. A feature to add would probably be a difficulty setting, cause I play 15mins and still 0-0! :lol:
User avatar
omundodogabriel
Posts: 33
Joined: Mon Mar 18, 2013 9:07 pm
Location: Brazil
Contact:

Re: Hard Pong

Post by omundodogabriel »

uze6666 wrote:Hi omundodogabriel, welcome to the Uzebox community! :)

Finally being able to play pong alone, that's a nice surprise! :D Pretty good start for a first effort. A feature to add would probably be a difficulty setting, cause I play 15mins and still 0-0! :lol:
I need some help on this... I rewrote the code. Here the new AI code:

Code: Select all

//AI
		if (X < 0) {
			if (Paddle[1].y != 96) {
				if(Paddle[1].y < 96 && Paddle[1].y < 184) {
					Paddle[1].y += 2;
				}else if(Paddle[1].y > 8) {
					Paddle[1].y -= 2;
				}
			}
			r = rand() % 25;		
		} else {
			if 	(Paddle[1].y + r != pBall->x) {
				if(pBall->y < Paddle[1].y + r && Paddle[1].y > 8) {
					Paddle[1].y -= 2;
				} else if(pBall->y > Paddle[1].y + r && Paddle[1].y < 184) {
					Paddle[1].y += 2;
				}
			}				
		}
i need to make the computer calculate the best position to hit the ball and the ball go to the oposite side of player paddle.

For now i will start working on my new project, a port of balloon fight for the Uzebox :mrgreen:
User avatar
Kilo
Posts: 330
Joined: Wed Dec 19, 2012 3:43 pm
Location: AC, Germany

Re: Hard Pong

Post by Kilo »

welcome to the community!! :)

Wow, nice work!
Yeah, I made an AI with Pong on my One Chipbasic Computer and I did it the same way.
But you have to do it like Uze said. You need at least 3 difficult levels.
Because when you let the AI calculate the best position, a game would take more than 15 minutes without any point to score!
So, when you set another variable to set the reaction rate of the AI which would be randomize, then the AI would slow down the movements without that it looks artificial!
The last digit of Pi is 7! I calculated this, as I counted to infinity yesterday!
User avatar
omundodogabriel
Posts: 33
Joined: Mon Mar 18, 2013 9:07 pm
Location: Brazil
Contact:

Re: Hard Pong

Post by omundodogabriel »

I ended up doing something stupid, I left the code in the downloads folder, and today i accidentally deleted ... :cry: Well, I'm too lazy to retrieve the code, so this is the final version. My next project will be a port of Balloon fight. :mrgreen:
User avatar
Kerby
Posts: 90
Joined: Wed Feb 06, 2013 6:02 pm

Re: Hard Pong

Post by Kerby »

Hi! If you are about this game for the NES, I'll be glad to see her on Uzebox. http://en.wikipedia.org/wiki/Balloon_Fight
http://www.youtube.com/watch?v=DSKXykKsIiA
User avatar
uze6666
Site Admin
Posts: 4823
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Hard Pong

Post by uze6666 »

omundodogabriel wrote:I ended up doing something stupid, I left the code in the downloads folder, and today i accidentally deleted ... :cry: Well, I'm too lazy to retrieve the code, so this is the final version. My next project will be a port of Balloon fight. :mrgreen:
Ah, that's bad news, unfortunately that's something that happens far too often. Put your next project in source control right away! Btw, balloon fight looks like a nice project, check out if you will have enough sprites thought.
User avatar
DaveyPocket
Posts: 378
Joined: Sun Sep 14, 2008 8:33 pm
Contact:

Re: Hard Pong

Post by DaveyPocket »

Balloon fight has to be one of my top favorites!

Maybe this could incorporate online play if Uze finishes his network adapter ;)

Would be awesome to do head-to-head over the internet, kind of like arcade version where the other side of the machine is second player:

Image
kaiyara
Posts: 1
Joined: Tue Jul 02, 2013 8:30 am

Re: Hard Pong

Post by kaiyara »

The challenge with this game is really the video mode. It really needs to video pages to avoid flicker. A simple 1bpp mode looked too cheap, so I needed a custom mode which also renders the grid and the flashing cursor in real time. I'm wte surprised with speed, thought it would be much slower...
Kaiyara
Post Reply