Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (577)
games submitted by our members
Games in WIP (498)
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  
  Summer project  (Read 2450 times)
0 Members and 1 Guest are viewing this topic.
Offline marcuiulian13

Senior Member


Medals: 5



« Posted 2012-06-17 14:08:06 »

Hello everyone! As you know, the summer has come and this is the last week of school (wop wop). So now i have a lot of free time to skate (i'm a rollerblader) and to start making a game. Yesterday i started developing my first serious project (i hope so) of a 2D game wrote in Java and using Slick2D.

This is a blog where i will post every update i do: http://sgamed.blogspot.ro/

Also, if you want to see what i am doing on skates, check my youtube channel : http://www.youtube.com/user/eNoorProductions
Check one of my videos :
<a href="http://www.youtube.com/v/uj0Gt3Oq428?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/uj0Gt3Oq428?version=3&amp;hl=en_US&amp;start=</a>

Getting a project done is by far the most hard thing in game development.
Offline SkyAphid

Senior Member


Medals: 3
Projects: 1



« Reply #1 - Posted 2012-06-18 09:54:22 »

I plan on tracking your IP, finding you, and stealing your rollerskating talent; if that's okay. :p

Anyway, good luck on your project. I suggest using OpenGL or Slick2d, as Java2D isn't the best for game making, but if it's 8-bit-simple, you shouldn't have any problems.

Good luck, mane.

Edit:
Read that blog, you're using Slick2D. Good choice lol

“Life is pretty simple: You do some stuff. Most fails. Some works. You do more of what works. If it works big, others quickly copy it. Then you do something else. The trick is the doing something else.” ~Leonardo da Vinci
Offline marcuiulian13

Senior Member


Medals: 5



« Reply #2 - Posted 2012-06-18 10:22:36 »

Haha, lol. Thanks. Firstly i wanted to try using LWJGL but OpenGL owned me in 2 days. Smiley)

Getting a project done is by far the most hard thing in game development.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gimbal

JGO Coder


Medals: 25



« Reply #3 - Posted 2012-06-18 11:45:11 »

Impressive progress for such a short time. But if you're going to blog about it I would expect some more details, such as how you do certain things. If you don't spill the beans people won't have much of a reason to keep an eye on your stuff Smiley
Offline marcuiulian13

Senior Member


Medals: 5



« Reply #4 - Posted 2012-06-18 22:37:47 »

Thanks. As i said, this is my first "big" project, so it's the first time i do blog it. Thank you for advice i will do like you said.  Smiley

I hope i can ask one question here: In Slick2D, i should still place every Tile from a TiledMap in an array to lately render only what is in screen or is this process automatically done by Slick? Also, can someone point me to best mode to do the "depth" ?

Getting a project done is by far the most hard thing in game development.
Offline marcuiulian13

Senior Member


Medals: 5



« Reply #5 - Posted 2012-06-19 22:13:21 »

Yeaaah! I have found the easiest way to render only the visible tile. It is so simple, i didn't even think at this. Smiley

This was my render code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public void render(GameContainer container, Graphics g)  {
        g.translate(xOffset, yOffset);
        g.setAntiAlias(false);
       
        //Floor
       currentLevel.render(0, 0, currentLevel.getLayerIndex("floor"));
        currentLevel.render(0, 0, currentLevel.getLayerIndex("floordec"));

        for(int y = 0; y < currentLevel.getHeight(); y++) {

                //Rendering entities
               for(int i = 0; i < lLoader.getEntities().size(); i++) {
                        Entity currEntity = (Entity) lLoader.getEntities().get(i);
                        if(currEntity.getY() + currEntity.getHeight() >= y * 32 && currEntity.getY() + currEntity.getHeight() < (y + 1) * 32)
                                currEntity.render(g);
                }

                //Rendering tiles
               currentLevel.render(0, y * 32, 0, y, currentLevel.getWidth(), 1, currentLevel.getLayerIndex("walls"), false);
                currentLevel.render(0, y * 32, 0, y, currentLevel.getWidth(), 1, currentLevel.getLayerIndex("lowobjects"), false);
                currentLevel.render(0, (y - 1) * 32, 0, y - 1, currentLevel.getWidth(), 2, currentLevel.getLayerIndex("highobjects"), false);
        }
}


And now it is like :

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  
public void render(GameContainer container, Graphics g)  {
      g.translate(xOffset, yOffset);
      g.setAntiAlias(true);
     
      //RENDERING      
     //Floor
     
      currentLevel.render((-xOffset / 32) * 32, (-yOffset / 32) * 32, -xOffset / 32, -yOffset / 32, WIDTH / 32 + 1, HEIGHT / 32 + 2, currentLevel.getLayerIndex("floor"), false);
      currentLevel.render((-xOffset / 32) * 32, (-yOffset / 32) * 32, -xOffset / 32, -yOffset / 32, WIDTH / 32 + 1, HEIGHT / 32 + 2, currentLevel.getLayerIndex("floordec"), false);
     
      for(int y = -yOffset / 32; y < -yOffset / 32 + HEIGHT / 32 + 1; y++) {
         
         //Rendering entities
        for(int i = 0; i < lLoader.getEntities().size(); i++) {
            Entity currEntity = (Entity) lLoader.getEntities().get(i);
            if(currEntity.getY() + currEntity.getHeight() >= y * 32 && currEntity.getY() + currEntity.getHeight() < (y + 1) * 32)
               currEntity.render(g);
         }
         
         //Rendering tiles
        currentLevel.render((-xOffset / 32) * 32, y * 32, -xOffset / 32, y, WIDTH / 32 + 1, 1, currentLevel.getLayerIndex("walls"), false);
         currentLevel.render((-xOffset / 32) * 32, y * 32, -xOffset / 32, y, WIDTH / 32 + 1, 1, currentLevel.getLayerIndex("lowobjects"), false);
         currentLevel.render((-xOffset / 32) * 32, (y - 1) * 32, -xOffset / 32, y - 1, WIDTH / 32 + 1, 2, currentLevel.getLayerIndex("highobjects"), false);
      }
}



I only needed to do some math. Tongue

Blog is updating, so be sure you checked it. Cheesy

Getting a project done is by far the most hard thing in game development.
Offline marcuiulian13

Senior Member


Medals: 5



« Reply #6 - Posted 2012-07-07 02:17:30 »

I'm making progress with the game. Check out here: http://sgamed.blogspot.ro/

Getting a project done is by far the most hard thing in game development.
Offline roland
« Reply #7 - Posted 2012-07-07 03:17:09 »

1  
2  
for(int i = 0; i < lLoader.getEntities().size(); i++) {
            Entity currEntity = (Entity) lLoader.getEntities().get(i);


To me this looks a bit strange. lLoader.getEntities() should return a list/set of Entity right? that means you shouldn't have to cast.
You can also loop through all the entities like this, which should be a bit faster:
1  
2  
3  
for (Entity currEntity: lLoader.getEntities()){
...
}


Other than that, good work. Smiley
Offline marcuiulian13

Senior Member


Medals: 5



« Reply #8 - Posted 2012-07-07 10:32:15 »

1  
2  
for(int i = 0; i < lLoader.getEntities().size(); i++) {
            Entity currEntity = (Entity) lLoader.getEntities().get(i);


To me this looks a bit strange. lLoader.getEntities() should return a list/set of Entity right? that means you shouldn't have to cast.
You can also loop through all the entities like this, which should be a bit faster:
1  
2  
3  
for (Entity currEntity: lLoader.getEntities()){
...
}


Other than that, good work. Smiley

You are somehow right, then i was using Bags (custom collections) that don't have an iterator, but now i changed back to ArrayList to make the code simple. In my case, there is no speed change between Bag and ArrayList because I use Slick2D, but first time when i tried to make a game, using Java2D, there was a big difference between speeds.

Thanks!

Getting a project done is by far the most hard thing in game development.
Offline ReBirth
« Reply #9 - Posted 2012-07-07 12:56:06 »

@roland
The second loop creates new Itelator each time as I recall.

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

Senior Member


Medals: 5



« Reply #10 - Posted 2012-07-15 00:53:26 »

Alright guys, here comes some new updates and future plans. Cheesy
http://sgamed.blogspot.ro

Getting a project done is by far the most hard thing in game development.
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.

xsi3rr4x (18 views)
2014-04-15 18:08:23

BurntPizza (15 views)
2014-04-15 03:46:01

UprightPath (28 views)
2014-04-14 17:39:50

UprightPath (13 views)
2014-04-14 17:35:47

Porlus (29 views)
2014-04-14 15:48:38

tom_mai78101 (54 views)
2014-04-10 04:04:31

BurntPizza (111 views)
2014-04-08 23:06:04

tom_mai78101 (212 views)
2014-04-05 13:34:39

trollwarrior1 (181 views)
2014-04-04 12:06:45

CJLetsGame (187 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!