Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Networking & Multiplayer / Re: HTTP POST requests on: 2006-02-11 06:42:38
oh, I didn't know I was. I'll try changing $_POST to $_GET and see what happens.

Still though, its not doing anything. At very minimum the PHP script should write to my log file even if it doesn't accept any variables. Unless I'm mistaken here?
2  Game Development / Newbie & Debugging Questions / Re: Animation basics on: 2006-02-10 16:14:30
Interesting...

you have it so the object itself draws to the graphic. i was painting the objects in the paint method by just painting with whatever the values are at the moment paint() is called.

just out of curiousity, what is the reasoning behind keeping all rendering to one thread?
3  Game Development / Newbie & Debugging Questions / Animation basics on: 2006-02-10 15:43:13
Okay, so I've ventured into my first bit of java programming by making a Tetris clone.

One of the things I wanted to do is make it so the animation was very smooth to make it appear as though the pieces were sliding instead of moving down the grid block by block. I did accomplish this, by running a general animation thread that processes animations for the pieces.

You can take a look at the applet here...
username: guest
password: guest
http://www.grnade.com/tetris/

I've attached what my animation thread looks like if anyone wants to see what I mean.


Now heres the thing. I'm ready to add more animation to this to spice it up -- you know, effects when you remove a line, perhaps making animations in the background, etc. The thing is my animation thread is going to get cluttered, and it doesn't really make sense to have just one thread controlling all animations. It's made timing things a real trick.

I know there is a better way to do this, I'm just looking for some sort of enlightenment here.
I tried giving each animation its own thread object by doing something like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
    
Thread animateDrop = new Thread() {
        public void run() {
      if (yOffset>=20) {
         translate(0,1);
         yOffset = 0;
      } else
         yOffset++;
      try {
         sleep(speed/20);
      } catch (InterruptedException e) { }
        }
    };
    animateDrop.start();


The problem with that is objects with threads like that can't interact with my yOffset variable(the variable that is added in my paint method to give the 'sliding' appearance)

So I guess my question is, whats the best way to tackle 2d animation where you could quite possibly have 6 or more animations going on at once? Is there a general consensus here? If anyone even has some good animation programming links, I'd love to see them.
4  Game Development / Networking & Multiplayer / HTTP POST requests on: 2006-02-09 15:41:21
Okay, so I've developed a simple tetris clone applet that I want to send score and user information to a PHP script after the game is over.

The PHP form then takes this information and submits it to a MySQL database (JDBC is not an option, I do not have remote access to the web server)

For some reason though, it doesn't seem to work. If I manually execute the PHP file, it works fine (it creates a log of all scores submitted so I can debug this), but when I try to use the Java applet it seems to connect but it does not do anything afterwards. My code looks like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
    
public void sendScores() {
        String[] stats;
        stats = Tetris.getGameStats();
        sentScores = true;
        URL url;
        URLConnection urlConn;
        DataOutputStream printout;
       
        try {
            String q = URLEncoder.encode("user_id", "UTF-8") + "=" + URLEncoder.encode(strUserId, "UTF-8");
            q += "&" + URLEncoder.encode("ruleset", "UTF-8") + "=" + URLEncoder.encode(strRuleSet, "UTF-8");
            q += "&" + URLEncoder.encode("gametype", "UTF-8") + "=" + URLEncoder.encode(strGameType, "UTF-8");
            q += "&" + URLEncoder.encode("score", "UTF-8") + "=" + URLEncoder.encode(stats[0], "UTF-8");
            q += "&" + URLEncoder.encode("time", "UTF-8") + "=" + URLEncoder.encode(stats[1], "UTF-8");
            q += "&" + URLEncoder.encode("timelimit", "UTF-8") + "=" + URLEncoder.encode(strTimeLimit, "UTF-8");
            q += "&" + URLEncoder.encode("ruleset", "UTF-8") + "=" + URLEncoder.encode(strScoreLimit, "UTF-8");            
            System.out.println(q);
            url = new URL (getCodeBase().toString() + "submitScore.php");
            System.out.println(url.toString());
            urlConn = url.openConnection();
            urlConn.setDoOutput (true);
            urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            printout = new DataOutputStream (urlConn.getOutputStream ());
            printout.writeBytes(q);
            printout.flush();
            printout.close();
            System.out.println("sendScore() executed");
        } catch (Exception e) { }
       
    }


As you can see I followed Java World Tip #34 very closely.
The applet does NOT throw an exception, so it appears to have executed all the code correctly, but it doesn't appear to actually send the information to the script. There is very little out there beyond the javaworld site. If anyone wants to look at the php file I've attached it as well. It is supposed to create a log file even if no data is actually posted to the php script.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (19 views)
2014-09-12 09:08:26

Norakomi (54 views)
2014-09-10 13:57:51

TehJavaDev (63 views)
2014-09-10 06:39:09

Tekkerue (31 views)
2014-09-09 02:24:56

mitcheeb (53 views)
2014-09-08 06:06:29

BurntPizza (37 views)
2014-09-07 01:13:42

Longarmx (23 views)
2014-09-07 01:12:14

Longarmx (27 views)
2014-09-07 01:11:22

Longarmx (27 views)
2014-09-07 01:10:19

mitcheeb (35 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!