Java-Gaming.org Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (649)
Games in Android Showcase (181)
games submitted by our members
Games in WIP (700)
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 ... 10
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-02-13 21:46:41
Played around with cabinet projection. It's not actually 3D, it's just three quads rendered like that because I'm scared of touching libgdx's 3D API.



E: Added a little angle animation thingy.
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-02-10 03:31:35
After working in 2D for the past five years, I finally decided to dabble into 3D. I followed xoppa's libgdx cube thingy and rendered a cube! Ultimately I actually chose the orthographic camera to render it and I like it more than the perspective camera, probably because I'm so used to 2D flat projections.
3  Game Development / Newbie & Debugging Questions / [libgdx] Changing tempo without altering pitch on: 2016-02-07 00:07:55
With the way sound works, changing pitch naturally changes the tempo and vice versa. Is there a way (using OpenAL) to change the tempo/speed of sound without altering the pitch too much? I read up on this a bit and it seems that it needs a lot of post-processing in order to not be so noticeable.
4  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-01-30 23:19:43
Added a way to change music pitch in libgdx (desktop only). The Music interface doesn't have a setPitch option because someone doesn't support it (probably Android) so what I did is probably a bit convoluted and not the best way but it works.

I have a custom LwjglApplication in the desktop project that is used for logging, so I added a custom executeRunnables method that the majority of is the same code from the original. It checks the runnable if it's a certain type of Runnable defined in the core project which has a Music object and float for pitch. If it happens to be that kind of Runnable, it will use AL to set the pitch from the music's source ID. Likewise this might work on other platforms (with a different implementation of setting pitch) but I haven't tried.

Is this bad? The other option I found was modifying libgdx source code which I wanted to avoid.
5  Game Development / Game Play & Game Design / Re: Generating large tile maps from 2d array? on: 2016-01-15 04:54:13
Generating the entire map at once isn't all that bad. It's a one-time thing, it's not like you're doing it every frame... right...?

3000x3000 is a lot. That's 9 million tiles. You're iterating through all of them each frame. What you should be doing is setting the bounds on the for loops so you're only iterating through the general area you're rendering. You can keep the intersects method, but I also advise you to not re-create a new rectangle object each frame and instead just modify the existing one.
6  Game Development / Newbie & Debugging Questions / Re: Level movement with Tile array? on: 2016-01-01 02:20:56
The default Java Graphics instance does have a translate method.

Basically all you would do is translate by the camera position, then translate back (negative camera position) to render UI stuff. This way you don't have to pass in camera coordinates for each renderable.
7  Game Development / Newbie & Debugging Questions / Re: Level movement with Tile array? on: 2015-12-31 01:49:55
You need to change the render positions, not the actual positions.

Since you're not using an engine, you could transform it all yourself. Just add something like

1  
2  
// in render code
g.fillRect(tileX * tileWidth - cameraX, tileY * tileHeight - cameraY, tileWidth, tileHeight);


This way everything gets offset by the camera. This is really tedious but if normal Java graphics has a translate method, you could use that instead.

Your code is working sort of. It's rendering only the parts where the "camera" see but nothing is actually getting translated as required.
8  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-12-30 16:51:53
Last night a M4.8 earthquake hit north-northeast of Victoria, Canada, 11:40pm PST. The Lower Mainland really felt it. Probably what was going through all our heads at one point was "is this the big one?"

Earthquakes can be scary man.
9  Game Development / Newbie & Debugging Questions / Re: Level movement with Tile array? on: 2015-12-30 16:47:02
The way games have the illusion of the player standing still while the world moves around him is not as literal as you think. Generally, the player moves as normal and the graphics instance is translated so that it is centred on the player. This is a camera, it's only rendering the things around the player, and is centred on the player.

What graphics library are you using? From your code it seems to be Slick but I'm not sure. If it is Slick, there is a translate method for the Graphics class you can use.

Oh, and refactor your loops like the others have been saying. It also helps to put comments down to know what your code is doing.
10  Game Development / Networking & Multiplayer / Re: what is a game snapshot on: 2015-12-30 05:01:24
You are correct, it is the state of the game at X tick of the simulation. Multiplayer games use multiple snapshots to compensate for latency.
11  Game Development / Newbie & Debugging Questions / Re: Updating tiles in all 4 directions on top-down level on: 2015-12-29 23:29:47
The ORs (||) in the on-to-off code should be ANDs (&&) since you're checking for "this block isn't a power one AND the next AND the next" etc.
12  Game Development / Newbie & Debugging Questions / Re: Updating tiles in all 4 directions on top-down level on: 2015-12-29 23:21:48
I saw that the onUpdate else statement is still in the (if this instanceof LampTileOff), which means nothing gets executed for if it's on.

Other tiny tidbits:
Here, don't create new instances of the font and colour each frame. It can quickly use up memory leading to lag spikes as the garbage collector does its job.

I've also noticed your tiles are individual per block (as in, there's a new instance for each cell). I thought you had a list of Tiles that had only one instance. It may be preferable to have a list of Tiles that are only instantiated once, and you can re-use the instance over and over again. This way your tiles don't need an X and Y passed to them in the constructor, only in update/tick methods. Rendering will then also require an x and y value to be passed in. Just multiply the x and y by the tile width and height (g.fillRect(x * width, y * height, width, height)). One-instance tiles will bode much better in the long run if your worlds are large and expansive.
13  Game Development / Newbie & Debugging Questions / Re: Updating tiles in all 4 directions on top-down level on: 2015-12-29 22:29:22
Your tiles extend the Tile class. The Tile class could have a method (abstract or not) called onUpdate(Level, x, y). All the tiles get this method called (including blocks that do nothing, but since the method does nothing it's okay). The LampTile tiles have an overriding method for onUpdate that does the check.

Example code:
https://gist.github.com/chrislo27/fd8eee43e917f5bc44b7
14  Game Development / Newbie & Debugging Questions / Re: Updating tiles in all 4 directions on top-down level on: 2015-12-29 21:23:06
If I understand your gist correctly, the tick() method is a tickUpdate method (X times a second) and the onUpdate() is the neighbour update.

In which case you could ditch the neighbour sending system altogether, and basically have the tile onUpdate take in an x and y coordinate, which is the coordinate of the block. The lamp tile should be looking for its neighbours since no other tile really depends on neighbours right this second. The other lengthier option is the have a metadata system which is an invisible same-sized grid of integers used for the tiles, and you could use 0 and 1 for on/off. However this doesn't really have much practicality, and in the long-run the dedicated tile classes would be ideal.

Hope that helps!
15  Game Development / Newbie & Debugging Questions / Re: Updating tiles in all 4 directions on top-down level on: 2015-12-29 20:58:50
This seems very minecraft-like, and minecraft has this "issue" (with pistons being powered diagonally not being updated, but that's a different story).

I think you would benefit if you had events for your tiles. That is, onBlockUpdate (when a tile changes, the directly adjacent tiles get onBlockUpdate called). In order to efficiently implement this, you could have a setBlock method for the Level class which will call onBlockUpdate for you, rather than directly changing the array.

Then for your lamp tile: you could have two of them sharing a common base class (LampTile): an on and an off state. In the LampTile onBlockUpdate event method, you would simply check adjacent to you (have a getBlock(x, y) thing too). If the lamp type is off, check for any PowerTile. If the lamp type is on, check for no PowerTiles.

Rather than implementing your onUpdate inside the Level class, you should be doing it in the Tile class as an abstract method so each block can have its own implementation.
16  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-12-25 04:42:00
It's weird how many similarities there are between Japanese and Chinese writing  Shocked

Yes, Japanese has kanji which are basically Chinese characters. They're used to shorten/differentiate words. Japanese itself has an alphabet (two actually, hiragana and katakana) and each kanji has a different pronunciation.
17  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-12-22 04:32:46
After a long spell of not doing anything because I didn't have ideas, I finally decided to just work on something. I decided to use libgdx's tmx loading system to load maps made with the Tiled editor, and it sped up my process immensely. All tile-related things were done in around half an hour, a task that would normally take me around a month to implement my own tiles, editor, etc. Conversation (essentially text scrolling per character) was nearly done, only branching dialogues is left. Movement and entities and collision and events (onOccupy, whileOccupying, onInteract) was done rapidly too.

That was the most productive I've been in a while. I want to try to give my friends a little copy of it by Friday and I achieved all my required Wednesday goals. All I need to do is really implement the first bit of the story and sprite some things.
18  Game Development / Performance Tuning / Re: Using the sun.misc.Unsafe class to do crazy stuff with the JVM on: 2015-12-19 06:03:21
Is there a way around this? Shouldn't it be fine, as long as the device has the latest version of Java installed?

The sun packages aren't technically part of Java, per say. They may be removed at any time, Oracle could stop supporting it and just ditch it, rename it to com.oracle.*, etc. The point is is that it's unsupported and should really be depended on.

If you want to fool around with memory management and special classes, go for it. We're just not recommending you use it in a project such as a game where other people will use it due to its unpredictable behaviour and future changes.
19  Game Development / Performance Tuning / Re: Using the sun.misc.Unsafe class to do crazy stuff with the JVM on: 2015-12-19 05:41:54
As with Phased's message above, it's also not part of the standard JVM, that is, different operating systems will have the sun packages implemented differently, and your code will throw a ClassNotFoundError if the code runs on a non-Sun supported JVM. This essentially defeats the purpose of Java (being able to run on all platforms seamlessly).

Here's a fairly good SO question and answer to this same question.
20  Games Center / WIP games, tools & toy projects / Re: Shard Master Classic - WIP on: 2015-12-07 05:13:49
Best to worst: 0, 3, 2, 1. A little bug I found was after switching modes some modes would blend into each other (only case I had was drag mode and AD mode stuck together. Mode 2 didn't use my QE keys, but rather the R and F keys (I use a QWERTY keyboard). Drag controls are okay, I would suggest putting it on right or middle click, but not left click since that's your interaction button. Also, input sometimes doesn't register (I think it's because you're polling and not using events).

I also got stuck in an evergreen tree (same way NegativeZero got stuck in water), but I saw that you're looking into it.

I actually rather like the idea of mode 3 and 0 together. AD would rotate the character and move the camera, but drag would move the camera and offset it. This way you could have the camera looking in a different direction relative to the player.

Nice job so far!
21  Discussions / Miscellaneous Topics / Re: Benchmark this JAR - yes, a Vangard demo! on: 2015-12-05 18:02:29
Intel i3-4150, 3.50 GHz
GTX 750Ti
1920x1080 resolution

Zoom 75: Logic at 5-6, render at 1
Zoom 10: Logic at 5-6, occasionally 7, render at 1
Zoom 1: Logic at 7, render at 11
22  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-11-21 04:16:01
I spent a few hours trying to figure out why Gradle in Eclipse was being odd and utterly destroying my projects by making them unable to do anything Gradle-related. Turns out the Buildship plugin tends to clash with an already existing (and better) plugin by overwriting properties and the .project file to suit its own liking, so all I need to do is uninstall it, right?

Uninstall doesn't work in the Install New Software window, and for some odd reason there was no plugins nor features folder in my eclipse installation.

Three reinstalls later: I find out that the installer uses pools to avoid downloading the same program over and over again, essentially copying my problem. Turned that off, my folders are back. I delete Buildship, all is well now except for the fact that running the Refresh All on gradle causes the project to fail to compile [the script]. Some more googling later turns up that the old syntax for Gradle 2.4 for multiple source directories doesn't work, and 2.9 requires a new syntax. Fixed that, everything is finally fine.

That took way too long.
23  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-11-15 03:52:39
This is the third project in a row to lose inspiration in. I keep doing this because I have no real goal to achieve. I wish I could find a better project to have fun on.

All I got done was some backend collision and rendering. I also decided to (finally) animate a robot I used as my main player sprite ever since I started with LibGDX just over a year ago.

gif
24  Discussions / Miscellaneous Topics / Re: Bought the Humble Bundle so I could play Insurgency; here's the rest of it. on: 2015-11-01 23:43:25
Could I have a copy of RFLEX as well?
25  Game Development / Newbie & Debugging Questions / Re: Yet another stuttering problem on: 2015-10-26 15:07:31
This problem is fairly common, especially in multiplayer games where the tickrate is much slower than the framerate (take Team Fortress 2, for instance where the default tickrate is 20, and the normal framerate 30-60).

The solution to this is interpolating your visual position between frames. When you update your positions, you can update the actual ones, but interpolate a "visual" position which only exists for where the sprite should be drawn.

If your tickrate is 20 ticks per second, and you're assuming the framerate will be at around 60, you'll have to interpolate between the old and the new position in thirds (because there are 3 frames until the next update is executed).
26  Game Development / Newbie & Debugging Questions / Re: Terrain Saving and Loading on: 2015-10-19 00:43:43
A chunk-based system works well for on-the-fly saving-and-loading from a file (Minecraft does it). You're dividing the world into X by X sections of tiles.

You also mentioned that you're saving your tiles in an ArrayList. You could use a 2-dimensional array instead.

1  
Tile[][] tiles = new Tile[world_width][world_height];
27  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Manual Libgdx Project Creation on: 2015-10-15 23:26:38
The build tool lets you only select the desktop project if you need just it. It would be much more difficult to set up a project manually.

You only need the three Gradle projects: the encapsulating one that does dependencies, the core project, and the desktop project). Yes, it's not one but if you decide to get deeper into Gradle the setup is very handy.
28  Discussions / General Discussions / Re: On-site IRC error on: 2015-10-12 17:16:44
A few people noticed it but it was not publicly mentioned yet AFAIK (since, you know, IRC public log is down).
Also, is it normal that the main page's content block is stuck to the left?

I think the content used to span most of the width of the page (or maybe I'm wrong).
29  Discussions / General Discussions / On-site IRC error on: 2015-10-12 16:33:23
I've no idea if this was mentioned already and I'm just blind, but here we go.

The IRC chat thingy on the front page of the site has an error.



No featured games/shameless plugs are appearing on the right-hand side, but if they were never there to begin with, my bad.

I should also mention that if a new post is posted, the update top thingy doesn't appear only on the front page, but appears on the others.
30  Game Development / Networking & Multiplayer / Re: Kryonet - how to recognize a packet type? on: 2015-10-11 16:43:26
I would highly recommend just having a common method that accepts the Kryo instance as a parameter, and in that method registering all your classes. Then from your server, call that method, client as well.
Pages: [1] 2 3 ... 10
 
KaiHH (13 views)
2016-02-14 15:51:05

KaiHH (167 views)
2016-01-31 23:15:29

sci4me (158 views)
2016-01-23 21:47:05

sci4me (143 views)
2016-01-23 21:46:58

KaiHH (177 views)
2016-01-19 13:26:42

theagentd (261 views)
2016-01-05 17:10:00

ClaasJG (278 views)
2016-01-03 16:58:36

chrisdalke (270 views)
2015-12-28 06:31:21

Guerra2442 (278 views)
2015-12-25 03:42:55

Guerra2442 (282 views)
2015-12-25 03:27:21
List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48
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!