Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
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 ... 59
1  Game Development / Game Play & Game Design / Re: Entity animation in MVC style program on: 2014-11-23 15:41:11
Just make sure you break the rules only at the exact right places. Smiley

Someone playing your game doesn't care about MVC, all they care about is that it works. MVC is for you. If it is making things difficult, cut corners so it doesn't. Eg, put a view object in the model so you don't have to map model to view objects, since you are unlikely to have multiple views.
2  Game Development / Game Play & Game Design / Re: Entity animation in MVC style program on: 2014-11-23 12:35:09
See Super Spineboy:
https://github.com/EsotericSoftware/spine-superspineboy

Character (the model) has state and stateTime:
https://github.com/EsotericSoftware/spine-superspineboy/blob/master/src/com/esotericsoftware/spine/superspineboy/Character.java#L50
The state determines the animation. The stateTime is how long the character has been in that state. This is all you need for the view to be able to animate.

That should be enough to get you going, but if you want to see how Super Spineboy does it, every frame the view calls CharacterView#setAnimation:
https://github.com/EsotericSoftware/spine-superspineboy/blob/master/src/com/esotericsoftware/spine/superspineboy/PlayerView.java#L103
https://github.com/EsotericSoftware/spine-superspineboy/blob/master/src/com/esotericsoftware/spine/superspineboy/EnemyView.java#L93

If the animation has changed, Character#setAnimation changes the animation in AnimationState.
https://github.com/EsotericSoftware/spine-superspineboy/blob/master/src/com/esotericsoftware/spine/superspineboy/CharacterView.java#L51

AnimationState is part of Spine and keeps track of animations, their time, cross fading when animations change, etc. You may not need this, in a simpler system your renderer would just draw the animation for the current state, using stateTime to determine the animation frame.

A couple more notes on how Super Spineboy uses MVC. It is done loosely, you should feel free to break the rules where it makes things easier. The controller is here:
https://github.com/EsotericSoftware/spine-superspineboy/blob/master/src/com/esotericsoftware/spine/superspineboy/SuperSpineboy.java
It does very little.

The model objects have a field for the view but it is never used in the model, it is just for convenience to avoid a model -> view object mapping. There are a few events that the model tells the controller about via a method. I figured proper events would be overkill. Reaction to the events could have gone in the view, but it was easier doing it there.
3  Game Development / Newbie & Debugging Questions / Re: Interpolation between numbers - Libgdx on: 2014-11-15 15:06:07
Great! Though "time += 0.010;" should be "time += delta;".
4  Discussions / Miscellaneous Topics / Re: How memory works? on: 2014-11-15 01:11:13
Try this, IMO it's written in a way that is easily understood:
http://math.hws.edu/javanotes/c1/s1.html
Read the whole thing, it's very good:
http://math.hws.edu/javanotes/
Start at chapter 1 of course.
5  Game Development / Newbie & Debugging Questions / Re: Interpolation between numbers - Libgdx on: 2014-11-15 01:09:03
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
float time = 0;
float duration = 3;
int lastScore = 123;
int actualScore = 456;
while (time < duration) {
   float alpha = Math.min(1, time / duration);
   int visualScore = (int)Interpolation.pow2Out.apply(lastScore, actualScore, alpha);
   System.out.println(visualScore);
   time += 0.032;
}


Once you understand that, apply it to your game. Set time=0 when the score changes, increment time each frame. Pro tip: when score changes, clear actions, then add a TemporalAction that adjusts the visual score.
6  Game Development / Newbie & Debugging Questions / Re: Interpolation between numbers - Libgdx on: 2014-11-14 20:14:05
The Interpolation alpha parameter is from 0 to 1. For your situation, use x/y where x is the amount of time since the score changed and y is how long the you want the visual score change to take.
7  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3; how's it getting along? on: 2014-11-14 19:03:43
Windows 7 64-bit. No, I don't have the Fire Sans font installed. I'm missing glyphs at that link:
http://i.imgur.com/3eGbUjW.png

Haven't tried upgrading yet, but IMO fonts are pretty important for a site to be usable, you don't want it not working for some users. FWIW, we got web fonts working here, see twitter icon in upper right, world icon in bottom left.

1  
2  
3  
4  
5  
6  
$mightBeIE = !$chrome && strpos($ua, 'MSIE') !== false; // Could be Opera.
if ($mightBeIE) {
   ?><style>@font-face{ font-family:icons;src:url(/html/fonts/icons/icons0.eot);src:local('☺︎'),url(/html/fonts/icons/icons0.eot?#iefix)format('embedded-opentype'),url(/html/fonts/icons/icons0.woff)format('woff'),url(/html/fonts/icons/icons0.ttf)format('truetype'),url(/html/fonts/icons/icons0.svg#icons)format('svg')}</style><?
} else {
   ?><style>@font-face{font-family:icons;src:local('☺︎'),url(/html/fonts/icons/icons0.woff)format('woff'),url(/html/fonts/icons/icons0.ttf)format('truetype'),url(/html/fonts/icons/icons0.svg?#icons)format('svg')}</style><?
}
8  Game Development / Newbie & Debugging Questions / Re: Ways of keeping track of classes... on: 2014-11-14 16:10:21
Here's a rare write up on how to properly do OOP:
http://mollyrocket.com/casey/stream_0019.html
9  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3; how's it getting along? on: 2014-11-14 16:09:09
Checked again with shift+F5, same issue.
10  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3; how's it getting along? on: 2014-11-14 15:49:20
Site looks neat! Web font doesn't work in FF 33.0.1. http://i.imgur.com/Pe6iKpq.png
11  Game Development / Newbie & Debugging Questions / Re: Ways of keeping track of classes... on: 2014-11-11 21:31:25
It's a thing in animation. Smiley
http://esotericsoftware.com/spine-animating#Straight-ahead
http://en.wikipedia.org/wiki/12_basic_principles_of_animation#Straight_Ahead_Action_and_Pose_to_Pose
12  Game Development / Newbie & Debugging Questions / Re: Ways of keeping track of classes... on: 2014-11-11 13:54:13
Packages are for organization and the default access (package private) modifier can be used to provide a non-public API across classes, but other than that packages don't mean anything.

I have always preferred the "straight ahead" approach, which is to sit down with my vague idea of what I'm building and start typing. All the code goes in a single class, using static member classes where it makes sense. As the code grows, I periodically step back to see how it is forming and refactor as needed. If the code grows too large for one file, I break it into multiple files using Refactor > Move type to new file. If the code is done before it gets too big, I still move classes into their own file if it makes sense (usually if other classes will use them or if longer than a few hundred lines).

The key to the straight ahead approach is the periodic refactoring. It also requires speed (you'll be rewriting and reorganizing a lot) and experience (starting with a decent approach to the solution, knowing what is good/bad and how to refactor). It is good because you learn to write high quality code, as long as you aren't lazy with your refactoring. It's bad because a lack of planning can take you way off into the weeds. I don't advocate not planning at all, but to plan a little and use coding to explore how the plan works out. A beginner is likely to not have a great plan no matter what, so IMO you might as well dive in and build something, then step back and adjust as needed. If you don't have the skills to assess your own code, ask others for a code review.

Ultimately design requires a lot of experience. If you lack that, you need to jump in, make mistakes, then recognize the mistakes and improve.
13  Game Development / Newbie & Debugging Questions / Re: Ways of keeping track of classes... on: 2014-11-11 01:59:44
Spine has 273 .java files with over 1100 classes. This excludes native code and all dependencies. libgdx has 517 .java files in the core project and 1910 total.

Organize only enough so your stuff makes sense. You don't need a UML diagram or a text file to keep track of things. You have the code right in front of you. If you aren't working on or with a bunch of your classes, you don't need to worry about those. When you do, review them for a refresher and then consider how you will use them.

IMO, focus more on the final product (your game) and less on how to get there. Anything the player will not notice while playing is time wasted, assuming the goal is to actually make a game.
14  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3; how's it getting along? on: 2014-11-08 19:38:20
Sounds pretty damned nice, need to find time to check it out.
15  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 3; how's it getting along? on: 2014-11-08 02:44:23
How does the build work if I want to build it locally? Can I just go "ant" and have it build, including natives?
16  Discussions / General Discussions / Re: What defines a Game Library or Collection of Utilities on: 2014-11-06 18:56:42

Very hard to determine where to draw the line. I think libgdx is ok as an assortment of utilities you can choose from. If you don't care to use portions of it, you can still use it as basic, cross platform window management, input, etc.

Or we could just all go code games....?

That's just mean. You know full well some of just... can't. I can code the hell out of some tools though! Wink Plus, during a gold rush, sell pickaxes!
17  Discussions / General Discussions / Re: What defines a Game Library or Collection of Utilities on: 2014-11-06 01:04:10
matanui159, what you describe is called a scene graph. See scene2d in libgdx.

People can and will share their 6 LOC of they want. People will also make terrible libraries. It can be a learning experience for them and is not something that needs to be discouraged.

When I need a library for some task, it is a huge pain to dig through a bunch of junk, narrow it down to a handful, and try each remaining one in depth. Usually they are all pretty bad, in different ways, but sometimes I get surprised and find something that is really great. We need people to share and to try making things that are great. Some of them will succeed eventually.

For coders of all experience levels, it is very easy to look at other people's code and decide it is bad. It usually takes quite a bit of effort to understand the complexity of the problem and decide if the approach it takes to solve it is reasonable. When looking at something relatively complex, it's much easier to decide the whole thing is poorly written junk. While that is often the case, making that decision incorrectly is a big mistake.
18  Game Development / Game Mechanics / Re: [SOLVED] Smoothly interpolate between two points? on: 2014-10-29 20:07:56
https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/math/Interpolation.java
See InterpolationTest in libgdx to visualize them.
19  Game Development / Shared Code / Re: Clippy: clipboard history tool on: 2014-10-29 17:50:00
I just ripped out the column definition parsing stuff completely, since it was only there for the ORM stuff.

For OS X the JNA would need to be figured out for system-wide keyboard hooks, a system tray icon, and clipboard monitoring and manipulation. That stuff shouldn't be terribly hard, but I find working on OS X pretty painful (extremely painful). Contributions are welcome! Cheesy For OS X try:
http://www.clipmenu.com/
https://itunes.apple.com/us/app/flycut-clipboard-manager/id442160987?mt=12

Also the best alternative to Clippy on Windows is Ditto:
http://ditto-cp.sourceforge.net/
Ditto seems a lot more configurable than ArsClip and does search better. Both have lots of features that I'm not interested in though. Clippy is Java and much simpler, which makes it easier to make it do (and look) exactly what I want. I think contributing to Ditto would relatively difficult, it being such a large C++ project.
20  Game Development / Shared Code / Re: Clippy: clipboard history tool on: 2014-10-29 13:41:01
Nice, good catch Riven! What do you think of DataStore? It doesn't hide that SQL is being used, but it makes it super easy to setup and use an H2 database in a thread safe way. A long time ago I had another layer on top of it that was basic ORM, but that gets nasty pretty quick.
21  Game Development / Shared Code / Clippy: clipboard history tool on: 2014-10-29 10:11:57
My clipboard history is one of my most valuable tools. I use it extensively while coding, writing emails, etc. I used it while writing this post! If you are a coder, I really think it can make a nice improvement to productivity.

I've been using ArsClip for a long time, something like 10 years. I even donated multiple times. After some frustration with the latest versions and wishing that search was easier, I finally decided to write my own minimalistic clipboard history tool. Thus, Clippy was born!

Clippy is a clipboard history tool for Windows. It uses Java of course, with JNA for the Windows specific parts and an H2 database to store any text items that are copied to the clipboard. The stored text items can be easily retrieved by browsing or searching.
22  Games Center / WIP games, tools & toy projects / Re: GNetLib (A Simple Java Networking Library) on: 2014-10-10 12:06:17
Not meaning to hijack, but FWIW in KryoNet when you register classes they are given an ordinal which is sent over the network to identify the class. To send class names for unregistered classes, you can do:
1  
endpoint.getKryo().setRegistrationRequired(false);

KryoNet is a simple networking API based on NIO (eg connect, send objects, receive objects, disconnect). How objects are serialized across the wire can be customized. The KryoSerialization class (used by default) uses Kryo for serialization. JsonSerialization uses JsonBeans (nice for debugging since the data is human readable).

If you preferred your networking API, you could still use Kryo or JsonBeans for serialization. Might save you some effort and allow you to focus more on the networking API. Eg, KryoNetty uses Netty for the networking and Kryo for the serialization.
23  Game Development / Game Mechanics / Re: Downstream and upstream on: 2014-10-04 20:06:19
https://github.com/libgdx/libgdx/wiki/Scene2d#event-system
24  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Unchecked Call Warning on: 2014-10-04 18:21:16
Disable the generics warnings that are overly strict. Like this:

25  Java Game APIs & Engines / Engines, Libraries and Tools / Re: How to install Eclipse on: 2014-09-29 17:37:03
Maven can be ok for large projects/teams, but just adds more layers and gets in the way for my modest solo projects. It's neat that Eclipse can automatically download and use dependencies via Maven, but this isn't a problem that needing solving for me. I can easily do without having something unnecessary in the build chain that is doing all kinds of things behind the scenes. JARs in a directory is infinitely simpler.

Git doesn't have explicit rename or move, so there isn't a need for IDE SCM integration like there was for SVN. The Eclipse Git plugin adds junk to the UI and generally annoys me. SmartGit is a separate, dedicated SCM tool and is much better than the Eclipse plugin or even other dedicated tools.

For similar reasons, I don't pretend Eclipse is the file system -- I have the file system for that, and it does a better job. I don't even use the Package Explorer view because a Java project really isn't hierarchical (packages are easier navigated as a flat list).

Maybe you hate Eclipse because it came with a bunch of junk?
26  Java Game APIs & Engines / Engines, Libraries and Tools / Re: How to install Eclipse on: 2014-09-29 16:28:12
I should not rename this.

Git and Maven support are atrocities.
27  Java Game APIs & Engines / Engines, Libraries and Tools / How to install Eclipse on: 2014-09-29 15:37:31
1) Download 32-bit "Eclipse for Java".

2) Copy any plugins into the "dropins" folder (eg Practically Macro).

3) Set the VM and VM settings in eclipse.ini, eg:

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  
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
-vm
C:/System/Java/jdk1.8.0_11/jre/bin/server/jvm.dll
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20140603-1326
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-server
-Dosgi.requiredJavaVersion=1.6
-Xms128m
-Xmx512m
-XX:MaxGCPauseMillis=100
-XX:+UseConcMarkSweepGC
-XX:+AggressiveOpts
-XX:InlineSmallCode=2000
-XX:MaxInlineSize=70


Note "--launcher.library" changes each Eclipse update.

4) Run:

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  
rm -rf readme
rm -rf *.html

rm -rf features/org.eclipse.cvs*
rm -rf features/org.eclipse.egit*
rm -rf features/org.eclipse.epp*
rm -rf features/org.eclipse.jgit*
rm -rf features/org.eclipse.m2e*
rm -rf features/org.eclipse.mylyn*
rm -rf features/org.eclipse.wb*
rm -rf features/org.eclipse.wst*

rm -rf plugins/org.eclipse.aether*
rm -rf plugins/org.eclipse.cvs*
rm -rf plugins/org.eclipse.egit*
rm -rf plugins/org.eclipse.epp*
rm -rf plugins/org.eclipse.gef*
rm -rf plugins/org.eclipse.help.ui*
rm -rf plugins/org.eclipse.jgit*
rm -rf plugins/org.eclipse.m2e*
rm -rf plugins/org.eclipse.mylyn*
rm -rf plugins/org.eclipse.team.cvs*
rm -rf plugins/org.eclipse.wb*
rm -rf plugins/org.eclipse.wst*
rm -rf plugins/org.eclipse.xsd*


Smoking "org.eclipse.help.ui" lets you map the easy to hit F1 key to something useful.

5) Enjoy your nice, fast Eclipse without a bunch of junk. Don't muck it up by installing the Android tools. I recommend the ADT Bundle for that, so Google's nasty, buggy stuff can stay separate from your nice Eclipse.
28  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Updated LibGDX, crashes when creating SpriteBatch. on: 2014-09-24 21:43:32
LwjglGraphics: created OpenGL 3.2+ core profile context. This is experimental!
29  Discussions / General Discussions / Re: Microsoft to buy Mojang for $2 billion? on: 2014-09-18 23:16:55
What would you do if a little kid runs up to you and tells you to implement 'XXX' into your Game, or the Kid will scream around and sue you (or something)?
You've described Spine users! Grin Wink I have all the pain of stardom but without the boatload of money. Booo!

Quote
What if you *couldn't meet a single person in real life* who hasn't heard something negative about you?
Move to eastern Europe where no one expects you. I have already done this in anticipation.

Besides, Notch still likely has these problems even after selling Mojang.

Quote
it's pretty hard to stay anonymous
If that were true then we'd all know which one of us is Notch. He never really left.

Quote
The point is, Notch isn't "selling out", whatever that even means. He's sick of all the crap that comes with fame, *which people in this thread are still giving him*, proving his point even while trying to discredit him for whatever reason.
Don't get me wrong, if he's tired of whatever and wants to do whatever else, good on him for making his life what he wants it to be. I just like to think through what I would do in a similar spot. It would be goddamned amazing.  Cool Think of the impact I could have on my friends, family, even the world given enough success (at least the parts of the world I like  Tongue).
30  Discussions / General Discussions / Re: Microsoft to buy Mojang for $2 billion? on: 2014-09-18 14:46:46
Haha. Cheesy I just don't think it's really that hard to not care about the opinion of millions of strangers.
Pages: [1] 2 3 ... 59
 

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

The first screenshot will be displayed as a thumbnail.

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

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

toopeicgaming1999 (14 views)
2014-11-26 15:20:08

SHC (27 views)
2014-11-25 12:00:59

SHC (25 views)
2014-11-25 11:53:45

Norakomi (31 views)
2014-11-25 11:26:43

Gibbo3771 (25 views)
2014-11-24 19:59:16

trollwarrior1 (38 views)
2014-11-22 12:13:56

xFryIx (77 views)
2014-11-13 12:34:49

digdugdiggy (55 views)
2014-11-12 21:11:50
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!