Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (654)
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 ... 5
1  Discussions / Miscellaneous Topics / Re: How well does this work? on: 2015-06-10 06:13:19
My PC had around 220 fps with these specs: (Win 7, GTX 970, 8GB RAM, i5-3570k CPU) - Chrome
And my laptop had 114 fps with these specs: (Win 8, i3 CPU, 4GB RAM, integrated chip) - Chrome

Seems a little low on the 1st one O.o are you limiting the FPS?

Edit: Mouse moves/acts very nice as well Smiley

Edit: Tested on my Windows phone xD 50-60fps. Nokia Lumia 735

No, there is no fps limit, the render function recur again the moment it's complete.
Good to know it worked on the phone too, I will probably do phone version sometime, but the main platform will always be computers.
2  Discussions / Miscellaneous Topics / How well does this work? on: 2015-06-09 21:23:51
I have just started to create an isometric game using javascript and html5, later I will add php and MySQL so I can make it to a proper game, now it's just a test project. But I would like to know if there is any problems with it now, the fps you get, and how accurate the mouse is.

EDIT: ops forgot the link ^^"
http://creaturecontroller.com/battle/arena.php
3  Discussions / Miscellaneous Topics / Re: Trouble with 3D hitscan on: 2015-05-19 07:35:03
Well the idea is that I override x, y, an z in each iteration because I advance the point. So the first iteration would be right in front of me, while every other iteration would be a bit farther along. Then I return the point where I hit something, so I end up with yaw, pitch, and distance to the object I'm aiming at.
4  Discussions / Miscellaneous Topics / Re: Trouble with 3D hitscan on: 2015-05-18 19:14:02
Are you hitting your own player?

Ops, clicked wrong when I was going to click "quote". Anyway, Sometimes, other times the shot goes straight up in the air.
5  Discussions / Miscellaneous Topics / Trouble with 3D hitscan on: 2015-05-18 19:05:25
This isn't programmed in Java, so that's why I put it here. But since it's math, people here should be able to understand it. I'm trying to make a hitscan script in a 3D space, but it doesn't work right at all, since it always "detects" that I aim at my feet, and not where I aiming at. So I want to know, if the problem the math, or somewhere else?

1  
2  
3  
4  
5  
6  
7  
lv_x = Sin(lv_pitch) * Cos(lv_yaw);
lv_y = Sin(lv_pitch) * Sin(lv_yaw);
lv_z = Cos(lv_pitch);

lv_x = PointGetX(CameraGetTarget(lp_player)) + (lv_x * lv_distance);
lv_y = PointGetY(CameraGetTarget(lp_player)) + (lv_y * lv_distance);
lv_z = lv_cameraHeight + (lv_z * lv_distance);


lv_distance increases by 1 in a while loop until it hits something.
lv_pitch and lv_law is both in degrees.
6  Discussions / Miscellaneous Topics / Re: What do you define as a programming language? on: 2015-05-01 10:52:31
This is another askyahoo situation isn't it? where no one have an opinion or thought on their own, instead they just go to sources to give the absolute definition.

Or your responses are well educated.

I am currently studying defining languages and such in Formal Languages and Automata class, which is done in Software Engineering and Computer Science at my uni.

Good for you, but I'm looking for peoples opinions. Otherwise I would have searched up the answers myself.
7  Discussions / Miscellaneous Topics / Re: What do you define as a programming language? on: 2015-05-01 10:45:46
This is another askyahoo situation isn't it? where no one have an opinion or thought on their own, instead they just go to sources to give the absolute definition.
8  Discussions / Miscellaneous Topics / Re: What do you define as a programming language? on: 2015-05-01 10:23:20
that is, if it's not Turing complete, you might simply consider it "data" instead, to be processed by some other program into something more tangible.

Cas Smiley

Excuse me if I sound rude, but what are you talking about? and how did you come to that conclusion from my thread? I was simply asking what people consider a programming language to be, and gave the example that I count java, php, javascript, and SQL as a programming language, while I don't count css and html.
9  Discussions / Miscellaneous Topics / Re: What do you define as a programming language? on: 2015-05-01 10:12:21
Turing Complete is a good place to start.

Cas Smiley

Start where?
10  Discussions / Miscellaneous Topics / What do you define as a programming language? on: 2015-05-01 09:50:47
Often when people ask me what programming languages I know/use, I often answer "php, java, javascript, and basic SQL". Even if I can html and css I mostly don't count those since they don't have the logic php, java, and javascript have, while SQL being on the border since it have a few functions/methods. I just wonder, how many leave out languages like that?
11  Discussions / Miscellaneous Topics / Make the simplest code unreadable on: 2015-02-24 13:20:48
Just for fun I made a simple code, as unreadable as possible.

The result:
1  
2  
3  
4  
5  
    public static void main(String[] args) {
        String txt = "";
        for(int i=0; i<6; i++){txt += txt .length() == 0 ? "h" : txt .length() == 2 ? "j" : i == 3 || i == 4 ? (txt .charAt(txt .length()-1) == ' ' ? "d" : " ") : i == 5 ? "å" : "e";}
        System.out.println(txt);
    }


I would love if you could make your own version, and see how bad it can get.
12  Discussions / General Discussions / Randomly generated items on: 2015-02-24 09:38:00
I'm working on an RPG, and have been thinking if I should make randomly generated items, or only have pre-made items. It would be nice to have thousands of items. But I'm afraid of the items getting dull, when it's just X copies of the same item. Then I was thinking of maybe randomly generate gray, white, and some of the blue items. But any quality better then that, are pre-made. I would like to know what you think.
13  Discussions / General Discussions / Re: Do you sometimes skip braces? on: 2015-02-08 06:37:58
Usually if I need a simple if-else statement I do things like this.

1  
2  
3  
4  
5  
//example 1
return map.contain(key) ? map.get(key) : null;

//example 2
bgColor = bgColor == Color.gray ? Color.white : Color.gray;


That way I skip large if statements, and to me that's perfectly readable.
14  Discussions / General Discussions / Do you sometimes skip braces? on: 2015-02-08 05:39:15
This isn't a thread about if it's a good/bad idea to skip braces, I just want to know if you personally do it, and if you do when?

I normally skip braces in loops if I don't need them, especially if it's two loops, a if statement, and then a method. Since I don't think having three end braces in a row improve readability of the code. But I never skip braces if I need to use a else statement, since I think that makes it more difficult to read the code.
15  Game Development / Newbie & Debugging Questions / Re: How would you simplify a nested for loop? on: 2015-02-03 03:22:40
I know I'm a bit late, but I just want to add my two cent.

When I do loops like that, I usually do them like this
1  
2  
3  
4  
5  
for (int y = 0; y < height; y++)
    for (int x = 0; x < width; x++)
        makeTile(x, y);

//And if need, here is where I set code outside the loop
16  Game Development / Newbie & Debugging Questions / Re: Best way to wait for a method? on: 2015-02-02 22:54:48
Would it be possible to let the updater always download the new files, even if the game is running, and save the new version as gamejar.jar.new (or something), and then on startup the game can go look for those files and if it finds them just ask the user if he/she wants to update using the already downloaded files?

If that does not work for your scenario you need to pass a callback to
1  
scanner.requestStop()
so that the game can explicitly notify when it's shut down. Then take action in the callback.

Since the game have an online component it needs to be up to date, but I will add in a warning 10 minutes before the game updates if it's already running, so it doesn't just suddenly quits and updates. Anyway, I can't believe it was that simple, I been thinking all day about using wait and notify, passing the thread object to the launcher, or passing the launcher to the game.
17  Game Development / Newbie & Debugging Questions / Best way to wait for a method? on: 2015-02-02 22:00:56
Hi, I have recently started experimenting with a making a launcher that will keep games up to date, I have gotten it working. I just want to clean it up so it works just as I want to, and one issue I have come across is waiting for the game to close before it updates. Here is the method I use to detect if the game need updating, and to queue up the flies for download.

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  
33  
34  
35  
        public List<queuedFile> checkUpdate(boolean forced){
            List<queuedFile> downloadList = new ArrayList<>();
            String sUrl = settings.readString("software.server.url", null);
            HttpRequest http = new HttpRequest(sUrl);

            for(String raw : http.send("o=version")){
                String[] data = raw.split("/");

                switch(data[0]){
                    case "file":
                        try{
                            long lastModified = TIME_FORMAT.parse(data[3]).getTime();
                            String sFile = URLDecoder.decode(data[2], "UTF-8");
                            int fileId = Integer.parseInt(data[1]);

                            if(!isOutdated(lastModified, sFile) && !forced)
                                continue;

                            if(scanner != null && !scanner.hasStopped())
                                scanner.requestStop();

                            //Why I don't use a else statement is becausae it's possible the scanner stops before this statement.
                            //And a else statement would jump over that.
                            if((scanner == null || scanner.hasStopped())){
                                downloadList.add(new queuedFile(sUrl, fileId, sFile, lastModified));
                            }
                        }catch(Exception e){
                            e.printStackTrace();
                        }
                    break;
                }
            }

            return downloadList;
        }//End of checkUpdate


The problem is that the method "scanner.requestStop();" do so the game start to close it's loop, without force closing it. But that means the code continues after invoking that method, and does not wait for the game to close. How do I change that? BTW, "scanner.hasStopped();" checks if the game is closed.

Here is the methods that makes up requestStop()
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
    public void runVoidMethod(String name){
        try{
            scannerObject.getClass().getMethod(name).invoke(scannerObject);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
   
    public void requestStop(){
        runVoidMethod("requestStop");
    }


Last thing, the game is in it's own jar file, and gets loaded and started like this.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
    public boolean load(File file){
        try{
            //Setup and load the class
            URL[] urls = {file.toURI().toURL()};
            URLClassLoader loader = new URLClassLoader(urls);
            Class<?> clazz = loader.loadClass("scanner.Scanner");
            scannerObject = clazz.getConstructor().newInstance();
            return true;
        }catch(Exception e){
            return false;
        }
    }
18  Game Development / Game Mechanics / Re: Turn mechanics in an RPG on: 2014-12-28 22:44:22
How about the arena is an enneagon with a player on each point. Each player chooses their attack and when their all ready they attack whichever player they choose in order of the speed stat. If you want teams, I suggest coloring one part of the enneagon red (for the red team) , another part blue (for the blue team) , and the last part green (the green team). I drew a small diagram for it

That is an idea I like, I could let the players choose and then lock their moves. When everyone is ready they execute. I'm not so sure about the enneagon arena. But it sounds more like an interface option, and not a part of the mechanics.
19  Game Development / Game Mechanics / Turn mechanics in an RPG on: 2014-12-28 19:37:31
So I'm working on an online multiplayer RPG game where people can set up matches and battle each other, so far people can set up the match however they want, but for simplicity sake, lets say 9 players have setup a 3v3v3 match, I wonder what would be the best way to sort the turns.

So far I been thinking of these
  • Arrange all players in a list from fastest character to slowest.
  • Randomize the team in a list, and then at all character in that team attack, before go to the next team.
  • Take the first character in each team, for the first three turns, then the second character in each team, then the third.

Any advice or suggestions.

EDIT: I don't need help with the coding, just the advice or suggestions for the turn mechanics.
20  Discussions / Miscellaneous Topics / Re: Should the player control the head or torso on: 2014-10-22 22:26:35
People "didn't get" the question because it's not really something we can answer. It's entirely up to OP.

I'm aware of that, but this is a forum where people discuss things, it doesn't need to be a "right" or "wrong" way to go about it to post here. I want to hear what people think about the up and downs of it.
21  Discussions / Miscellaneous Topics / Re: Should the player control the head or torso on: 2014-10-22 18:47:36
This really isn't a question that we can answer, since it depends entirely on how your code is setup.

This is not a question about how to do it, since I know exactly how I will program it. No it's more about what I should do, and why.

What does it even mean to "put" controls in a head or a torso?

The player can only control things that's connected to the "controller", which means if it's the head, once the head is removed and rolls on the ground, the body will no longer be controllable to anyone. If the control is in the torso and the head gets removed and throw to the ground, the head will no longer be controllable, but every other limb still connected to the torso will.

The reason why this matter is, if the controls is in the head, then no player will be able to become headless, but if the controls are in the torso, then the player can't decapitate mobs or other players to try to win battles quickly. I can't decide what would be best when it comes to the game mechanics.
22  Discussions / Miscellaneous Topics / Should the player control the head or torso on: 2014-10-21 21:19:12
I have been working on an web based rpg game, which is suppose to be all about the players character, and what happens to him/her. Quests, battles, and random encounters can very well end up changing the character. If the character die, it's a possibility the character comes back as a zombie, skeleton, or ghost. Depending on how the character died.

Now to the "problem", since a character is going to change during the game, I have made all major limbs to items. Normally a player can't unequip them without using an axe or sword, but the exception is the zombies. But this makes me think, normally I would put the "controls" in the head, but I have been thinking if I should instead set them in the torso, since then the players can be a headless zombie, otherwise they can't. So I wonder what you think, controls in head or torso?

EDIT: This is not a question about how I should do it, it's just to get me to decide on a game mechanic. The player can control all limbs that's connected to the controlling limb, so if that's the head, and the head get's removed for the body, then the body will just fall to the ground like a ragdoll since nothing is controlling it. I was thinking about the advantages and disadvantages of having the controller in the torso.
23  Game Development / Newbie & Debugging Questions / Re: NullPointerException or if statement on: 2014-09-30 11:49:38
First note that these two are not equivalent.  The try version will do everything until any failure where the if version only does something if no failure will occur.  What I'd suggest is neither and disallow getImage to ever return null.

Thanks, I didn't think of that.
24  Game Development / Newbie & Debugging Questions / NullPointerException or if statement on: 2014-09-30 10:37:30
This isn't really a problem I have, more of a question of what's considered good practice. I recently realized that I can catch NullPointerExceptions, instead of using a if statement. So far I have only used it in places where I expect to not need and if statement, but I wonder is it right? and if not, when should I catch NullPointerException instead of using if's?

There is one place where I used it like this
1  
2  
3  
4  
5  
6  
7  
8  
try{
    renderComponent[RENDER_BG].getImage().render(g2, x, y+7);
    renderComponent[RENDER_NAME].getImage().render(g2, x+5, y);
    renderComponent[RENDER_DATE].getImage().render(g2, 30+(textBreakWidth*1), y);
    renderComponent[RENDER_TIME].getImage().render(g2, (textBreakWidth*2)-renderComponent[RENDER_TIME].getImage().getWidth()+20, y);
}catch(java.lang.NullPointerException e){
    showingAnimation = false;
}


instead of
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
if(     renderComponent[RENDER_BG].getImage() != null &&
        renderComponent[RENDER_NAME].getImage() != null &&
        renderComponent[RENDER_DATE].getImage() != null &&
        renderComponent[RENDER_TIME].getImage() != null){
    renderComponent[RENDER_BG].getImage().render(g2, x, y+7);
    renderComponent[RENDER_NAME].getImage().render(g2, x+5, y);
    renderComponent[RENDER_DATE].getImage().render(g2, 30+(textBreakWidth*1), y);
    renderComponent[RENDER_TIME].getImage().render(g2, (textBreakWidth*2)-renderComponent[RENDER_TIME].getImage().getWidth()+20, y);
}else{
    showingAnimation = false;
}


In situations like that I feel like the try statement is much more useful than a if, it also makes the code a lot more readable.
25  Game Development / Newbie & Debugging Questions / Re: Adding gravity on: 2014-09-27 13:24:20
It was a spelling mistake, it suppose to just be getVerticalSpeed
26  Game Development / Newbie & Debugging Questions / Re: Adding gravity on: 2014-09-27 09:34:53
I finally understand, now I'm using

1  
2  
3  
layer.setVerticalSpeed(layer.getVerticalSpeedSpeed() + 0.25);
layer.setX(layer.getPreciseX() + layer.getHorizontalSpeed());
layer.setY(layer.getPreciseY() + layer.getVerticalSpeed());


and when I set the speed
1  
2  
3  
4  
5  
int speed = 3 + r.nextInt(5);
int direction = r.nextInt(360);

layer.setHorizontalSpeed(Math.sin(Math.toRadians(direction)) * speed);
layer.setVerticalSpeed(Math.cos(Math.toRadians(direction)) * speed);


It would have been much easier if one of you had explained that speed and direction was a bad thing to go about it, and tell me that I should use Horizontal and Vertical speed instead.
27  Game Development / Newbie & Debugging Questions / Re: Adding gravity on: 2014-09-27 08:56:57
you can just constantly increase the downward speed over time, when your object isnt on solid ground, for a simple solution.

I could try, but I was hoping someone would know a good formula to change the direction downwards using the weight of the object.
28  Game Development / Newbie & Debugging Questions / Adding gravity on: 2014-09-27 08:30:13
I have made two classes that allows me to cut a BufferedImage into pieces, and apply a direction and speed to them. I use that to make sprites explode when the character dies. However I have no idea how to add gravity to them. So far the pieces just float off into any direction instead of falling down to the bottom of the screen.

My very simple code
Quote
layer.setX(layer.getX() + Math.sin(layer.getDirection()) * layer.getSpeed());
layer.setY(layer.getY() + Math.cos(layer.getDirection()) * layer.getSpeed());

The "layer" object have a getPixelCount() method, which returns the amount of none fully transparent pixels in the image, which is what I was going to use to add different weight to the pieces.
29  Discussions / Miscellaneous Topics / I'm scared of Unity on: 2014-09-24 07:32:37
I'm scared of programs like Dreamweaver, Unity, Game maker, and Construct 2 where people can make software or websites easily without need to program themselves. I have worked hard to learn php, java, javascript, html, css, and MySQL, to be able to create what I want. But I'm afraid I work really hard to make a game in java, and then someone else comes and makes a better game a shorter amount of time with one of those programs, it makes me question if it's worth programming in java, or if I should start to use Unity instead. But there is a part of me (my ego?) that hate's that idea since it's not programming. I mean, if there is a software like that which would allow me to build games faster, easier, and maybe even access the code to edit in things the software can't do. Then why just stick with pure java, or any other programming language for that matter?
30  Discussions / Miscellaneous Topics / Re: How often do you code on: 2014-09-21 08:49:14
around 10 hours on a normal day, but that's just because I'm a software developer. I spend around 3 hours every day on my own projects.
Pages: [1] 2 3 ... 5
 
bilznatch (27 views)
2015-08-04 11:03:17

SHC (44 views)
2015-08-01 03:58:20

Jesse (25 views)
2015-07-29 04:35:27

Riven (48 views)
2015-07-27 16:38:00

Riven (26 views)
2015-07-27 15:35:20

Riven (28 views)
2015-07-27 12:26:13

Riven (19 views)
2015-07-27 12:23:39

BurntPizza (42 views)
2015-07-25 00:14:37

BurntPizza (56 views)
2015-07-24 22:06:39

BurntPizza (35 views)
2015-07-24 06:06:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21
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!