Pocket Kingdom 4k

http://www.java4k.com/index.php?action=games&method=view&gid=395

A turn based kingdom building game.

Good, if simple game. I’d have added a bit of randomness to it, in some form or another, but that’s me. xD

Not sure how close are you to your space limit, but some information about the speed/value production of the various buildings might be in order. I know that when I was playing it I was left guessing at the rules (I looked at the code afterwards, and went “Oh, so that’s what’s happening!”)

Very fun! I managed to get 992 score, equipping 66 soldiers with a total morale of 126 and a castle size of 8.

Is there a max or target score? I have no idea how good that score is but for what I was able to accomplish, I’m proud of it ;D

There should be a goal to achieve, like good score above 3,000 or so on. I got +/- 1500.

There is a maximum! It’s CastleSize100+108+100. That’s CastleSize100 + Min(Pop,Weapons) + Morale.

Since there is no random component, it’s rather easy to search the game’s state-tree to figure this out (Perhaps a hint costly to do it, but…)

Morale: 206
Soldiers: 102
Points: 1208

Funny little game.

Maby at the final stage there should be a war. The more soldiers you have, the
more lands (square Km) you can defend / conquer.

That’s called Conquer System.

Yeah, I usually add randomness and combat when I make thins kind of game. But the 4kb limit… :slight_smile:

Score:
I think 1500 is good. A bit above 2000 should be max. Below 1000 is poor.

Can someone check if I submitted everything correctly (the jar file has no “manifest”, probably; I’m a bit confused about these Java only specific things) and if there is nothing in the code that would crash the game? I started learning Java less than a week ago :slight_smile:

108 soldiers, 265 morale, castle size 17, score 2073 :slight_smile:

Cool kingdom management game, Archibald. I checked a bit your code, and I noticed that you used a lot of methods in your class. If you have the time to do it, you should try to limit them to the start, run and handleEvent ones, in order to save some bytes.

So you may add a random event each turn, as bad or good weather, that would impact on food, and also some enemy raids, that would steal some food or destroy some building. Soldiers and the castle may decrease the impact of these raids.

But if you haven’t the time for such changes, don’t worry, your game is interesting enough as it is now.

The methods cost in Java is confusing. I added more methods to save space, but it seems it is not working that way…

Would this:


   private void drawTopString(String s,int x,int y){
   setColorRainbow(0.7);    g.drawString(s,x+1,y+1);g.drawString(s,x-1,y-1);g.drawString(s,x-1,y+1);g.drawString(s,x+1,y-1);g.drawString(s,x,y+1);g.drawString(s,x,y-1);g.drawString(s,x-1,y);g.drawString(s,x+1,y); 
   g.setColor(Color.orange);       g.drawString(s,x+1,y+1);g.drawString(s,x-1,y-1);g.drawString(s,x-1,y+1);g.drawString(s,x+1,y-1);g.drawString(s,x,y+1);g.drawString(s,x,y-1);g.drawString(s,x-1,y);g.drawString(s,x+1,y); 
   }

be more compact than this?


   private void drawOutlineString(String s,int x,int y){
   g.drawString(s,x+1,y+1);g.drawString(s,x-1,y-1);g.drawString(s,x-1,y+1);g.drawString(s,x+1,y-1);g.drawString(s,x,y+1);g.drawString(s,x,y-1);g.drawString(s,x-1,y);g.drawString(s,x+1,y);   
   }
   
   private void drawTopString(String s,int x,int y){
   setColorRainbow(0.7);    drawOutlineString(s,x,y);
   g.setColor(Color.orange);        drawOutlineString(s,x,y);
   }

Archibald, to save space in this 4 Kb competition, the first rule would be “no more than the start, run and handleEvent methods in your class”.

Yet, I just tried Riven’s compressor tool chain on your source code, using Proguard, Pack200, Kzip and Zip2Gzip, and I reduced it to a mere 2 567 bytes.

So maybe you should try to understand how this tool chain works, instead of reducing the number of the methods in your program, as time is lacking. You’ll find many informations about it in this thread :

I used ProGuard and JoGa for 3 965 bytes.
I have no Pack200 and can’t find any download.

Great game.

Is 2350 still “a bit above 2000” ;D
Got it in 3rd try. 105 Soldiers, 245 morale and castle at 20.

Some hints on how the values changing at the next level would be nice. Something like: “Food 100 (+10)” or “Iron 30 (-2)”

[quote]I have no Pack200
[/quote]
You probably have it already,
check the bin folder of your JDK (whe javac is also), it must be in there

just type pack200 in the commandline to verify if its linked by the OS

108 soldiers (seems to be max seeing as that’s the end population), 265 morale and castle of lvl 18, 2173 points :slight_smile:

Also, festival only costs 150 even though it says 200

108 soldiers, 280 morale, castle lvl 20, 2388 points :slight_smile:

EDIT: 93 soldiers, 300 morale, castle lvl 20, 2393 points. Almost to the max I think

EDIT: 57 soldiers, 300 morale, castle lvl 21, 2457 points, seems like castle lvl is more important than soldier count.

EDIT: 1 soldier, 300 morale, castle lvl 22, 2501 points, yup, castle lvl>soldiers, peace ftw! :slight_smile:

Last EDIT :slight_smile:

41 soldiers, castle lvl 22, 300 morale, 2541 score :slight_smile:

I give up :stuck_out_tongue:

Let’s see… Maybe?

It’s probably close. Hmmm, 300 Moral is probably just about the best you could manage, and it’s probably close to what you’d get by managing to get 86 more Bricks and 43 more Wood. xD

I lied, I needed that last big record :stuck_out_tongue:

I think it’s possible to get 2-3 points more but I give up for real :wink:

3 soldiers, 300 morale, castle size 23, 2603 points :slight_smile:

Mike

EDIT: To make it more interesting and give several ways to play I’d suggest the following:

Have several levels of research and make food and mine research more interesting.
Have an upgraded castle give you more inhabitants (or at least have them pay more tax)
If you have lots of food people should come to your city quicker
Food decaying if you have a lot laying around
Not having an army after turn 30 or so should make you lose money due to raiding

and so on… :slight_smile:

I was overthrown :frowning: How does that even work?