Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (482)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (548)
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 ... 70
1  Game Development / Newbie & Debugging Questions / Re: Lost my CODE! on: 2014-08-14 12:00:38
I guess from the screenshot that you use Eclipse, so tried the Local History feature? I don't use Eclipse, so I don't know how long its' history lasts...
2  Game Development / Newbie & Debugging Questions / Re: Lost my CODE! on: 2014-08-14 11:45:18
Wait, you never saved that file in 2 weeks?

I'm sorry, but that's just silly!
No - the file just got corrupted. I have the same problem with my work PC. I get a blue screen on it from time to time and then every open file is filled with binary nulls...
Unfortunately this also happens to my locally cloned git repo - So any non-pushed changes are also lost Sad

I was going to release it as a WIP today too D:  Cry . Deep down Inside I know I put in  a LOT of work but for some reason...
Get over with. This might actually not be that bad at all. Redoing something that you already did just helps you practice and usually results in cleaner code anyway. So see this as an oportunity and not as a problem.

Back in the days when I started programming I always started from scratch and so basically memorized all the 68k assemly code you need to write an Atari ST overscan demo with side scrolling text and raster interrupt colorizing without even looking up interrupts, adresses or clock cycles.  Cool
3  Game Development / Newbie & Debugging Questions / Re: Bullet shooting in mouse direction on: 2014-08-05 20:31:03
Some more info
o you need to understand 2d vectors
  -> they are variables with an x and an y component and can be used to do stuff like described in the link above
o you need to understand the difference between vectors and points
  -> technically they look the same (having x and y), but logically they are different (a point is a position, a vector represents direction and length)
o you need to understand game loops
  -> the loop that periodically calls your update and render methods
o you need to understand what a timestep is
  -> the time period between your update calls
o you need to understand fixed and variable timesteps
  -> fixed timesteps are locked. For example to 1/60s.
o fixed timestep is easier for animating your game
  -> but the gameloop needs to make sure of it by variable sleep times to wait before the next gameloop iteration
o you need to understand when to use floats vs. ints
  -> only use ints for final rendering. use floats (or doubles) for variables needed in computation or to store (varying) positions

regarding your question:
o you need a direction vector pointing from the turret to the mouse
  -> it's easily calculated by substracting the turret position from the mouse position (and normalize the result)
o you need a speed variable containing the pixels per timestep
  -> the amount of pixels the bullet should fly per frame
o you need a bullet position variable that adds up the direction*speed*timestep per update call
  -> this needs to have float components

pseudo code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
// assume this values
float timeStep=1f/60f;
float turretX=10f;
float turrety=10f;
float bulletSpeed=3f; // speed is 3 pixels per second

// if a bullet is fired it is initialized like this
float bulletX=turretX;
float bulletY=turretY;

// and you need to calculate the direction vector for it's movement
float dirX= getMouseXFromSomeWhere()-turretX;
float dirY= getMouseYFromSomeWhere()-turretY;
// you need to "normalize" the direction vector to be able to use the speed variable
float dirLength= Math.sqrt(dirX*dirX + dirY*dirY);
dirX=dirX/dirLength;
dirY=dirY/dirLength;

// now on every update, you can add up the direction * speed * timestep to the bullet
bulletX=bulletX+(dirX*bulletSpeed*timeStep);
bulletY=bulletY+(dirY*bulletSpeed*timeStep);

// on every render, you can render the bullet sprite at that position
g.drawImage(bulletImage, (int)bulletX, (int)bulletY, null); // rendering often uses ints for coordinates


as you can see, standalone x and y variables are just the components of vectors grouped by a naming convention, so you could also use a vector class for that:

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  
// some minimal vector class
class Vec
{
    public float x, y;
    public Vec(float x, float y)
    {
        this.x=x;
        this.y=y;
    }
    public normalize()
    {
        float l=Math.sqrt(x*x + y*y);
        x/=l;
        y/=l;
    }
}

// since vectors and points look technically similar, you can "abuse" a vector to store positions:
Vec turret= new Vec(10f,10f);

// creating the direction vector
Vec dir=new Vec(getMouseXFromSomewhere(),getMouseYFromSomewhere());
dir.x-=turret.x;
dir.y-=turret.y;
dir.normalize();

// initializing a new bullet
Vec bullet=new Vec(turret.x, turret.y);

// animate the bullet on update...
bullet.x+=speed*dir.x*timeStep;
bullet.y+=speed*dir.y*timeStep;

// render the bullet sprite
g.drawImage(bulletImage, (int)bullet.x, (int)bullet.y, null);


Of course you can add more methods to the Vec class to make the code using vectors look more concise...
4  Game Development / Newbie & Debugging Questions / Re: Bullet shooting in mouse direction on: 2014-08-05 19:41:55
Please, people, learn vector math...
http://www.wildbunny.co.uk/blog/vector-maths-a-primer-for-games-programmers/
5  Game Development / Newbie & Debugging Questions / Re: StateMachine, Java Generics issue on: 2014-07-29 10:10:54
State<?>
http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-29 08:04:56
Played with Sand (Youtube):

Lets see if it survives my daughter, so I can finish it Wink
7  Game Development / Newbie & Debugging Questions / Re: Having a Problem with ArrayLists and Objects on: 2014-07-20 16:53:20
Where are you clearing the fluidObjects before adding 8 new ones?
8  Game Development / Newbie & Debugging Questions / Re: Get the mouse x , y? on: 2014-07-16 11:43:53
LOL - still the same - the declaration of x and y is still nowhere too be seen...
9  Game Development / Newbie & Debugging Questions / Re: Get the mouse x , y? on: 2014-07-16 11:20:14
Intrestingly your code snippets miss exactly the parts that would allow us to help you,  namely the declarations of your various x and y variables...
10  Discussions / General Discussions / Re: New feature: topic labels [solved] on: 2014-06-22 08:51:42
Would a dynamic image generator for the tags be too heavy on the system?  Then everybody can use whatever tags they want. Just color code the known tags and let the others have a standard color.  And if you are at it, create an index and a tag cloud of them  Wink
11  Discussions / General Discussions / Re: Java 8 on Raspberry Pi on: 2014-06-19 18:11:13
Actually there seems to be working lwjgl and even libgdx ports for the PI.  At least you get that impression by simply googling for it  Shocked
12  Java Game APIs & Engines / Engines, Libraries and Tools / Re: JRebel on: 2014-06-18 07:40:43
I bought it last summer and it's worth it. Just that. I will renew my license this year for sure.
13  Discussions / Miscellaneous Topics / Re: Longest program you have written? on: 2014-06-17 12:29:53
LOC means nothing. My current work-project is 105k of java, xml, jelly and groovy...
14  Discussions / General Discussions / Re: If you sell your entire identity to an anonymous buyer for a high price... on: 2014-06-16 13:29:10
Okay then. Would this work?

I don't get it, so probably no Wink There are too much plot holes, so needs more work

Some Questions and Ideas:
If you sell your identity to someone else, you will receive a certificate, stating that you have no identity, and that you're now deemed as an "outlaw". This certificate, postal stamp-sized, is then tattooed onto your left upper arm, as per governing rules.
Does this certificate contain a reference to your former identity?

People who are deemed outlaws, are forbidden to enter colonies in outer space, and can only enter the vast dark worlds where colonies wouldn't dare to enter. Those who aren't are just plain normal human beings. Outlaws can trade weapons, arsenals, and much more. Humans, however, trade resources and economy. Outlaws must use resources to create tools and other mechanical things, and humans need them to sustain themselves.
So you want to make this like good needs evil to survive and the outlaw mechanism grew into a balanced society? I think you need to flesh out the mechanics a bit more and explain why this symbiosis is needed.

Also, who is buying the identities? And why? If it aren't the Outlaws, what's the point of buying one? If the Outlaws could buy one, why would they want to have back their own and why would it even be a problem to be an Outlaw if you can buy yourself an identity to come out of this?

What can you do with the identity? It doesn't seem logical to just live another ones life. You lack the expertise and experienct to do his work for example. You also won't be able to just slip into his shoes and live his social life, since partners and friends won't become your partners and friends by buying the identity.

You, awake in the morning, were about to start a normal day with your normal daily routine, when a group of people started mugging you, and tattooing your left upper arm with an actual certificate of someone else. You would think that you might be framed for something, so you called the police. After legal sessions throughout the week, you finally found out that you bought yourself your own identity, and discovering an impossible loophole that saved you from entering prison.
You said "an actual certificate of someone else" and later "bought yourself your own identity". For me it's not clear what you mean and how it is achieved.

Do you mean like:
- You were marked as an outlaw
- To prevent prison and/or banishment you hide and research for a way out of this mess
- You find out, how you can buy back your identity
- You buy back your identity and therefor are now an outlaw (certificate tattoo)
  and a normal citizen (bought identity) at the same time

This implies a lot of questions:
- Why where you mugged in the first place - it will only make sense if they want your identity
- How can you buy your identity, you don't have a bank account anymore
- How can you get back your own, since the muggers wanted to have it for a reason
- Simply buying an identity seems to obvious (even of someone else), so the loophole does no seem logical

Intergalactic news about you spread throughout the universe, with many heated debates pissing off in the media like chain reactions. Outlaws, once heard of this news, started to gather and planned to initiate a migratory attack, to return to their normal daily lives. Planetary governments and numerous colonies fought back to save themselves from this attack, and started to bring chaos into the mix.

This doesn't come natural either:
- They sold their identity in the first place, why would they want to get their life back.
  There need at least be some unfair reason that forced them to sell their identity in the first place

You, both as an outlaw and a normal human being, will have to find ways to save mankind from the brinks of destruction in an "epic" RPG.

Plot Twist: The group of people that mugged you are the actual antagonists and bosses in this game. The final boss is very challenging.

Again, why? What does the bosses have to do with you?


Other than that, I like the idea of identity theft and trading as well as a scyfi and space opera setting. But I think you need to put more thought into it and fill the "plot holes"...

Maybe you need to mix in some cyberspace component to make the use of foreign identities more believable.
15  Game Development / Newbie & Debugging Questions / Re: [Math] Acquire angle from collision on: 2014-06-10 12:58:41
What about using friction 0f, and density 1f for _all_ objects?

The ball becomes very linear and boring, you can't like "slice" it with the paddle to control direction Sad.

Hmm, maybe make the ball high density and the paddle low density instead? I didn't use Box2D before, but cant you accellerate the ball in reaction to a collsion event to overcome the velocity loss?
16  Game Development / Newbie & Debugging Questions / Re: [Math] Acquire angle from collision on: 2014-06-10 12:54:02
Annnnd that is the complicated part, do you have a good resource? I understand vector math besides those 2 things you just stated lol.

http://higherorderfun.com/blog/2012/06/03/math-for-game-programmers-05-vector-cheat-sheet/

17  Game Development / Newbie & Debugging Questions / Re: [Math] Acquire angle from collision on: 2014-06-10 11:58:02
What about using friction 0f, and density 1f for _all_ objects?

Other than that, for axis aligned boxes, you can just take a point of the path previous to the collision, and mirror the x-component at the collision axis, e.g. ball is at Xprev=20;Yprev=10 the frame before the collsion, at Xcol=25;Ycol=5 right at the collsion, so it should be at Xnext=30;Ynext=10 the frame after the collision. This can be calculated with Xnext=Xcol+(Xcol-Xprev);Ynext=Yprev.

For non-axis aligned boxes you need to get yourself up to speed with 2D vector math, dot products and normals.  
18  Games Center / Featured Games / Re: State of Fortune on: 2014-06-08 22:49:51
Don't believe the stuf they write in mails - it's a lie!

Also don't kill relatives for life ensurances - they'll find out!

Wink
19  Discussions / Miscellaneous Topics / Re: [Girls] How to completely block them from our lives? on: 2014-06-08 16:23:54
Well,  telling them that you sit all day and night at the computer programming would have helped in my youth  Wink Don't know about nowadays...

But in my opinion,  just keep them comming - in the end,  trouble with girls is by far the most intresting trouble you can have.  Just try to don't take things too serious and personal when it doesn't work out.

Also stay true to yourself and do the things you love.

Good luck  Smiley
20  Game Development / Newbie & Debugging Questions / Re: [LibGDX & Artemis] Random Null Pointer Exception in System on: 2014-06-06 11:48:28
Learn using the debugger.  It's one of the most valuable tools you have.  You can for example advice the debugger to stop at a custom defined condition and even directly when a NPE occurs. Then you can just inspect all the values currently in scope and see the cause of your problem right away.

Seriously,  take your time, create a little test-program and check out the various debugger features.
21  Discussions / Miscellaneous Topics / Re: IDE hide block of code on: 2014-06-02 18:01:22
http://wiki.netbeans.org/FaqCustomCodeFolds
22  Game Development / Newbie & Debugging Questions / Re: Creating a chunk-based custom binary file format on: 2014-05-28 08:14:22
Quote
I wouldnt go through the hassle of creating a custom binary format.
My experience is that it's more hassle to create a so-called human readable format using a library (or not) than a simple custom binary format.
I dont want to push this since the OP explicitely wants a custom binary format, but I dont get your point.  Whats the hassle in serializing a selfcontained datamodel to any format using a library like xstream. Sure you need to define your datamodel, the used types, values and references, with care, but how is that more of a hassle than defining a binary format?
23  Game Development / Newbie & Debugging Questions / Re: Creating a chunk-based custom binary file format on: 2014-05-27 12:31:53
I wouldnt go through the hassle of creating a custom binary format. Just use xstream and save xml or json directly from your data model: http://xstream.codehaus.org/tutorial.html
24  Game Development / Game Mechanics / Re: [Math] Kinetic energy of impact between two moving objects on: 2014-05-13 07:49:16
<offtopic>
The Risen Empire has a pretty nice kinetic space fight...
</offtopic>
25  Game Development / Game Mechanics / Re: LWJGL Best way to handle 2D Sprite Animations? on: 2014-05-12 10:37:13
The OP already stated that he has a spritesheet, but splits it into multiple separate images on the "java-side".

This is not the right way to do it. Just load your complete spritesheet as one texture and change the texture coordinates of your Quad (or whatever you are using) to only contain the sprite frame you want to draw.

Take a look here: http://androidblog.reindustries.com/a-real-opengl-es-2-0-2d-tutorial-part-7-texture-atlas/ for inspiration
26  Game Development / Newbie & Debugging Questions / Re: How to send projectile over a vector path ? on: 2014-05-08 12:45:10
Kind of, but i wouldnt use the angle here because of some downsides:
- atan has continuity breaks with results switching from +infinity to -infinity
- you have to check for division by zero if xx is 0
- trig functions are less performant
27  Game Development / Newbie & Debugging Questions / Re: How to send projectile over a vector path ? on: 2014-05-08 10:47:51
Only have a phone right now,  but look here: http://www.java-gaming.org/topics/how-to-make-a-bullet-shoot-towards-the-mouse/33010/view.html and also watch the embedded video there.
28  Game Development / Newbie & Debugging Questions / Re: How to send projectile over a vector path ? on: 2014-05-08 10:38:45
Nah, you dont need the angle. Just divide the deltas (xx,  yy)  by your locked fps and you can use them instead of cos(angle)  and sin(angle) ...
29  Discussions / General Discussions / Re: JEP for making Unsafe a public API on: 2014-05-05 08:21:03
Making the API official forces every vendor to expose the same functionality.
Unfortunately Google is not really a Java Vendor, so I don't know if this would help the situation on Android, would it?
30  Discussions / General Discussions / Re: OpenGL functions straight from GPU on: 2014-05-05 08:13:08
The idea of the programmable pipeline is more like setting everything up on the CPU side, send it over to the GPU and let the (GLSL) shaders do the heavy lifting. There would usually be little use for calling individual OpenGL functions from the GPU.

If you want to continously modify a dataset on the GPU, you could probably use OpenCL for that, but I heard that it might be difficult to bridge between OpenCL and GLSL when needed. I didn't use OpenCL though, so this might be uninformed...
Pages: [1] 2 3 ... 70
 

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

The first screenshot will be displayed as a thumbnail.

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!