Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 / Newbie & Debugging Questions / Re: Curious about loopy loops on: 2017-04-25 11:32:55
As I said I am just curious about it at this stage,
running an update every few seconds actually seems like a great plan to visually improve performance but taking it to an extreme level like say 10 000+ entities running around the place. Surely you'll get a massive stutter during the update cycle that does the calculation. To put it this way, I tried to run a stress test on an android device using 1000 entities on the GdxAi library and there was plenty of lag. That's essentially what spiked this curiosity. I then saw a video on the YouTube where 100 000 entities were path-finding to a single enemy with no visible lag, I think this was the "Totally Accurate Battle Simulator" game but I'm not sure. I get that they probably custom built a lot of the path-finding and things but it got me thinking about basic loops that could be improved in more simple ways.

Another example is my current attempt at a game, on my android phone it runs at a solid 50 or so frames, its by no means the most beefy of phones but its no push over either. And currently I have only 8 entities in a box2D world. I'm only assuming here but if I continue to add more and more entities and features that it will get exponentially slower with each feature. On the same device though I tried to do 250 GdxAi entities and it only then started to have visible performance impacts, like 5-10 fps drop.

there could be plenty of reasons for the examples though so that's why I didn't use that exactly. I'm more looking for a simple advanced understanding of strategies that people try to get the loopy loop iterations down for a performance boost. whether its a major or minor boost, I'm just looking for understanding.
2  Game Development / Newbie & Debugging Questions / Curious about loopy loops on: 2017-04-25 07:49:58
So while I am not new to programming in general, and am relatively new to game dev, I do have a question on loops.
With everything I've learnt about game dev there has always been one part of the design that's always had me curious.

Say you have a tiled top down 2D game. Where a player character runs around and shoots at zombies.
In order to draw the map you obviously need to loop over every tile and draw the tile to the canvas, that part makes sense to me.
But when you have to loop over all entities in a map to do their update function where they have player tracking code. This part seems to be the less efficient.

lets say there are 10 zombies and 2 players, 12 entities in total.
step 1: the level controller updates all entities in a loop iterating 12 times.
step 2: the zombies will then ask the level class for a list of entities in its range
step 3: the level class will then again iterate over all entities getting their co-ords and seeing if they are close
step 4: the zombie will use the list to iterate and see if there are players in the list
step 5: the zombie will then find the closest player in the list and target it

assuming all entities are within range of each other (the worst case scenario)
This will basically run like a thousand times every update cycle just for this one function.
I know you can maybe optimize the specific scenario by having 2 lists, one for the zombies and one for the players.
But some scenarios need the zombies to interact with other zombies to form a horde, so they need to find the 2 closest zombies and move towards those zombies.

So basically, what I am wondering is simply, is this the right approach to doing this kind of thing?
I mean if you add just 1 zombie that adds almost 20 extra iterations to it... what if you add 50 zombies? 100 zombies?
I'm sure there must be a better way of finding the closest 2 zombies for each zombie?

If I've worded anything wrong or you need more info, please let me know.
thanks in advance for any help  Smiley
3  Game Development / Newbie & Debugging Questions / Re: Sprite render order using libgx tiled maps on: 2017-02-17 09:07:42
That's something I didn't actually think about, I will check it out. Although there will be on average 100+ entities or map objects to draw and each entity would need to look as though they could be standing in-front of any other entity, wouldn't that have a massive negative impact on performance?

Also when I say maintain the z-order of the tiles I meant that I have 3 layers in the TILED map, 1 for floor tiles, 1 for entity map objects and 1 for bridges so to say. libGDX renders it in the order of the layers to make it appear as though the entities are on the floor yet under the bridge. I should probably of made that part more clear.
4  Game Development / Newbie & Debugging Questions / Sprite render order using libgx tiled maps on: 2017-02-17 08:47:09
Okay, so I am officially stumped,

I am making a 2D top-down game using libGDX. I make my tiled maps using TILED.
Is there a way to order/sort the map objects so they display in the correct z-order on a specific object layer.
All I really need is for the one entity to look like they are standing in front of another entity on the same object layer.

I overrode the BatchTileMapRenderer so that the map object (which I made from another Entity class) are actually displayed when you render the map
public class MapRenderer extends BatchTiledMapRenderer{
    public void renderObject(MapObject object) {
        if(object instanceof Entity) {
            Entity ent = (Entity) object; ent.render();
            batch.draw(ent.sprite, ent.pos.x, ent.pos.y);

This is literaly all there is to it to render the map itself
    public void render(Camera camera){

The reason I want to do it this way is to keep it simple, and to maintain the z-order of tiles,
where if the player walks under a bridge the bridge is displayed above the player.

Any and all help would be welcome... even if to just tell me I'm doing it wrong
Many Thanks.
5  Game Development / Newbie & Debugging Questions / Procedural (never ending) map generation on: 2016-03-17 12:00:15
Hi all,

Pretext: I have minimal experience on this part of game dev and very little time to do research and what not, so I only ask that you all be kind to me in the search for wisdom and knowledge Smiley

Moving on...
I have (briefly) read up on perline noise and diamond square and such, all the normal things you get from simply typing "procedural terrain generation" into google. However non of these strike me as being procedural. What I would think is that procedural means never ending, so you can jump on a map at [0,0] and walk forever north with no limits, no edge of the map. In ALL the examples of procedural generation I see people create a height map for a terrain and leave it at that. I would call that random map generation, not procedural because it has a map edge. This is also not because they used only a snip-it of the map but the source code supplied to generate the map requires a height and width as a parameter.

I would like to know how to do a procedural (never ending) map, that is my goal. To start at [0,0] and generate terrain while the player moves north. There are many games that have done this but no where have I been able to find any resources to help me make a tiny version of what these games do. Taking Minecraft as an example, it generates chunks around the player while the player moves around the map. I have done something similar with little success in that the chunks don't actually fit next to each other.

The closest I have gotten so far is using the chunk idea, by showing only 9 chunks around the player and generating the chunks that the player moves into. The trick now is to make the map cohesive with the chunks next to it. I just have no idea how to do that.

Any pointers, any help, any links, even criticism are all of use,
Thanks all.
6  Game Development / Newbie & Debugging Questions / Re: movement key press on: 2013-10-31 11:01:58
this is how I had it originally, but this allows players to move in diagonal lines... and that is now what I want... I need it to move in only one direction at a time
7  Game Development / Newbie & Debugging Questions / movement key press on: 2013-10-31 09:53:41
Hi all,

My question is how do I make a character move in only the direction of the last arrow key input.

So if you press up the character moves upward and then press left without letting go of the up arrow, the character stops moving up and then moves left instead. I have tried and I presume the solution is incredibly simple but it just doesn't want to reveal itself to me.

Here is the code I currently tried, it works but only in one of the axis, when moving up or down the character will change direction if you press either the left or right keys. However if you start with the left or right keys, then the character doesn't change when you press the up or down.

           if(input.left.isPressed()) mx--;
      else if(input.right.isPressed()) mx++;
      else if(input.up.isPressed()) my--;
      else if(input.down.isPressed()) my++;

I have also tried to make it that when you press one of the arrow keys all the other keys are released and that had the same result as this code, one axis it works and the other it does not.

Sorry if it is difficult to understand the question, my brain is fried from trying to figure this out, the quality of the question could be ruined because of that.
8  Game Development / Newbie & Debugging Questions / Re: Appending Perlin maps on: 2013-10-15 07:51:42
is there an example on how to do this, linear hash border thing?
9  Game Development / Newbie & Debugging Questions / Re: Appending Perlin maps on: 2013-10-15 07:43:52
well I suppose to give the question a but more of a standing point... minecraft generates its terrain in chunks of 16x16 blocks, right.  I am only interested in how they managed that, I doubt they made a massive map and just portioned it off... and I realise they probably use many layers of noise but I only want to know that top piece with the sea beach, land, grass and all that...
10  Game Development / Newbie & Debugging Questions / Re: Appending Perlin maps on: 2013-10-15 07:30:28
yeah I read another article on this site that said perlin noise is often mistaken by value noise... However I really cannot tell the difference... fractal noise, value noise and perlin noise all look the same to me...
11  Game Development / Newbie & Debugging Questions / Appending Perlin maps on: 2013-10-15 06:23:45
Hey everyone, got a bit of a question.

I am using a perlin noise function to generate a map of some form, i don't mean to be vague but I am such a newbie with noise generation that I don't actually know how to explain the question in full...

My perlin noise code comes from this site if it helps any:

My question is, how can I make a tiled noise (i know it's been asked but every one they assume "tiled" means to make it copy paste side by side...) as in I make a map with say 100 width and 100 height... but I want to make another 100x100 map to append to either one of the 4 sides and make it seem as though it was always meant to be a 200x100 map...

sorry if my explanation is not 100% right but hopefully you can help me at least with starting off in the right direction.

Note: I don't want to make 1 tile that just repeats over and over, I want to make tiles that merge with the one next to it, like the left map which has half a lake will have the other half on the right map

hope that's clear enough, thanks everyone anyways oh and also I can't put pictures or code or links because I am using my phone to post this.
12  Game Development / Newbie & Debugging Questions / Game Versioning or Numbering on: 2013-05-07 06:14:41

I've done a bit of searching and I know this might seem like a bit of a dull question but... how do you decide on version numbers? For example using a 3 stage version number (if thats the right way to say it) like X.X.X how do you decide which one do increment?

Thanks for the help,
13  Game Development / Newbie & Debugging Questions / Re: blocks in a tile game on: 2013-05-06 08:10:05
well that didn't work... and then it did work...

I removed "blocks" and just made the sign an entity and now everything is working as I wanted it too. Thanks Zhon for the help.
14  Game Development / Newbie & Debugging Questions / Re: blocks in a tile game on: 2013-05-03 05:47:46
That doesn't sound like a bad idea, I might need to make a blockManager class then to determine which block it is and what action to take when the player uses that block... like it would see that the block is a fence and then it would run a use method to open or close the fence but only change the data on that instance of fence... I'll have to just try and see  Grin thanks for the help I'll let you know if I managed to get it working. I'm trying to keep it as simple as programmably possible.
15  Game Development / Newbie & Debugging Questions / blocks in a tile game on: 2013-05-02 14:27:03
Hi all,

What is the best way of implimenting blocks into a tile oriented game? blocks like fences, sign posts, chairs maybe and generally things that have unique data to each block. for example each sign post has unique text attached to each one. The way I have it implimented now is giving me trouble with the unique block.

I've got it implimented in the same way my tiles are, the tile class initiates all the tiles. Heres a code snippit of what I mean.
FROM Block.class
public class Block{
   private static SpriteSheet spriteSheet = new SpriteSheet("/spriteSheets/block_sheet.png");

   public static Block[] blocks = new Block[256];
   public static Block empty = new blockVoid      (spriteSheet, 0xFF00FF00, 0);
   public static Block fence = new blockFence      (spriteSheet, 0xFFFF0000, 1);
   public static Block sign = new blockSign      (spriteSheet, 0xFF, 2);

this doesn't really allow for individual setup because if you change it there then it changes for all of the objects.

Thanks for the help,
Pages: [1]
EgonOlsen (79 views)
2018-06-10 19:43:48

EgonOlsen (59 views)
2018-06-10 19:43:44

EgonOlsen (78 views)
2018-06-10 19:43:20

DesertCoockie (261 views)
2018-05-13 18:23:11

nelsongames (160 views)
2018-04-24 18:15:36

nelsongames (158 views)
2018-04-24 18:14:32

ivj94 (901 views)
2018-03-24 14:47:39

ivj94 (162 views)
2018-03-24 14:46:31

ivj94 (813 views)
2018-03-24 14:43:53

Solater (177 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!