Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java Game Dev Wiki  (Read 3365 times)
0 Members and 1 Guest are viewing this topic.
Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Posted 2010-01-25 14:21:49 »

For quite some time I have been thinking that there should be some sort of wiki page associated with Java game dev. A lot of really useful information appears in this forum and some really brilliant things are discussed. However several things that I need now were discussed some years ago, and signal to noise ratio and discussions vs conclusions makes it difficult to find what I am looking for(even though that is much better than most other places). I expect that goes for many others here as well. Since I run the games4j.com website, I have been planning a wiki for some time, but the java4k compo was actually the thing that pushed me from planning to doing.

So anyway here is the wiki:
[size=14pt]wiki.games4j.com[/size]

Let me know what you think about this idea, and if you will contribute to it.

I did add some initial stuff in there, to my best knowledge. Do edit it if you think it is wrong and don’t be afraid to add stuff. No need for signup(for now at least), so just start typing.

Since the wiki is connected to http://games4j.com I added a section for all the platforms that the site supports.

Hope you like it!

Offline h3ckboy

JGO Coder


Medals: 5



« Reply #1 - Posted 2010-01-25 16:11:32 »

hey, I actually made the collision tutorial just now.

one question: how do I do code boxes? or even for that matter make it skip lines, cause it wont when I am doing code, so it is like completely blocked up....

looking good

edit: nvm, figured it out by looking at the fullscreen one you did.
Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #2 - Posted 2010-01-25 16:43:23 »

Yes, a good place to start if you don't know wiki markup/formatting so well, is to go to: http://en.wikipedia.org/wiki/Wikipedia:Cheatsheet. However the code style markup is not in there. For that you can use
1  
2  
3  
<pre>
sourcecode
</pre>

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 81
Projects: 15


★★★★★


« Reply #3 - Posted 2010-01-25 22:07:52 »

oh nice, looks like a very good resource.
Offline Wildern

Junior Devvie





« Reply #4 - Posted 2010-01-29 00:00:26 »

hey, I actually made the collision tutorial just now.

Looking at the tutorial, it could use a little cleanup.
1) The Sprite class should create the bounds rectangle in it's constructor and the getBounds method should just return that rectangle to avoid unnecessary object creation.
2) Decide on collide or collision for the method name, both are used at the moment.
3) It should be clear that the sprite's position should not change within that method (as the new position might result in missed collisions)
4) Collision only needs to be called on one of the sprites.  The way it is written, collision will be called twice on each sprite in the collision.
Offline Gudradain
« Reply #5 - Posted 2010-01-29 02:47:07 »

I really like the idea of a Wiki. I put my game loop code.
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #6 - Posted 2010-01-31 13:31:19 »

Looking at the tutorial, it could use a little cleanup.
1) The Sprite class should create the bounds rectangle in it's constructor and the getBounds method should just return that rectangle to avoid unnecessary object creation.
2) Decide on collide or collision for the method name, both are used at the moment.
3) It should be clear that the sprite's position should not change within that method (as the new position might result in missed collisions)
4) Collision only needs to be called on one of the sprites.  The way it is written, collision will be called twice on each sprite in the collision.


for the first one, I have to make it every time.... cause otherwise the rectangle would not move whenever the player moved.

second, sry, I must have missed that, I fixed it (I wrote most of that code on the spot...)

third, which method?

fourth, i dont know what to say besides, your wrong, and here is why Smiley

you would be right except for this line of code
1  
for (int j = [b]i+1[/b]; j < actors.size(); j++) {


you will notice that the second for loop starts in the list one AFTER the sprite it has already picked.
Offline JL235

JGO Coder


Medals: 10



« Reply #7 - Posted 2010-02-01 10:18:32 »

I have a few points...

1) Why would the sprite always be represented by a rectangle? A shape would be better which defaulted to a rectangle. Shoot-em-ups usually represent the player with a single pixel whilst circles often work better for bullets then rectangles because the bullets are circular. That's just two examples and there are plenty more.

2) Some of the code isn't formatted correctly, there is no tabbing. I've reformatted the code on your collision page but it should have been written correctly in the first place.

edit:
3) You don't need to comment every line, just describe the important blocks of code. Commenting every line just adds confusion and things like marking where a method ends and their code continues is just overkill. When it's 3 lines long and the only method, people can tell where it ends.

4) It's convention to use JavaDoc for documenting methods, not comments.

Offline Wildern

Junior Devvie





« Reply #8 - Posted 2010-02-01 13:06:52 »

for the first one, I have to make it every time.... cause otherwise the rectangle would not move whenever the player moved.

Sorry, I am used to using a fixed bounding rectangle and sprite's position as an offset.


third, which method?

collide, if you move the sprite in that method you could move it into a sprite you have already checked or away from a sprite you have not checked yet.

fourth, i dont know what to say besides, your wrong, and here is why Smiley

you would be right except for this line of code
1  
for (int j = [b]i+1[/b]; j < actors.size(); j++) {


you will notice that the second for loop starts in the list one AFTER the sprite it has already picked.

You are correct, I missed the i.
Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #9 - Posted 2010-02-01 13:09:17 »

Cool! Some nice contributions are arriving!

Gaming and networking frameworks has been added to the lists, 4K hints added and improved, and code examples in "Timing in main loops" and "Collision detection".

@h3ckboy

You were using mixing Sprite and Actor in the code. I changed it to only use Sprite, since that is the most predominant.
http://wiki.games4j.com/wiki/en/Special:Diff?topic=Collision_detection&version2=76&version1=77

I also added some links that can be useful for geometry based collision detection.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #10 - Posted 2010-02-01 14:17:26 »

I have a few points...

1) Why would the sprite always be represented by a rectangle? A shape would be better which defaulted to a rectangle.
Definitely a good point. I see that code as just one way of doing a simple collision check, so it makes sense to have it there. The problem is that Shape.intersects() only works for rectangles, so code for arbitrary Shapes would probably be much more complex. However, anyone with such working code are welcome to add or link them.

I have some code for lines, circles, rectangles and rotated rectangles, but the code is very proprietary to my situation, so I can't add that as it is. I added some links that I based my code on.

Offline h3ckboy

JGO Coder


Medals: 5



« Reply #11 - Posted 2010-02-01 15:41:17 »

@h3ckboy

You were using mixing Sprite and Actor in the code. I changed it to only use Sprite, since that is the most predominant.
http://wiki.games4j.com/wiki/en/Special:Diff?topic=Collision_detection&version2=76&version1=77

I also added some links that can be useful for geometry based collision detection.

sry, I used actor, and I tried to use sprite... but I must have accidentally wrote actors.

I remind you, I wrote that code one on the spot, so some might be wrong Tongue.

about the other shapes, basically the same as jojoh said....

and anyways, I labeled mine as "box collision", so feel free to add others Smiley
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (35 views)
2014-12-15 09:26:44

Mr.CodeIt (26 views)
2014-12-14 19:50:38

BurntPizza (60 views)
2014-12-09 22:41:13

BurntPizza (95 views)
2014-12-08 04:46:31

JscottyBieshaar (55 views)
2014-12-05 12:39:02

SHC (71 views)
2014-12-03 16:27:13

CopyableCougar4 (73 views)
2014-11-29 21:32:03

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

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

toopeicgaming1999 (34 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

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
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!