piyush_3Squares
Senior Newbie  Projects: 2
|
 |
«
Posted
2007-08-27 18:09:03 » |
|
This is just a prototype...has the basic game mechanics. I am planning to add lots more,change the graphics a lot and add some music. Play Here.... designinks.bravehost.com/game/castles.jnlp I have packed the game in an executable jar. Game Description : You choose a kingdom and try to destroy the opposite kingdom's castle..Any units made will move towards the right.. Once made no units can be controlled...A worker unit will bring the wood from tree back to the castle (which will increase your coins).A sword unit can be destroyed only by another sword unit.A thief if sucessfully sent to the opposite camp can steal 150 coins.A speed unit can travel faster than the other units. COST: Worker : 5 coins Swordsman : 25 coins Thief : 45 coins Speed unit : 60 coins. This is a very basic version and has a large load time ???after u press 's' key to start the game.... Anybody with ideas that can be added to the game,please give them.... 
|
|
|
|
noblemaster
|
 |
«
Reply #1 - Posted
2007-08-27 18:14:58 » |
|
how about posting some screenshots? 
|
|
|
|
princec
|
 |
«
Reply #2 - Posted
2007-08-27 20:31:05 » |
|
Concept sounds interesting and the graphical style shows merit.. don't suppose you'd like to Webstart it for us? Cas 
|
|
|
|
Games published by our own members! Check 'em out!
|
|
gouessej
|
 |
«
Reply #3 - Posted
2007-08-27 21:15:22 » |
|
Concept sounds interesting and the graphical style shows merit.. don't suppose you'd like to Webstart it for us? Cas  Yes! Good idea! You have a jar, it would be easy to configure java webstart!
|
|
|
|
irreversible_kev
|
 |
«
Reply #4 - Posted
2007-08-27 22:39:20 » |
|
Game Over You Win!
Cool graphics.
My main critisism would be that it took too long to complete the game.
Here is a crazy idea: You can use a cannon/ caterpolt from the top of the castle. It charges for a while ( say 45 seconds ) and then you can click on it then click somewhere on the ground to fire a large stone and destroy enemies or anyone that is there. It would add a bit of 'instant-interactivity' to the game.
Perhaps you start with a basic cannon and you can buy upgrades like a flaming ball or somthing.
|
|
|
|
piyush_3Squares
Senior Newbie  Projects: 2
|
 |
«
Reply #5 - Posted
2007-08-28 18:11:07 » |
|
Thanks for ur comments irreversible_kev , This is just prototype,did it in 2 days...i am planning to improve the gameplay,add more units,ability to build new buildings,season changes,etc... Will it be a good idea to make the game side-scrolling  More space for the gameplay.... princec & gouessej : Webstart version ready...please leave a comment
|
|
|
|
princec
|
 |
«
Reply #6 - Posted
2007-08-28 22:53:32 » |
|
You need to set the mime-type on the server for JNLP files to application/x-java-jnlp-file by the way. Verdict: I think you're on to a winner here if you can manage to build on this basic game concept. Scrolling might not necessarily make it any better but varied scenery and multiple paths would. And lots and lots of different things to send forth. I can envisage a game so good I'd pay for it if you get it right. Cas 
|
|
|
|
gouessej
|
 |
«
Reply #7 - Posted
2007-08-29 02:24:07 » |
|
Thanks for ur comments irreversible_kev , This is just prototype,did it in 2 days...i am planning to improve the gameplay,add more units,ability to build new buildings,season changes,etc... Will it be a good idea to make the game side-scrolling  More space for the gameplay.... princec & gouessej : Webstart version ready...please leave a comment Princec is right, add this : <?php header("Content-type: application/x-java-jnlp-file"); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; ?> and rename your file with the extension ".php". Side-scrolling is easy to implement on my view. It might be interesting but I agree with Princec, the main point is to improve the variety of interactions with the player. I tried your game from command line. Why is the frame rate so low? Only 40 FPS here. Could you use JOGL or LWJGL inside your game? It isn't an absolute necessity but it might improve the performance.
|
|
|
|
noblemaster
|
 |
«
Reply #8 - Posted
2007-08-29 05:06:51 » |
|
I like it  - would probably even fit into the j4k...
|
|
|
|
gjh9413
Innocent Bystander
|
 |
«
Reply #9 - Posted
2007-08-29 06:45:48 » |
|
This is a good idea!I like it!
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Juriy
|
 |
«
Reply #10 - Posted
2007-08-29 08:21:59 » |
|
Great game! AI is a bit too easy, still it is nice! Would love to play it with a real player, even hot-seat mode!
|
|
|
|
princec
|
 |
«
Reply #11 - Posted
2007-08-29 11:38:33 » |
|
40fps is fine for this game I think, though obviously 60fps would be ideal  Which should be achievable using plain old Java2D easily - not sure where the bottleneck is here or why it runs at 100% CPU. Cas 
|
|
|
|
gouessej
|
 |
«
Reply #12 - Posted
2007-08-29 18:36:34 » |
|
40fps is fine for this game I think, though obviously 60fps would be ideal  Which should be achievable using plain old Java2D easily - not sure where the bottleneck is here or why it runs at 100% CPU. Cas  40 FPS is enough but I really think there is a huge room for improvements.
|
|
|
|
piyush_3Squares
Senior Newbie  Projects: 2
|
 |
«
Reply #13 - Posted
2007-08-29 19:07:27 » |
|
Princec is right, add this :
<?php header("Content-type: application/x-java-jnlp-file"); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; ?>
and rename your file with the extension ".php". Side-scrolling is easy to implement on my view. It might be interesting but I agree with Princec, the main point is to improve the variety of interactions with the player.
I tried your game from command line. Why is the frame rate so low? Only 40 FPS here. Could you use JOGL or LWJGL inside your game? It isn't an absolute necessity but it might improve the performance.
I have never used webstart before...can u post a link containing some basic guide....btw i did what u wrote....didn't work....  I fixed the frame rate to 40 FPS using Thread.yeild(); // I think that is making the processor run at 100 %. Any idea on how to implement a constant frame rate loop in game....
|
|
|
|
piyush_3Squares
Senior Newbie  Projects: 2
|
 |
«
Reply #14 - Posted
2007-08-29 19:14:18 » |
|
Thank you very very much  for the positive comments.....Juriy...gjh9413...kingaschi....i am planing to rework the game completely.....switch from Java2D to JOGL....add more units,buildings......random terrain generation,different modes of game play. I am also going to concentrate on multiplayer support...
|
|
|
|
piyush_3Squares
Senior Newbie  Projects: 2
|
 |
«
Reply #15 - Posted
2007-08-29 19:18:29 » |
|
I tried your game from command line. Why is the frame rate so low? Only 40 FPS here. Could you use JOGL or LWJGL inside your game? It isn't an absolute necessity but it might improve the performance.
I fixed the Framerate to 40 fps....used... Thread.yeild(); code : float target = 1000 / 40.0f; float frameAverage = target; long lastFrame = System.currentTimeMillis(); float yield = 1000f; float damping = 0.1f; long renderTime = 0; long logicTime = 0; while (gameRunning) { long timeNow = System.currentTimeMillis(); frameAverage = (frameAverage * 10 + (timeNow - lastFrame)) / 11; lastFrame = timeNow; yield+=yield*((target/frameAverage)-1)*damping+0.05f; for(int i=0;i<yield;i++) { Thread.yield(); } //=========================================================================
|
|
|
|
SimonH
|
 |
«
Reply #16 - Posted
2007-08-29 19:56:41 » |
|
I can't play at all!  I just get this page; The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
End tag 'information' does not match the start tag 'description'. Error processing resource 'http://designinks.bravehost.co...
</information> ------^
|
People make games and games make people
|
|
|
Riven
|
 |
«
Reply #17 - Posted
2007-08-29 20:26:45 » |
|
Please don't yield. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| int targetFramerate = 40; long milliesPerFrame = 1000 / targetFramerate;
long lastFrame = System.currentTimeMillis();
while(true) {
long nextFrame = lastFrame + millisPerFrame; while(System.currentTimeMillis() < nextFrame) Thread.sleep(1);
lastFrame = nextFrame; } |
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
keldon85
|
 |
«
Reply #18 - Posted
2007-08-29 23:42:17 » |
|
I quite like a high priority thread unlocking a wait 60 times a second. Having said that it does not handle low resolution timers when using only standard calls.
|
|
|
|
CommanderKeith
|
 |
«
Reply #19 - Posted
2007-08-30 02:59:18 » |
|
Capping FPS using yield does seem dodgy because since when is yield meant to take a set amount of time? But I've seen it used by Onyx and Kev in their games. Using sleep is good since it doesn't max out the CPU unlike yield but since sleep(time) doesn't gaurantee a sleep of time, often it will be much longer and you will miss frame updates. For example, sometimes when you increase the sleep time by one incrementally it does not seem to make any difference until you get to say 5ms or 20ms  . I quite like a high priority thread unlocking a wait 60 times a second. Having said that it does not handle low resolution timers when using only standard calls.
But how do you get your high priority thread to time things properly and wake up your thread at the right time? You'll still have to use a sleep or yield technique The graphics for this game look great by the way 
|
|
|
|
keldon85
|
 |
«
Reply #20 - Posted
2007-08-30 06:32:42 » |
|
But how do you get your high priority thread to time things properly and wake up your thread at the right time? You'll still have to use a sleep or yield technique Hmm, well I haven't ran it on Linux or any other runtime environment, but on my system it is accurate using sleep!!! Really I should use the multimedia timer, which I probably will end up using
|
|
|
|
CommanderKeith
|
 |
«
Reply #21 - Posted
2007-08-30 09:47:24 » |
|
By the way, your jnlp file doesn't work because you've named it castles.xml instead of castles.jnlp! I just changed it after downloading the .xml file, renamed it and it worked, so you did everything else perfect Cool game I'm playing it now 
|
|
|
|
keldon85
|
 |
«
Reply #22 - Posted
2007-08-30 10:10:34 » |
|
This game is quality, did you think it up by yourself?
|
|
|
|
Mr. Gol
|
 |
«
Reply #23 - Posted
2007-08-30 10:15:50 » |
|
I really like this game! Here are some of my comments: - The menu at the beginning is terrible, please make something that uses mouse input. - It would be useful to see the cost of each unit when you mouse-over the button. - It takes ages to destroy the opponent. - More units, maybe flying ones 
|
|
|
|
|
piyush_3Squares
Senior Newbie  Projects: 2
|
 |
«
Reply #25 - Posted
2007-08-30 17:40:40 » |
|
I really like this game! Here are some of my comments: - The menu at the beginning is terrible, please make something that uses mouse input. - It would be useful to see the cost of each unit when you mouse-over the button. - It takes ages to destroy the opponent. - More units, maybe flying ones  Thanks for the comments..  btw this is not the complete game...just the prototype....i ll post the pictures of the work going on for the full game as soon as i get my blog up and running...
|
|
|
|
gouessej
|
 |
«
Reply #26 - Posted
2007-10-18 12:14:27 » |
|
Please don't yield. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| int targetFramerate = 40; long milliesPerFrame = 1000 / targetFramerate;
long lastFrame = System.currentTimeMillis();
while(true) {
long nextFrame = lastFrame + millisPerFrame; while(System.currentTimeMillis() < nextFrame) Thread.sleep(1);
lastFrame = nextFrame; } |
Don't use Thread.sleep too!! It breaks the synchronisation with the graphics card. On my game, the FPS was twice lower when I used this. On the other hand, when I click on the link, the jnlp file is displayed. If you want to solve it, watch my own config file which is included in a PHP file when you click on the link allowing to launch my game.
|
|
|
|
princec
|
 |
«
Reply #27 - Posted
2007-10-18 16:03:31 » |
|
All of our games use this code, in LWJGL's Display.sync() method: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| public static void sync(int fps) { long gapTo = Sys.getTimerResolution() / fps + timeThen; timeNow = Sys.getTime();
while (gapTo > timeNow + timeLate) { try { Thread.sleep(1); } catch (InterruptedException e) { } timeNow = Sys.getTime(); }
if (gapTo < timeNow) timeLate = timeNow - gapTo; else timeLate = 0;
timeThen = timeNow; } |
and we don't seem to have any problems at all, and our games run at only a small % of CPU. Cas 
|
|
|
|
gouessej
|
 |
«
Reply #28 - Posted
2007-10-18 17:12:13 » |
|
All of our games use this code, in LWJGL's Display.sync() method: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| public static void sync(int fps) { long gapTo = Sys.getTimerResolution() / fps + timeThen; timeNow = Sys.getTime();
while (gapTo > timeNow + timeLate) { try { Thread.sleep(1); } catch (InterruptedException e) { } timeNow = Sys.getTime(); }
if (gapTo < timeNow) timeLate = timeNow - gapTo; else timeLate = 0;
timeThen = timeNow; } |
and we don't seem to have any problems at all, and our games run at only a small % of CPU. Cas  I'm sorry but I checked what I said. Sometimes, the loss of performance can be lower than mine but there is a true loss. If you think I'm a lier, take my source code, add this "try {Thread.sleep(1);} catch (InterruptedException e) { e.printStackTrace();}" inside the main while loop in the method called runEngine(), in the class called "GameModel", in the package called "main", recompile all, execute the game and the FPS will be twice lower. I assume JOGL uses the same mechanism in the class called "FPSAnimator" but I'm not sure. However, I don't use this class at all. I try not to give bad advice. I think that I gave piyush_3Squares a quite good advice. Your method is reliable but using Thread.sleep(1); may cause a loss of performance on my view. Maybe it depends on the context.
|
|
|
|
erikd
|
 |
«
Reply #29 - Posted
2007-10-18 17:53:07 » |
|
I'm sorry but I checked what I said. Sometimes, the loss of performance can be lower than mine but there is a true loss. If you think I'm a lier, take my source code, add this "try {Thread.sleep(1);} catch (InterruptedException e) {e.printStackTrace();}" inside the main while loop in the method called runEngine(), in the class called "GameModel", in the package called "main", recompile all, execute the game and the FPS will be twice lower. I assume JOGL uses the same mechanism in the class called "FPSAnimator" but I'm not sure. However, I don't use this class at all. I try not to give bad advice. I think that I gave piyush_3Squares a quite good advice. Your method is reliable but using Thread.sleep(1); may cause a loss of performance on my view. Maybe it depends on the context.
Umm yeah, you get a performance loss of 1ms when you use Thread.sleep(1) but that's the whole point of throttling, isn't it  Of course, if you're not careful with the amount of sleeping, you might miss frames when you make use of vsync, but that's not Thread.sleep(1)'s fault. FWIW, I'm using the same code for throttling as princec, no problems at all: Steady framerates, no performance loss. Oh, and there's really no need for e.printStackTrace() (just commenting on it since you posted that in bold as if it were important).
|
|
|
|
|