Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (726)
Games in Android Showcase (216)
games submitted by our members
Games in WIP (796)
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 ... 62
1  Discussions / General Discussions / Re: Programmer jokes on: 2017-05-21 06:24:57

Just stop drinking and you'll find it beautiful again. Programming is just a way of expressing your thoughts and getting the computer do what you want.
2  Discussions / Miscellaneous Topics / Re: What I drew today on: 2017-05-13 19:07:28
@ndnwarrior15

I'm not an artist, but here I come!

3  Game Development / Newbie & Debugging Questions / Re: [Solved] Returning specific type of Object that extends Object? on: 2017-05-01 23:33:14
You can even return mid loop.

1  
2  
3  
4  
5  
6  
7  
8  
9  
@SuppressWarnings("unchecked")
public <T extends Component> T getComponent(Class<T> klass)
{
    for (Component c : components)
        if (klass.isInstance(c))
            return (T) c; // Is Class#cast better here?

    return null;
}
4  Discussions / Miscellaneous Topics / Re: Silly Programming Mistakes on: 2017-04-24 09:24:02
Am making a tower defense game, and I decided to make the turrets fire to the nearest point in the path of enemies. Then I also wanted to do optimized code, that is, the nearest point will only be computed on the creation of the turret and not with every projectile created.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
if (nearestPathPoint == null)
{
    nearestPathPoint = path.get(0);

    for (Vector2 pt : path)
        if (pt.distanceSquared(this.position) < nearestPathPoint.distanceSquared(this.position))
            nearestPathPoint = pt;
}

// Now fire projectile towards nearestPathPoint after timer

But when creating the turrets, all turrets are firing towards same point. Then after an hour I realized, that I accidentally declared nearestPathPoint as static when it shouldn't be. Precious amount of time in LudumDare JAM.
5  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-04-20 16:32:38
I just downloaded SASM, an IDE for ASM programming. I'm gonna learn NASM after my exams, can't wait Grin

Wow cool! Am excited too. Am however using Atom instead of an IDE. Will check it out now.
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-04-18 15:42:21
Yes @ShadedVertex, it absolutely makes one program efficiently. I'm now very much interested in the low level details more than in higher OOP abstractions that I used to be fond of. Whenever I see a program, I'm now wondering how many instructions that this generate, etc.,

And by the way, I don't want to offend, but I don't believe one works so busy when in school, not only in school but anywhere. If you really want to do something, you can always try to make time for it. I did this in the two day preparation time that I got before my end semester examination, and the subject was Web Technologies, I had to study HTML, CSS, JS, PHP, Ruby, Perl, CGI and MySQL all for one exam. But I did great on the test. Just wanted to say, don't think otherwise.

Congratulations on your inter-school game dev competition, hope you do it well, and hope we will be able to play your game soon.
7  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-04-16 07:46:42
Took a peek into Assembly with NASM and wrote a factorial program.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
; The equivalent C code is as follows:
; ~~~
; long fact(long n)
; {
;     return (n == 0) ? 1 : n * fact(n - 1);
; }
; ~~~
fact:
    cmp dword ebx, 0    ; n == 0
    je .yes
.no:
    push ebx            ; save ebx in stack
    sub  ebx, dword 1   ; sub 1 from ebx. (n - 1)
    call fact           ; call fact recursively
    pop  ebx            ; get back the ebx from stack
    imul eax, ebx       ; eax *= ebx; eax == fact(n - 1)
    ret
.yes:
    mov eax, dword 1    ; store 1 in eax to return it
    ret


Complete program can be found at https://gist.github.com/sriharshachilakapati/70049a778e12d8edd9c7acf6c2d44c33
8  Game Development / Game Play & Game Design / Re: Graphics Backend Abstraction on: 2017-04-14 20:08:34
@princec It certainly is possible to do a low level abstraction, and here is an example of it: https://github.com/livingcreative/xgs
9  Game Development / Newbie & Debugging Questions / Re: Incorrect boolean value returned by keyboard input functions? on: 2017-04-07 14:03:56
If it is present in all the library or apps that you are using, then have you considered other scenarios that it might be possible?

  • Do you have sticky keys or some other driver related bloatware app that does this?
  • Have you considered checking whether the keyboard is the culprit? Connecting and testing on another system or laptop?
  • What is the polling rate of GameMaker? As far as I know, GameMaker targets 30 FPS and not 60, and hence it's input polling rate might also be 30 Hz. So input gathered every 33 ms.

These, are just really guesses. Maybe a test on other system will reveal more clues.
10  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-04-01 16:45:56
It's not at all related to code, or anything digital, but a general event. I have got my ID card broken, and I had to write a letter to the HOD to grant me a new ID card. So I wrote this letter:

I, Ch. Sri Harsha, student of CSE 3rd year section A bearing the roll number <myroll> had got my ID card broken into pieces due to a series of unfortunate incidents. So I request you to kindly grant me a new one.

Then my HOD asked me, may I ask what are those series of unfortunate incidents??

I replied, "Ma'm I was playing with it, swinging it around by the tag. Unfortunately it hit the desk and due to that it broke into two".

Dunno why, but this is the funniest letter that I have ever written and wanted to share with you guys.
11  Game Development / Game Play & Game Design / Re: Graphics Backend Abstraction on: 2017-03-24 11:48:33
@CoDi^R

That would be an issue when someone reordered the enum contents.
12  Discussions / Miscellaneous Topics / Re: Programming in schools - opinions? on: 2017-02-24 10:21:51
I got into programming much early than most of my college pals here, almost 8 years earlier than when they started learning that they can also program computers, and they came to know about languages. The case of studies is different here in India, where you join school when you are 6 years old (play schools aren't a thing when I was young, but they came nowadays and are even admitting in 4 year olds). Then you study all the types of subjects until you get 16 and come out of school. We all had English, Telugu (our state language), Hindi (our national language), Science (biology, physics and chemistry), Social Studies (history, geography, civils and economics), and if the child wants to, they also teach Sanskrit (the oldest language from which all the Indian languages derived).

Okay, but that is a lot? You might feel so, but no. The syllabus they teach is very small, and they are present to let the child know the different available fields that they can get into. Till here, computers are only a basic education, children will learn to use computers, play games, create art works using paint, create presentations, taking printouts, sending and receiving emails, etc., Nothing more. And I can bet 90% of my friends haven't seen a computer until they are 12 or 14. Even schools lacked faculty who can teach computers, so even though the government sponsored the hardware, they had to take rest here.

I and a friend of mine, taught computers to ourselves, by experimenting with them. We used to see what makes what, that we actually opened up hardware and refitted them, and by reading their manuals, we came to know about operating systems, software, and all. We made games (using Game Maker 5.1) when we are 12, and we showed most of my friends what a computer is, by using games.

Then after school, we had two ways, the diploma (work based courses) and the intermediate (maths, physics, chemistry, botany, zoology, history, geography, economics, and civil). I went the intermediate way and chose Maths, Physics and Chemistry as my preferred subjects. Additionally, here, English, Telugu and Sanskrit are a must. No programming or computers here again.

Then there are two major streams, Engineering and the Medicine, but there are also Arts, law, etc.,

Coming to Engineering, the guys who chose to intermediate will be taken into the first year, while the diploma guys join directly in the second year. There are five major branches, which are as follows:

  • Computer Science
  • Electronics & Communications
  • Electronics & Electrical
  • Mechanical
  • Civil Constructions

It is in engineering that most students here take their first glance at computers. However, the first year of engineering is the same for all the streams. We have to study Applied Mathematics, Applied Chemistry, Applied Physics, Computer Basics, Programming in C, Engineering Mechanics, Mechanical Drawing. English comes additionally here as one of the language subjects. There are no needs to keep Telugu, Hindi and Sanskrit, we will be well versed in them because they are our native languages.

When I got into engineering at the age of 18 in 2013, I already know of C, C++, Java, C#, VB.Net, Haxe, JS, PHP, and some basic Ruby. I already knew the languages, how to debug programs, (I had written my first game engine back in 2009 in Java) so I assumed that it will be very very easy, but alas, it isn't.

Why?? Faculty are interested in completing the subjects (as increasing the students marks, not knowledge), and didn't care about the thought process. I mean, they didn't teach the students how to understand a problem and find the cause for it. And next, the colleges here are affiliated to universities, and had to teach the never updated syllabus that is designed by some very experienced faculty (experienced in teaching and academics, not in the emerging technologies).

There is also a drawback in my own self. I always thought that computer science was nothing but programming, commanding computers to do what we want, but then it actually is all about learning lessons from others inventions, and finding the logical solutions to the real world problems. With the subjects we had, and with that decade old syllabus, we are only going to learn the real basics which are just enough to survive in the everyday's programming job.

We are taught design patterns, and it is our part to learn about when to use a specific pattern. We are taught about data structures, and again, we have to learn to find the correct datastructure to use on our own. The same goes to computer organisation, operating systems, linux programming, and a lot of subjects.

With all these things said, I came to know that a teachers part is very limited, and in fact, it is the part of the students that has more weight in the complete learning process. Teaching to kids is, yes, fine, but it will only be effective when the child is also interested in the outcomes. At such a young age, I don't think children in schools need high programming, because they don't know how the problems will be, and all. Instead, tell them how to think.

Games are a wonderful tools for that, and most of the young people today are well capable of playing games. Teach them to programming by teaching them to make games. Giving some presentations with some code snippets will only make them yawn in class and makes them sleep.
13  Game Development / Performance Tuning / Re: Quadtree Efficiency? on: 2017-02-22 14:58:02
Cell grids are good, I agree, but @Riven, I don't know which type of game the OP is making, so I recommended one that works for all sorts of games. Even with adding a number to make the indices positive, it won't work well when we have open world games. However, AABB trees are easy to understand, and yet the same time, give good performance.
14  Game Development / Performance Tuning / Re: Quadtree Efficiency? on: 2017-02-22 13:19:47
Grids are extremely fast and trivial, but you need to spend some time tweaking them when you have objects with negative positions. Since you'll typically implement them as 2D arrays, negative indices will be a problem.

I really really prefer using boundary volume hierarchies, like aabb trees or circle trees. You can read up more here:

https://goharsha.com/blog/aabb-trees-for-collision-detection/
15  Discussions / Miscellaneous Topics / Re: What I drew today on: 2017-02-14 13:20:52
Been a bit artistic in today's English class in college:

16  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-02-12 05:23:44
I apologize for bringing c++ to this forum once again..

1  
typedef std::_List_iterator<std::_List_val<std::_List_simple_types<std::function<void(int, int)>>>> ResizeListenerHandle;
So I wrote this as part of my c++ game. Believe it or not, it is actually useful.


... I sure am glad typedefs exist. persecutioncomplex

Combine that with macros!

1  
2  
3  
4  
5  
6  
#define DEF_ITER(type) typedef std::_List_iterator<std::_List_val<std::_List_simple_types<std::function<type>>>>

DEF_ITER(void(int,int)) ResizeListenerHandle;
DEF_ITER(void(int,int)) PositionListenerHandle;

// And so on...
17  Discussions / General Discussions / Re: Programmer jokes on: 2017-02-05 18:50:10
... snip ...

You must watch this:

<a href="http://www.youtube.com/v/RnqAXuLZlaE?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/RnqAXuLZlaE?version=3&amp;hl=en_US&amp;start=</a>
18  Discussions / Miscellaneous Topics / Re: Saving, loading—oh no! Semi-tutorial discussion holy piñata thing on: 2017-02-04 19:08:21
In my opinion, serialization is a dangerous thing to use for saving games.

Consider the case that you released your game that is using serialization of the game stats object. You have fields such as this.

1  
2  
3  
4  
5  
6  
7  
8  
public class Stats
{
    public static int levelReached;

    public static int numVehiclesDestroyed;
    public static int numCarsImmobilized;
    public static int numCarsImpounded;
}

You are saving this as your game save. Good, but then in a next version, you decided to refactor numCarsImpounded into numCarsCaptured or something for instance. When you release this version, you'll also introduce a bug, a major issue. All the existing player's game saves will be lost as serialization will fail.

You might also have save game on exit, and that even destroys all the progress the guy has made. I even faced this issue in a college project, and this was my good lesson.

For this purpose, I'd never consider serialization for save games. Instead, my choice would be to go with JSON or XML. Have predefined JSON structure, and you can also upgrade existing save games to newer JSON structure. If you fear that player may alter the stats, go implement a custom file format, maybe even binary.
19  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-02-03 13:40:18
Turned 60. Shocked

Wait, is that in decimal system or some other like hexadecimal?

1  
2  
60 (oct) == 48 (dec)
60 (hex) == 30 (dec)

Which one should we follow?
20  Game Development / Newbie & Debugging Questions / Re: Looking for some library for triangulating polyine / path on: 2017-02-02 17:51:27
For any non-intersecting polygon, you can make it into triangles by considering the first vertex to be the common vertex of all triangles. Then iterate on the remaining vertices (from 1 to n - 2) and get (s, i, i + 1) into a new triangle. This is the simplest algorithm and should always work.

Btw why you need a library when this is just one simple function?
21  Game Development / Newbie & Debugging Questions / Re: Load a GMMOD File on: 2017-02-02 15:55:59
I did some searching, and found a solution for this. The GMMOD file is a text based file, and contains model in the GAME MAKER 3D MODEL format. The format seems to have changed, and modern GM versions now use OBJ instead of this file format.

However, there is some editor to create models in this file format: http://www.maartenbaert.be/model-creator/



I've tried to create a simple triangle with it (it's not at all easy to use, Blender is the right tool for this job) and exported it into a GMMOD file, and it created the following contents.

1  
2  
3  
4  
5  
6  
7  
100
5 GMMC 5.0 1.0000 1 1.0000 0.0000 1 1 0  0 0
0 4.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
9 0.0000 4.0000 23.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 16777215.0000 1.0000
9 -21.0000 4.0000 0.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 16777215.0000 1.0000
9 19.0000 4.0000 0.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 16777215.0000 1.0000
1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000

From my limited understanding (and guesses), the first part seems to be the instruction type and the rest are arguments. My assumption is as follows:

  • 100 seems to be file format version, or some magic number.
  • 9 seems to be vertex definition, followed by 3 floats for position, 3 floats for normal and 4 floats for color.
  • I didn't understand what 0 and 1 commands stand for.

It is extremely difficult to progress, since there exist no documentation for this file format. And then, I found a cool function in this program. It can export GMMOD files into OBJ models. Use the settings icon in View 2 to export as OBJ.



And this one works fine, I can load the OBJ model in Blender and it rendered exactly as it is in the GMMC editor. Definitely recommend to go use the OBJ export feature and update all your models to this format. BTW out of curiosity, from where did you get GMMOD models?
22  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-01-28 19:44:41
Just got an idea to generate a polygon from an image, and started to code it out. There are a few imperfections, but it is looking out nice!

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  
Polygon polygon = new Polygon();

List<Vector2> vertices = new ArrayList<>();
Color pixelOut = Color.REUSABLE_STACK.pop();

// Start scanning the image from left to right, and then from top to bottom
for (int y = 0; y < image.getHeight(); y++)
{
    boolean found = false;

    for (int x = 0; x < image.getWidth(); x++)
    {
        image.getPixel(x, y, pixelOut);

        // Add the first non-transparent pixel
        if (!found && pixelOut.a != 0)
        {
            vertices.add(new Vector2(x, y));
            found = true;
        }
        // Add the last non-transparent pixel
        else if (found && pixelOut.a == 0)
        {
            vertices.add(new Vector2(x - 1, y));
            found = false;
        }
    }
}

// We got the vertices that surround the image, but they are in scanned order.
// Sort them into clock-wise order
Vector2 imgCenter = Vector2.REUSABLE_STACK.pop().set(image.getWidth() / 2f, image.getHeight() / 2f);
Collections.sort(vertices, (v1, v2) -> (int) (v1.angle(imgCenter)) - (int) (v2.angle(imgCenter)));

And it looks like this in action!



Looking cool! This is very inefficient however, generated 880 vertices for this simple tree image. I'm now going to try creating a convex hull over this concave polygon.
23  Discussions / Miscellaneous Topics / Re: What's in your gamedev software rig ? on: 2017-01-24 18:09:02
VIDYA

You might have said that unintentionally, but VIDYA in Telugu means EDUCATION.
24  Game Development / Newbie & Debugging Questions / Re: Attack action on: 2017-01-24 17:01:45
@SHC that's also what I do in my game.  I have a rectangle that is larger than the enemy, and if the player intersects with that rectangle, enemy is triggered to attack.

You seem to have associating one extra rectangle per each enemy aren't you? I'd instead associate one large rectangle with the player, and if the enemy intersect the large rect, then only that player will rush and attack.

Though both works, it is just an optimization to remove extra shape instances. Even though you went with either way, no penalty will be observed if you have a broadphase that prunes away unnecessary checks.
25  Game Development / Newbie & Debugging Questions / Re: Attack action on: 2017-01-24 16:52:40
I think for simple 2D platformer games, using raycasting is a bit overkill, instead you can get around with a circle with a defined radius of visibility around the area of the player.



(Excuse my poor drawing skills). Any enemy once got a event with circle of visibility, can attack the player and charge towards him. This is more simple in my opinion.
26  Discussions / Miscellaneous Topics / Re: What's in your gamedev software rig ? on: 2017-01-24 15:30:35
Hardware

Intel i7 4790k
NVIDIA GTX 750 Ti
RedGear Wireless Pro Gamepad (XBOX Style)
Speedlink Wired USB Gamepad (PS3 Style)
LiveTech Wired USB Gamepad (PS3 Style, cheap one)
Microsoft XBOX 360 Wireless Controller (Original, including wireless receiver for PC)
Logitech WebCam, keyboard and mouse
Built-in Sound Card
An old 1600x900 monitor (Saving now to replace it with a new one)

Software

Windows 10 Home
Java 8 (64 bit)
.Net 4.6
Python 3
Ruby 2
SilenceEngine, Unity3D
VisualStudio
IntelliJ IDEA Ultimate
Eclipse (college forces me to use Eclipse, although I have IDEA)
Atom (my favourite for Web dev and Gradle script editing)
GIMP
Inkscape
Synfig Studio (2D skeletal animation tool)
Blender 3D
27  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-01-19 18:51:35
I decided to add multi lingual support for my website powered by Jekyll, and it is extremely easy with the front matter. From now on, I'm going to post in Telugu and Hindi along with English.

https://goharsha.com/blog/multi-lingual-support/

Look at the language-selector in the top right!
28  Discussions / General Discussions / Re: GLFW Controller Database on: 2017-01-17 14:13:11
I just purchased Redgear Pro Wireless Game Pad with XBOX 360 layout, and this one is so cool! It's just ₹1600/- ($23.54) and is the best one for the price. Got the following mappings in Windows.



This one identifies as Xbox 360 Controller on XInput mode, and as Redgear on DirectInput mode, and both works out of the box without any custom drivers.

The commit 5685a23 adds the support.
29  Java Game APIs & Engines / Android / Re: OpenGL ES 2.0 - Interaction between the game loop and the rendering thread on: 2017-01-12 23:21:59
From my experience, Android is a lot different from traditional desktop systems. Unlike the desktop, you have two threads, the android UI thread and the GLThread created for you by the GLSurfaceView. I see that you are trying to separate rendering and logic, but I'd say it's not worth the effort on Android.

I agree that parallelization gives a performance boost, but only if done correctly. And most of the time, there will be other reasons of you experience the performance issues. I'd not go for it unless there are no other areas of optimization left.

Coming to the question, I guess you want to run some tasks on the UI thread, like operations that switch the device orientation etc., and some other you want to handle in the GLThread, like in the case of inputs.

1  
surfaceView.queueEvent(() -> postTouchEvent(finger, false, 0, 0));

That will make your code run on the GLThread. Now for operations like changing the device orientation, you can use the activity methods like this.

1  
2  
activity.runOnUiThread(() ->
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE));

This is very similar to swing's SwingUtilities.invokeLater method. Now let us get to the game loop. In the renderer of the GLSurfaceView, there is no separation of logic and render. When you set the render mode to continuous, it repeatedly calls the onDrawFrame method, so keep both the update and render calls directly in it.

For reference, you can checkout the code in my android backend: https://github.com/sriharshachilakapati/SilenceEngine/tree/master/backend-android/src/main/java/com/shc/silenceengine/backend/android
30  Discussions / General Discussions / Re: GLFW Controller Database on: 2017-01-10 14:34:46
@chrisevergreengamesorg

If the game pad is identified as USB Joystick on Windows, that means that windows is using the generic driver for Joysticks. Don't you have a driver that came along with it?

And by Single Axis, DPad Only, do you mean there is only one analog stick, or there are no analog sticks, and DPAD is reported as axes also? And is this your gamepad? I had a hard time searching for this one, it seems there is very less information on this.

Pages: [1] 2 3 ... 62
 
Archive (286 views)
2017-04-27 17:45:51

buddyBro (477 views)
2017-04-05 03:38:00

CopyableCougar4 (924 views)
2017-03-24 15:39:42

theagentd (937 views)
2017-03-24 15:32:08

Rule (948 views)
2017-03-19 12:43:22

Rule (916 views)
2017-03-19 12:42:17

Rule (918 views)
2017-03-19 12:36:21

theagentd (973 views)
2017-03-16 05:07:07

theagentd (891 views)
2017-03-15 22:37:06

theagentd (688 views)
2017-03-15 22:32:18
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

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
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!