We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › some little games
Page Index Toggle Pages: 1
some little games (Read 2124 times)
some little games
Jun 25th, 2009, 2:58am
 
Hi everybody,
(as frenchspeaker, my language is very very bad, sorry)

I'm just discovering Processing and I try to recreate old games of space battle.
As I have some little bases in java, I succeed while creating some games:

befr.net/games/spaceattack/
(my first try)

befr.net/games/spaceattack2/
the same, with images instead of line, circles an rect

befr.net/games/scramble/
a good clone (I think) of my prefered game

befr.net/games/spaceattack3/
my last version of space attack, with new graphic.

My problem is:
I want to use cookies ton read data at the beginning of the game and send data at the end of the game to create a little "online roleplaying" with some battles. I have no idea how to do that.

Big big thanks for the team, I think I never create this games with netbeans.
Re: some little games
Reply #1 - Jun 25th, 2009, 4:52am
 
Salut oxidor.

I will try your game at home...
Cookies will be useless for "online roleplaying" if that means multiplayers: cookies are local to a computer, you need to send data to a server to coordinate several computers.
So you need some server side code, in PHP, Java or whatever.
Re: some little games
Reply #2 - Jun 25th, 2009, 4:41pm
 
I know, I know... my project is not a multiplayer game in real time...

In my project, each player has a spaceship and play sometimes again NPCs but don't confront others players.

cookies seems the easiest system to save scores after a game, but a simple code allowing to access a mySql database is also very good.

I'm good with PHP and SQL, but I begin with Java.
Re: some little games
Reply #3 - Jun 25th, 2009, 7:51pm
 
Pretty good start there.
The main thing right now is the controls and physics just don't have enough fluidity.
I actually prefer the second version of the graphics over the most recent one.
Re: some little games
Reply #4 - Jun 26th, 2009, 1:26am
 
You can actually access files, using loadString() and saveString() or similar functions (look at the Reference). But in applet mode, you have to sign it. Same for SQL access, anyway, and it would need a database installed.
You can use, for example, Sun's one (actually from Apache): Java DB (Derby), but that's still 2.5MB, a bit heavy for an applet... There are more if you want to go this way. The H2 page shows a (partial) comparison of some engines). HSQLDB is quite lightweight.
Re: some little games
Reply #5 - Jun 26th, 2009, 1:34am
 
I'd agree with Gordon on that one - it's a good start but the controls feel a little limiting.  Two things stand out:

1.  In the vertical shooters there's no way to have your ship stay still.  In the horizontal shooter you can't use combined key-presses for diagonal movement.  One possible solution to both these issues might be found here.

2.  In the vertical shooters shots fired inherit the horizontal movement of the ship - i.e. they fire off at an angle. I must admit I found this a little frustrating.

One final suggestion - since you improved the ship graphics with bitmaps I'd be tempted to do the same with the missiles.

Looks like you've done a lot of work on these though - and it has to be said, the addition of decent graphics completely changes the feel of the games.  Did you create those yourself
Re: some little games
Reply #6 - Jun 26th, 2009, 11:41am
 
Ok, I found a solution with functions "params" to initiate my games with player's value and "links" to send datas after the game... I'll manipulate my database only with PHP (it's more easy).

For the graphic, I'll keep the background image and the Fonts from the second version and the spaceships from the third.

Quote:
2.  In the vertical shooters shots fired inherit the horizontal movement of the ship - i.e. they fire off at an angle. I must admit I found this a little frustrating.


It's voluntary, It find that more easy than firing just in front.

Next version tomorrow... or later.
Re: some little games
Reply #7 - Jun 28th, 2009, 4:55am
 
I just found another solution to access a mySql database from java:

in processing, I use simply:

Strings s[] = loadStrings("myurl.net/userinfo.php?user=691366&request=login");

and in userinfo.php:

$user = $_GET['user'];
$request = $_GET['request'];
$sqlString = "SELECT $request FROM mygame_user WHERE user_id=$user";

incredibly simple... but it works.
Re: some little games
Reply #8 - Jun 30th, 2009, 7:25am
 
You're right that it's simple, but be careful. Just by visiting that PHP script and passing request=SOMESTRING into the address, I could access ANY of the user's fields!

Of course, its easy to take care of - but don't forget to do it in the php file (only allow certain requests to actually be queried, that is)

Always on the safe side
-Taif
Re: some little games
Reply #9 - Jul 1st, 2009, 1:32pm
 
You're right, I just added a security script in php to protect somes pages from acces by standard browser.
It's not 100% secure, but I'll search other precautions before creating an online game.
Wink
Re: some little games
Reply #10 - Jul 4th, 2009, 8:55am
 
looking good!
Page Index Toggle Pages: 1