Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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] 2 3 ... 26
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-12-01 16:28:41
Yeah it sure is great looking Grin
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-11-30 15:45:29


The past days I have added three different types of weapons (burst cannon, plasma torpedo, flak cannon) to my game. The weapons are fully operational: they aim towards the cursor (as far as the weapon type allows), fire bullets and the bullets impact and eventually destroy modules on the enemy ship.

In addition, I have added a nice configurable effects system that lets me add special effects (combinations of particle emitters) easily through editing a json file.
3  Game Development / Newbie & Debugging Questions / Re: Strange 9 patch black borders issue - libgdx on: 2014-11-18 12:12:21
Some possibilities:
- the transparent pixels along the border are not fully transparent
- you do not load it as a ninepatch (can you show us some code?)
4  Discussions / Miscellaneous Topics / Re: Buying "Complete" games is official dead on: 2014-11-07 20:16:48
The computer games market has grown up.

McDonalds: buy crappy and unhealthy food for a high price.

Need for Speed The Crew: buy crappy and unsatisfying DLC for a high price.

Both the food at McDonalds and the gameplay at Need for Speed (or any other pay to win game) are designed with one goal in mind: extract as much money as possible from the gullible majority who is unable to grasp the money-farming tactics used.

The food is salty to make people thirsty and to increase soda sales, and the soda is sugary to speed up digestion and make peope more hungry. The gameplay is tuned to lure players into the game at a low entry price (or *cough* "free" *cough*), make them addicted to the progression and then slowly tuning up the difficulty so that there is no other realistic option than to buy moar DLC, even though theoretically you could play the entire game for "free" .... if you enjoy mindlessly grinding for a couple of years.

It's capitalism, it's business, and it's fine as far as I'm concerned. I do not like fast food, I believe the business models behind it are unethical, and neither do I like the fast food equivalent of games. Running a business like that is bad for your soul. But it's how businesses work.

However, luckily, with rising awareness of unhealthy food and pay-to-win games some of the customers choose to buy quality food and buy quality games. Often quality food can be found in small-scale local shops, and often real quality games can be found with small-scale independent developers. It's how it works: business gets too large, the money milking machine takes over. Just know how it works and make your own choices on what you eat and what you play.

And choose: you want to run the game-development equivalent of a fast food restaurant (easier to make money) or of a local quality food shop (much harder to make money).

p.s. Gibbo, loved your mad photoshopping skillz bro Grin
5  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > Now on Steam! < on: 2014-11-07 19:42:52
Do you guys seriously think any user ever looks at a version number? Maybe a handful of modders, otherwise nobody cares Wink
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-11-06 20:51:08
Blogged a little about how great Star Control 2 is, and I added rudimentary weapons and damage to the Coreward prototype. So far it's working well but missing special effects, and ship damage is not handled completely yet (energy systems stay functional even though they should be damaged):
7  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-11-05 18:20:44
I've added a simple console the my in-progress-game that makes it easy to set several balancing parameters and turn off and on debugging features. It's quite helpful in speeding up development:


Also, looks interesting, theagentd, even though I still don't get it Wink
8  Discussions / General Discussions / [duplicate] Re: Great reading material: Game Programming Patterns on: 2014-11-04 14:13:58
Ah, sorry, never mind then  Wink I missed that post. Thanks!
9  Game Development / Newbie & Debugging Questions / Re: Libgdx JSON saving problem? on: 2014-11-04 12:35:26
It's also not clear to me what the problem is. Could you specify what you mean by "all of the tasks within the facility are different, as if they have generated all new ones"? Because I have no idea what the result looks like.

As for this:
Output of old task vs. new task:
1  
2  
com.fanger.zombie.FacilityTask@327a5b7f
com.fanger.zombie.FacilityTask@7f0d08bc

This is not unexpected to me. The number you are seeing behind the @ sign is the object's hash code, which by default in most cases is the object's internal address. If you serialize an object, then deserialize it, you in fact create a new object (which is identical to the old object, but may be located somewhere else in memory). At least, that's how I always understood it to be.

As far as I know the LibGDX json serializer is not really smart enough to serialize references to objects (please correct me if I'm wrong), which means that if your save structure contains multiple references to the same object (e.g. many buildings refer to the same task objects) then things will get messed up. While serializing, every single time the task is encountered it is serialized to disk as a seperate object. When deserializing, these objects are instantiated again, but now as many seperate task objects instead of one. Maybe this is the problem you are having.

One way to fix this is to use custom serialization and assign ID's to your task objects, then reconstruct everything while deserializing. This is a bit messy, though. An alternative, and better, approach would be to use another serialization approach, e.g. just using Java's default serialization(which is actually quite good and easy to use) or use a library such as Kryo which is really fast.
10  Discussions / General Discussions / [duplicate] Great reading material: Game Programming Patterns on: 2014-11-04 07:02:33
Bob Nystrom just released a book on game programming patterns,  you can buy a physical book, ebook or read it online for free. It looks really interesting I must say, great for learning more about architecture of games:

http://gameprogrammingpatterns.com/
11  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-30 10:49:26
@Grunnt
Are you adding the electricity system tiles by code, or during gameplay? And how do YOU iterate the system, iterate the node tiles by calling the tick method?

Btw looking super great there, i wish i was that far Tongue

Thanks Wink This thing is progressing quite nicely, but it's actually the second attempt at a game like this (first one was a design-and -crash-your-own-moonlander-type thing which I didn't think through good enough and did not work out very well).

On how I do this: here's some code I use. First of all, I build the energy networks whenever I spawn a new ship (which is based on a design). Also, I will probably have to do this, or something like it, whenever blocks on the the ship are damaged or repaired. producers is an array filled with all generators in the grid (I just do a full scan of the grid to find them). temp is an attribute of the Ship where I store the things that do not need to be saved but can be generated based on the saved data, like the energy networks.
1  
2  
3  
4  
5  
6  
7  
8  
  // Build energy networks starting at the generators
      while (producers.size > 0) {
         Cell producer = producers.pop();
         if (producer.temp.eNetwork == null) {
            EnergyNetwork eNetwork = buildNetwork(producer);
            temp.eNetworks.add(eNetwork);
         }
      }


Each network is built by doing a flood fill from the selected generator outward. Along the way the total generator output and buffer capacity is calculated:

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  
32  
EnergyNetwork buildNetwork(Cell producer) {
      EnergyNetwork eNetwork = new EnergyNetwork();
      Array<Cell> queue = new Array<>();
      queue.add(producer);
      while (queue.size > 0) {
         Cell cell = queue.pop();
         // Is this an energy cell?
         if (cell.temp.eNetwork == null
               && cell.module != null
               && (cell.module.design.eConduit || cell.module.design.epsGenerated > 0f
                     || cell.module.design.epsConsumed > 0f || cell.module.design.eBufferSize > 0f)) {
            ModuleDesign mDesign = cell.module.design;
            // Add surrounding cells to queue to examine whether these are connected as well
            addSurroundingCells(queue, cell.gridX, cell.gridY);
            // Add to totals of network
            if (mDesign.epsGenerated > 0f) {
               eNetwork.eGenerators.add(cell);
               eNetwork.epsGenerated += mDesign.epsGenerated;
            }
            if (mDesign.epsConsumed > 0f) {
               eNetwork.eConsumers.add(cell);
               eNetwork.epsConsumed += mDesign.epsConsumed;
            }
            if (mDesign.eBufferSize > 0f) {
               eNetwork.eBuffers.add(cell);
               eNetwork.eBufferSize += mDesign.eBufferSize;
            }
            cell.temp.eNetwork = eNetwork;
         }
      }
      return eNetwork;
   }

And some supporting functions for the flood fill:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
 void addSurroundingCells(Array<Cell> cells, int gridX, int gridY) {
      addCellIfExists(cells, gridX - 1, gridY);
      addCellIfExists(cells, gridX + 1, gridY);
      addCellIfExists(cells, gridX, gridY - 1);
      addCellIfExists(cells, gridX, gridY + 1);
   }

   void addCellIfExists(Array<Cell> cells, int gridX, int gridY) {
      if (gridX > 0 && gridX < design.width && gridY > 0 && gridY < design.height) {
         if (this.cells[gridX][gridY].module != null) {
            cells.add(this.cells[gridX][gridY]);
         }
      }
   }


And once I have this I update the networks each game loop by determining consumption and calculating the effectiveness of devices that consume energy from the network:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
 // Update energy production and consumption
      for (int i = 0; i < temp.eNetworks.size; i++) {
         EnergyNetwork eNetwork = temp.eNetworks.get(i);
         eNetwork.epsConsumed = 0f;
         for (int j = 0; j < eNetwork.eConsumers.size; j++) {
            Cell consumer = eNetwork.eConsumers.get(j);
            if (consumer.controlActive) {
               eNetwork.epsConsumed += consumer.module.design.epsConsumed;
            }
         }
         eNetwork.eBuffered += eNetwork.epsGenerated * delta;
         float consumption = eNetwork.epsConsumed * delta;
         if (consumption <= eNetwork.eBuffered) {
            eNetwork.eBuffered -= consumption;
            eNetwork.effectiveness = 1f;
         } else if (consumption > 0f) {
            eNetwork.effectiveness = eNetwork.eBuffered / consumption;
            eNetwork.eBuffered = 0f;
         }
         if (eNetwork.eBuffered > eNetwork.eBufferSize) {
            eNetwork.eBuffered = eNetwork.eBufferSize;
         }
      }


Effectiveness is for example used when determining the number and speed of particles generated by thrusters, and the force which thrusters apply to the ship body:

1  
2  
3  
                  float force = cell.module.design.thruster.force * Attributes.THRUST_FACTOR
                        * cell.temp.eNetwork.effectiveness;
                  ship.body.applyForce(ship.body.getWorldVector(tempVec), tempPoint, true);


And that's it. It's not the prettiest or fanciest solution, but it works quite well for my case.
12  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-30 06:58:29
Great stuff Smiley I like the tick-wise solution by Riven, it's somewhat like the spread of water. Easy to understand.

Here's what I ended up with (note this is a simple approach where the production, consumption and buffering is handled cumulatively: as in I just add everything up). However, networks that are not connected behave independently. Also, the network graphics give an indication on the state of the network: the left network is empty (buffer and lines are dark), while the right network is full (everything glows more brightly).



Later I'll add damage: as blocks get destroyed the network may get interrupted and hence I need to recalculate / split networks in such cases.

Edit: the indicators in the top-left are broken at the moment
13  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 13:07:21
I wouldn't implement that with any node-tree system. My system would simply be implemented with two arrays containing the Consumers and Producers:
1  
2  
3  
4  
public class EnergySystem {
  private final ArrayList<Consumer> consumers;
  private final ArrayList<Producer> producers;
}


And if you build a wire that is not connected to anything, that creates a new EnergySystem.
If you connect a wire to a wire, that wire is going to take the EnergySystem of the wire it's connected to.
If you connect a wire to two or more wires, that wire merges the EnergySystem of all the wires it was connected to.
If you connect a consumer or producer to a wire, it's added to the array of the EnergySystem.
If you remove a wire, you need to split the Energy system. Thats the only thing that might be a little tricky Smiley

Yeah that's precisely what I'm doing. Splitting energy systems is indeed a bit of an issue, but it's pretty easy to update the networks using a flood fill search.
14  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 11:53:15
I have seen your node tree solution and i found a possible problem

Good point. I think it just depends on how you process the node tree. My plan was originally (before I thought of using a much simplified model) to go through the tree from consumers to producers ("upstream" if you like). Each move up the tree I would check the incoming energy (which may be from multiple sources/blocks) and outgoing energy (also possibly from multiple sources/blocks), and make some "smart" decision about that.

Will the Generator(2) affect the Consumer(1)? For example if the Consumer(1) does consume more, then the Generator(1) produces, will it take some power of the Generator(2)?

If consumer(1) knows about both Generator(1) and Generator(2) then a rule could for example be that it will take 50% from generator (1) and 50% from generator(2), or more if any of the generators is unable to supply 50%.

Will the Generator(1) affect the Consumer(2)? For example if the Consumer(2) does consume more, then the Generator(2) produces, will it take some power of the Generator(1)?

Same as the above. I was thinking of doing this by moving all energy one "step" from generators to consumers during one update of the network. The interval between updates would then influence how fast energy would move. With electricity, however, this is pretty much instant, so maybe it will not work well then.
15  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 09:59:13
I was grinding the internet the whole day, and i think i've come up with a very performant, simple technique, that will work for pretty much everything(power sources, switches etc).
It is basically a node tree, and when using recursion(allthough i still have to find out why recursion is told, to be such a 'bad' thing to do ? Oo )

There is nothing wrong with recursion in itself, it can be a quite elegant solution to many problems. However, the issue with recursion is that for each recursive call, some things get stored on the stack (a piece of memory where local variables are stored). So if you do many recursive calls (e.g. because you are parsing a large tiled grid using this approach) you may run out of stack memory and get exceptions.

So if you want to use recursion, you should be aware of this and ensure that there is an acceptable maximum "depth" of recursion. This means that the size of electricity networks must be limited somehow.
16  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-28 11:14:32
There's topics that are easy and topics that are hard. I think physics is generally a pretty difficult topic to do yourself, and I guess making somewhat realistic simulations of electrical networks is also pretty hard stuff.

I have now settled on an even simpler system: each seperate network of generators, consumers, buffers and conduits is collectively an "EnergyNetwork". For simulation I do not take the structure of the network into account, I just simply calculate total production, consumption and buffering of the entire network. If there is enough energy generated or buffered then all consumers work at 100% effectiveness, if it is less, then effectiveness goes down. Effectiveness is a variable that I then use when calculating things like generated thrust or torque.

Updating the network is then quite simple:
1. add generated energy to buffer
2. calculate total energy needed by all consumers in the network (buffer capacity and production output is stable as long as the network does not change)
3. if energy-need <= buffered-energy then effectiveness = 1
   else effectiveness = buffererd-energy / energy-need (if energy-need > 0)
4. subtract consumed energy from buffered energy (check if buffer is not < 0 or > max capacity)

And that's basically it. It's not useable for things like switches etc, though.

Creating the network is done using a "flood fill", starting from each generator in the grid. Every grid tile has a "visited" boolean that I use in the flood fill. So:
1. Clear "visited" flag of all cells
2. Go through entire grid, add all generators to a stack (or LibGDX Array)
3. while stack is not empty
    - pop topmost generator from stack
    - if generator is not yet visited, buildnetwork(generator)

The buildnetwork(generator) function then does the following:
1. Create a stack of cells to visit (visitStack)
2. Add the generator to the visitStack
3. While visitStack is not empty
   - pop topmost cell from visitStack
   - is the current cell not visited yet and an energy cell? (i.e. conduit to energy, producer, consumer or buffer?)
   - if true
     - add all surrounding cells (not outside grid ofcourse) to visitStack
     - add energy production, buffer size to totals in EnergyNetwork
     - add consumer cells to a list of consumers to quickly calculate energy consumption (which is dynamic since thrusters, etc may be on or off)
   - mark cell as visited

You can find more about this if you look into "flood fill" as a search term. This may not be what you are looking for, but I thought I'd share what approach I'm taking now.
17  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-27 19:05:21
I haven't 100% worked it out yet, so it may be a little time until I got a system working. The idea of creating a seperate model for the energy (/ electricity) network is that you can make it much simpler by removing all non-functional blocks in between producers and consumers and directly link those. Then I'll go from consumer to producer, moving energy one step (node) at a time.

Unfortunately, I haven't figured it out in enough detail yet to give you really helpful examples.

The idea is somewhat inspired by how Creeper World 3 transmits energy "pulses". A cool game, by the way.

Btw, i might have to investigate your technique for thrusting and torque calculation on tile based space ships later on Tongue

For the thrust and torque I just use Box2D (in LibGDX) with a little custom code for generating the Box2D shapes based on the ship tiles and for applying force on the location of the tiles that contain thrusters. The shape generation code is pretty simple, but works well (I go through the grid line by line and create square shapes basically, then add each square shape to the ship body).
18  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-27 10:55:55
I've been thinking about a similar system for the power systems on my prototype ship design / shooter game. The general idea would be that energy flows from generators (optionally via buffers) to consumers.

The approach I'm now thinking of requires a simple algorithm to be run after a block/tile is placed or removed:
1. Start from one of the generators (does not matter which one). This will form an energy network, lets call it network "A".
2. Do a "fill" from the generator outwards along all tiles that conduct energy, and for each tile:
   - if a conduit (only function of which is conducting flow of energy) do nothing and continue the fill
   - if generator, buffer or consumer, assign it to this network (say set attribute network="A")
3. Repeat from 1 for each generator that is not in a network yet untill all generators are assigned (creating network "B", "C" etc)

In addition, my plan is to construct a graph of connected nodes for each network while the above algorithm is running. The graph's "roots" would be generators, the leaves would be consumers, and in between could be buffers in any configuration (i guess there also could be switches etc).
A simple network could be:
1  
2  
3  
4  
5  
          Producer   Producer
             |          |
           Buffer       |
            /  \       /
     Consumer   Consumer


Energy flows from the top to the bottom. One consumer would then receive energy from both producers, with one source buffered (if consumption is lower than production), and the other consumer would only receive buffered energy from a single producer.

Constructing such a energy network graph would be somewhat expensive, but would only be needed during construction (or destruction, heh) time, whenever the network could be altered. Simulating the network operation would be much faster, as it would be a matter of following the graph from producers to consumers.

Anyway, I have no idea if you are thinking along these lines, but maybe it is of some us to you.
19  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-26 12:16:35
Found some time today in between baby & housekeeping to make some improvements to the prototype I'm working on. The thrust and torque is now applied to the ship model depending on where the thrusters and reaction wheels are placed. I also fixed many small issues. It runs smooth even with very big ships:
...
Holy shit. That looks like a merge of FTL and StarDrive. *___*

Also: Reminds me of Robocraft (currently playing that game, I really love it)

FTL was certainly an inspiration, and I loved stardrive (I guess the ship design part is also pretty like StarDrive's). I envision a mix between the two, I guess.

Robocraft looks interesting, but it's waaaay more advanced stuff than I'm making. Great stuff. I limit myself to 2D space top-down setting.
20  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-26 12:14:29
@Grunnt: Still reminds me of what I'm doing, in some aspects even more now, in quite some also better probably...

Hey Drenius, looks interesting! I have no doubt we're doing quite different things, though. I'm planning on this to be somewhat like FTL-meets-space opera, with the player controlling a single ship in detail and battling it out with one or a few other ships. Do you have a WiP thread or page about your game?
21  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-25 15:55:55
Found some time today in between baby & housekeeping to make some improvements to the prototype I'm working on. The thrust and torque is now applied to the ship model depending on where the thrusters and reaction wheels are placed. I also fixed many small issues. It runs smooth even with very big ships:
22  Discussions / General Discussions / Re: How to make an experience, not a game. on: 2014-10-25 09:46:15
A great story is just one of many ways in which a game can convey a message. Take, for example, Defcon: Everybody Dies. The "happy" website does not do it justice. The graphics are simple but the atmosphere is highly immersive. I cannot help but feel as if I am in a bunker somewhere, in command of a nuclear arsenal and helplessly fighting a nuclear war that nobody can win.

It's the subtle things that bring this message across extremely powerfully. Like the message whenever a nuke hits a city:



"Great! That was a good hit! But wait, did I just say hurray at killing 8 million people?"

The feeling is very much amplified by a simple monotonous humming sound in the background of machines in a bunker, and, sometimes, the sound of a woman softly crying.

The game creeps me out. And it makes me realise so strongly what an all-out nuclear war would mean as no other media has ever done (including documentaries about the horrors of the bombs on Japan in WW2). In a nuclear war, everybody dies.
23  Discussions / Business and Project Management Discussions / Re: [Help] Looking for: Project Management Software (web) on: 2014-10-25 09:20:53
You may also consider using mode than one kind of software for this. Bitbucket is quite good (and free) way to store code, assets etcetera, and perhaps do some issue tracking. For deadlines etcetera, perhaps use a shared Google calendar? Or just use the issue tracking and teamwork facilities of something like Bitbucket. Good old excel sheet on dropbox is also a reasonable option.

Good luck with that!
24  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LibGDX gaps between tiles when rotating them on: 2014-10-23 14:08:56
Thanks for the tip, I had thought of that as a possible cause. However, luckily, my Google-Fu-skills paid off and I found the answer. Turns out on the TextureAtlas that contains my tiles there's transparent pixels directly next to the tiles. While using linear filtering these pixels are also sampled and as a result the edge pixels of each tile are also made partially transparent.

The solution is easy, in case anyone else runs into this. Repack your textures using the duplicatePadding: true setting, which will duplicate the border pixels into the padding space next to it. The problem then goes away!

1  
2  
3  
4  
5  
6  
7  
{
      wrapX: Repeat,
      wrapY: Repeat,
      filterMin: Linear,
      filterMag: Linear,
      duplicatePadding: true
}
25  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LibGDX gaps between tiles when rotating them on: 2014-10-23 13:40:43
Hmm, that might just work. However, I would prefer a somewhat less hackish solution Wink
26  Discussions / General Discussions / Re: Give me a topic.. on: 2014-10-23 09:56:26
speedily snatching sparks
27  Java Game APIs & Engines / Engines, Libraries and Tools / Solved LibGDX: gaps between tiles when rotating them on: 2014-10-23 09:42:19
Hi folks,

I have run into an issue with a tile grid I cannot seem to solve: gaps / lines appear between tiles when I rotate the grid. I think it has something to do with texture filtering, but cannot figure out how to solve it. The grid is a spaceship built out of tiles (hence why the grid has to rotate).

Here's how the tile grid looks without rotating:

And here's how it looks while rotating:


I'm using LibGDX and the textures are on a texture atlas with the following pack settings:
1  
2  
3  
4  
5  
6  
{
      wrapX: Repeat,
      wrapY: Repeat,
      filterMin: Linear,
        filterMag: Linear
}


This is the code I use to render the ship / grid:
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  
Matrix4 m4 = new Matrix4();

   void drawShip(Ship ship, SpriteBatch batch) {
      float shipX = ship.body.getPosition().x * Constants.BOX2D_TO_SCREEN;
      float shipY = ship.body.getPosition().y * Constants.BOX2D_TO_SCREEN;
      float angle = ship.body.getAngle();
      m4.setToTranslation(shipX, shipY, 0);
      m4.rotateRad(0, 0, 1, angle);
      batch.setTransformMatrix(m4);
      int designWidthPx = ship.design.width * Constants.CELL_SIZE_PX;
      int designHeightPx = ship.design.height * Constants.CELL_SIZE_PX;
      for (int x = 0; x < ship.design.width; x++) {
         for (int y = 0; y < ship.design.height; y++) {
            Module module = ship.cells[x][y].module;
            if (module != null && ship.design.cells[x][y].topLeft) {
               TextureRegion tex = module.texture;
               batch.draw(tex, x * Constants.CELL_SIZE_PX - designWidthPx / 2 - Constants.CELL_SIZE_PX / 2, y
                     * Constants.CELL_SIZE_PX - designHeightPx / 2 - Constants.CELL_SIZE_PX / 2,
                     Constants.CELL_SIZE_PX / 2, Constants.CELL_SIZE_PX / 2, Constants.CELL_SIZE_PX,
                     Constants.CELL_SIZE_PX, 1f, 1f, directionToDegrees(ship.design.cells[x][y].direction));
            }
         }
      }
      m4.idt();
      batch.setTransformMatrix(m4);
   }

   public float directionToDegrees(int direction) {
      return -90f * direction;
   }


Does anyone have an idea on how I could resolve this?
28  Discussions / General Discussions / Re: development block on: 2014-10-21 19:11:20
Go away from your computer. Grab a piece of paper and start writing out what you want to do. Can you think of a prototype or minimal version of a game with minimalistic graphics and barely functional gameplay you could take as a starting point? Take that, then try to break it up into smaller parts, as Kevin suggested.  Wink
29  Game Development / Newbie & Debugging Questions / Re: Android Bitmap on: 2014-10-21 19:07:42
Never worked with Bitmap, but my guess would be that the width of bmp is less than 11 + 22 = 33 as would be needed in the last line.

Edit: because it makes a subselection starting at x=11, of width=22, so you would end up at x=33 for the right edge of the selection.
30  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-21 18:49:09
Added a nice background to my 2d spaceship designer-shooter. It consists of a number of layers: a static starfield in the back, a nearly static star, a slowly moving planet (which gives a clue to the player's movement when traveling long distances), and some "space dust" in several layers close to the screen which move faster and give a precise indication of how fas the player's ship is moving. Turned out pretty nicely.

Pages: [1] 2 3 ... 26
 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (33 views)
2014-12-15 09:26:44

Mr.CodeIt (24 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (46 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (61 views)
2014-11-29 21:32:03

toopeicgaming1999 (124 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!