Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
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 / Game Mechanics / Re: Perlin Noise (Infinite) Biomes? on: 2013-12-23 20:02:07
I did similar with a "round" world generator I was playing with, I put the world through a few passes of a check for how many points around it. Checking 8 around it would work for smoothing, but not for removing the small biomes. To do that you would need to use a wider area to check.

From my testing, the wider the area, the more small areas are cleaned up, the more times it is run, the smoother the edges. One difference with my generator is that this was done at the end of each step, as my world generator subdivided until it reached full size. ( Square-Diamond algorithm)

Here's an example of before and after:

As for getting it to work on infinite generation, just don't perform the smoothing on the outer edge, so there's always something to sample. Make the border is as wide or wider than your scan range, so you never try to access outside of what's generated (if 17x17, or 8 radius, then atleast Cool

Of course this isn't always the fastest ever, so you have to balance accuracy and speed.
2  Game Development / Shared Code / Re: Smooth build - build system for java projects on: 2013-12-13 16:26:39
I'm not sure whether I understood you at the very beginning.
Having two files game/lib/file1.jar, game/lib/file2.jar then the following function:
result: files("game/lib") || moveFile("bin") | zip ;
... will create zip file containing two files "bin/file1.jar" and "bin/file2.jar".
This is because files("some/path") creates array of files with path that have "some/path" removed.
Ohhh, okay. I had assumed that it preserved the path. That makes sense then.
3  Game Development / Shared Code / Re: Smooth build - build system for java projects on: 2013-12-13 15:22:10
Sorry for late reply. Somehow I didn't get notification about your new post in this thread.
Most likely because I'm using plain quotes instead of ones with your name, this one should notify you Tongue

You are right, smooth way of doing it would be this:
files("game/lib") || moveFile("bin")
I would rather name it prefixPath - feels more natural in functional world.
The only issue with that name to me is, taking it literally, it sounds like it would just be adding the new path to the beginning of the existing one, as opposed to removing what is there and replacing it.

The problem is that it's much trickier to get right than it looks. Following problems need to be solved/decided (I assume we have project/build.smooth that calls project/subproject/build.smooth).
Ya, when thinking more about it, I realized another issue. You would have to do more than just include the scripts, as all paths within that subproject would be relative, and incorrect in the main project. Not an overly needed feature any ways.

One possible alternative, to add a "build(String root,String target)" where the root is the subproject directory, and the target is what to build. You could just run the new build process, wait for it to finish, then load it's output as if file or files was run on it.

Anyway there's a few more urgent (more useful features) like parallel piping, multithreading etc. However if you convince me that script including is your favorite feature I can reorder my priorities
No pressure from me, I agree parallel piping is definitely a more useful feature. I'm not doing anything overly elaborate myself right now, just putting in some ideas.
4  Game Development / Newbie & Debugging Questions / Re: How to get the tiles around a player for collision detection? on: 2013-12-12 04:57:19
The issue is most likely due to you only detecting the 4 neighbouring tiles. You should check all 8 around you. The way you described it sounds like your player's centre is too high(or too far left) for it to check the tile it is going through. Until it gets halfway through the tile, you are checking the empty tile next to it for collision.

I'd suggest checking the 8 tiles around the player, instead of just 4.
5  Game Development / Newbie & Debugging Questions / Re: Dynamic Texture Atlas (LWJGL) on: 2013-12-11 22:21:41
Updated the topic, I figured it out, it was because I set "GL_TEXTURE_MIN_FILTER" to "GL_NEAREST".
6  Game Development / Shared Code / Re: Smooth build - build system for java projects on: 2013-12-11 19:04:36
Sheesh I did some bad explaining, now to clarify  Lips Sealed

And does the "dir" function work as I intended then, making a directory with the name dir? Or would I have to add newFile to the end of it as well?
When I said this, I meant "bin". From what you've said though, it would seem not. In the previous code example, I wanted all the files listed in "bin" to be put into a directory named "bin". As I can see it, the only way would be to use the following:
    [ newFile(toBlob(game.jar), "bin/game.jar"), newFile(toBlob(util.jar), "bin/util.jar") ] ;

Of course this could be done without toBlob if I removed the newFile at the end of each jar function. This is probably a much cleaner way of doing what I want.

The issue comes when wanting to move the lib files I loaded into the bin directory. At the moment I think I would have to load each seperately, until the parallel piping is implemented(I am assuming it would output results back as an array?, and even then I'm not sure how well it would work. Maybe a "moveFile(File,String)" that keeps the files name and replaces the path before it with a new string?

(EDIT: So 'files("game/lib") || moveFile("bin")' would change "game/lib/lwjgl.jar" to "bin/lwjgl.jar", for instance)

Thinking which, is it currently possible to "include" another build script? Would be much cleaner if I could just include the util project's script instead of rewriting it into the game.
When I said include another build script, I meant another Smooth script. I was thinking along the lines of having multiple smaller projects as part of a whole, each with their own "build.smooth", and having each of them included into the main project's "build.smooth" file.
7  Game Development / Newbie & Debugging Questions / Dynamic Texture Atlas (LWJGL) on: 2013-12-11 18:41:08
I've been having an issue with getting things rendering for a few days now, and after testing, I can narrow it down to the function causing it. The "stitch" function inside my TextureAtlas class seems to be breaking the display, as after running it, nothing will render. I cant even draw a simple solid quad or tri to the screen.

The way it works is simple, you request textures by name, and then stitch them together. The "stitch" function collects data on the textures first, calculates what it will need, and then loads them one by one and adds it to the texture. This seems to work perfectly, as the saveAtlas command confirms that everything is there, albeit with far too much wasted space.

Here's the code, anybody have an idea what I am doing wrong, that is making rendering stop working?

EDIT: Figured it out, apparently it was because I set GL_TEXTURE_MIN_FILTER to GL_NEAREST. Any idea why this is? I have used this setting before and it worked fine. I'll be leaving it at default now I guess Smiley

EDIT2: Okay, even wierder(to me anyhow), is that once I got white shapes rendering, I still couldn't get textures. I found a few small mistakes in my code, such as not flipping the buffers and not casting an int to a float. Even after these, the square was still white, so I returned the code I previously removed, and it works again. Why is it that untextured primatives won't render with the filter set to nearest, but textures wont render without it?

Another thing that would be nice, can anyone think of another method of creating the atlas' "canvas", so to speak? I previously had it only shifting to the next power of 2 when the total volume of the textures was > than the volume of the atlas, but that can lead to the issue where having exactly enough space doesn't mean they can all fit. I'm sure it could still happen with the current system, but its much less likely. My main issue is all the wasted space on the atlas due to it, generally most of it is empty.

Just a note, I am aiming for a low GL version requirement, I would like to be able to play my games on my lower end computers, such as my netbook, which has GL1.4. Also, I plan to open source my "util" code so if anybody likes it, feel free to use it.
8  Game Development / Shared Code / Re: Smooth build - build system for java projects on: 2013-12-11 17:06:30
Getting to understand the inner workings of this a bit better from this Smiley

Okay, newFile would fix most my issues, however it seems to currently only make plain text files, as the content parameter is a String. Smooth isn't able to convert the blob to a string, so it fails. Maybe make it take a blob, and give Smooth a way to convert a string to a blob if needed?

And does the "dir" function work as I intended then, making a directory with the name dir? Or would I have to add newFile to the end of it as well?

Also, that was just something I pieced together for the post, it isn't an actual project. Its structured based on using smooth in my workspace directory, as I use eclipse and have a "util" project for most my common code. I may change the build.smooth so that it is used inside the game's project directory, and just add a symlink to the other project.

Thinking which, is it currently possible to "include" another build script? Would be much cleaner if I could just include the util project's script instead of rewriting it into the game.

cases like this:
game.classes | concatenateFiles(with=files("game/res"))
are a little more tough, Note that we can get rid of pipe and rewrite it this way:
concatenateFiles(game.classes, with=files("game/res"))
which is shorter version of
concatenateFiles(files=game.classes, with=files("game/res"))
So you can omit "files" because smooth will notice that parameter "with" is assigned explicitly so the only one left ("files") must be assigned from the only available argument. You cannot however skip both parameter names because they have the same type so smooth won't know which argument goes with which parameter.

I actually used the "files=" version before as well, but just preferred how it looked using pipes. The "+" method definitely seems the cleanest way to go about it though.

EDIT: Ah seems you noticed the issue with newFile, not exactly in a rush, don't worry about it Smiley
9  Game Development / Shared Code / Re: Smooth build - build system for java projects on: 2013-12-11 14:55:42
If you want an "all" function that builds 3 jar files you can to it this way (I skipped definition of file?.jar functions):

file1.jar: ....
file2.jar: ....
file3.jar: ....
all: [ file1.jar, file2.jar, file3.jar ];

running "smooth build all" will create result that is a dir with all 3 files inside. This way script describes exactly your intentions: You want function ("all") that builds 3 files, each file is built by specified function.
Hmm, Okay it sort of works with using the array, making a folder, although I'm not sure I like that way. I want a build all so it just builds everything, but this way it wont update the same files as running each individually, instead it makes the "all" directory with the outputs. All the outputs are also just numbers, a directory with 0, 1, 2, etc., I'm assuming its their index in the array.

A similar issue with the "build all" though, if I want to have instead a "build", which compiles everything, creates the jars, and packages everything into the zip, it wouldn't work, as everything inside would be named numbers, and I'm not so sure I could make directories inside. Here's an example of what I would like to do:

   game.jar & util.jar ;
   [ bin, file("levels"), file("config.cfg") ] | zip ;
   [ game.jar, util.jar ] | concatenateFiles(with=files("game/lib")) ;
   game.classes | concatenateFiles(with=files("game/res")) | jar ;
   files("game/src") | javac(libs=files("game/lib") ;
   util.classes | concatenateFiles(with=files("util/res")) | jar ;
   files("util/src") | javac(libs=files("util/lib")) ;

This would, ideally, make a zip file with 2 directories("bin" and "levels"), and the default "config.cfg". The "&" idea was just that it would create both of them in the results directory, kind of a break for the builder I guess, drop what's before it into results, and move on.

Also, random small suggestion, is there anyway you can make the functions smarter, so they don't need the parameter name to work? Tongue Maybe have the pipe always be the first argument of its type?
10  Game Development / Shared Code / Re: Smooth build - build system for java projects on: 2013-12-11 03:33:19
I've been playing with this today, and quite like it Smiley Nice and simple.

A few things I would suggest though...

  • The jar function currently names the output based on the given function. I was hoping to have an "all" where I could compile multiple files at once, but I cant do this unless I zip all the outputs into an "all" zip file. The jar function should take the name from its parent function, not the first one run, or maybe just add an optional String parameter for filename?
  • A "default" function should be checked for and run if someone just runs "smooth build", instead of giving an error, for similar use to above.
  • At the moment, on linux atleast, it seems the results are a symlink to the final result in ".smooth/values/", instead of moving the actual file.

Not much experience with git, maybe if I use it a lot more I'll try contributing Smiley
Pages: [1]
ivj94 (583 views)
2018-03-24 14:47:39

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

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

Solater (62 views)
2018-03-17 05:04:08

nelsongames (109 views)
2018-03-05 17:56:34

Gornova (151 views)
2018-03-02 22:15:33

buddyBro (694 views)
2018-02-28 16:59:18

buddyBro (92 views)
2018-02-28 16:45:17

xxMrPHDxx (493 views)
2017-12-31 17:17:51

xxMrPHDxx (733 views)
2017-12-31 17:15:51
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!