Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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  
  2D Sidescroller design questions  (Read 4396 times)
0 Members and 1 Guest are viewing this topic.
Offline 0026sd

Junior Newbie

« Posted 2011-09-26 17:48:20 »


I have a couple questions regarding the programming/design side of building a 2D sidescroller. They are as follows (these questions are assuming a game-style similar to that of Mario for Nintendo):

  • Threads: Typically, how many threads would, say, a level have? What should these threads be used for? To clarify a bit more, would I need a separate thread for jumping, firing projectiles, walk/run, each sprite on screen, ect?
  • Background: Should I have 1 long image for the background that scrolls as the player moves or have multiple backgrounds that get stitched together on the fly when the character reaches the edge of the current image?
  • Books: Can anyone reccomend any good books? I feel overwhelmed with the choices and would prefer to spend a lot of time in one good book than skin through many books. Also, don't go to much effort researching (I've already been doing that). Just if there's one in particular that you've worked with and enjoyed.

And I suppose that's it. Thanks so much for any feedback!! It's much appreciated!
Offline Eli Delventhal

JGO Kernel

Medals: 42
Projects: 11
Exp: 10 years

Game Engineer

« Reply #1 - Posted 2011-09-26 18:10:52 »

1. Almost always 1. You rarely need more, and when you do they're certainly not for jumping or anything like that. Everything should be run within the same game loop (and thread). Examples of the few places I multithread - multiplayer games (server / clients need different threads), stuff loading in the background,

Always tile if possible. Huge textures take up a lot of memory and a long time to load. Even if you want the whole level to look unique (like one long image), you should break up that image into screen-sized pieces so at most you are drawing two at once (if the player is on between two screens).

I'll let others answer this one. I know a lot of people have good opinions here, and I don't.

One of the first games I ever made was a clone of Mario (it was called Jario, LOLOLOLOL). One thing I did (that is very noob) was adding threads all over the place. For example, when the player lands on an enemy, I created a new thread to bounce them back up (that little pop-up effect), instead of maybe, I dunno, applying an impulse to the player's velocity  Roll Eyes. If you do want something to happen over a certain period of time, making another thread is not at all the right approach. Instead, make a list of "Effects" or something, and just tell them to update every timestep. If you want elaboration just ask.

See my work:
OTC Software
Offline 0026sd

Junior Newbie

« Reply #2 - Posted 2011-09-26 18:20:40 »

"it was called Jario, LOLOLOLOL"

Hahaha! Amazing!

Your answers were very helpful -- I was actually watching a tutorial on YouTube where the guy was making a thread just for jumping and it had a little confused. I also figured that tiling would be more efficient and memory-friendly but it was still a grey area, so thanks.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #3 - Posted 2011-09-26 22:08:04 »

I'll let others answer this one. I know a lot of people have good opinions here, and I don't.

i coincidentally only read the ones which are stated in the Java Gaming Resources here:
Killer Game Programming in Java - Andrew Davison
Developing Games in Java - David Brackeen
and I liked them, they helped. Actually Brackeens was better for me.

The rest, Eli already answered very nicely.
1 Thread - If you dont have levels, but very big open areas, you would need a background loading thread. but other than that...
And yeah Tiles. EVEN if you want one giant piece of artwork, in code, still splice it. Which is the same as tilesheets code-wise.

Offline Sinuath

Junior Devvie

Medals: 2

« Reply #4 - Posted 2011-09-26 23:57:32 »

the project in this book is to create a mario like sidescroller.

I really like the book but it's a little over my head.

Hey [you][/you], you should totally check out my boring Site ~
Offline 0026sd

Junior Newbie

« Reply #5 - Posted 2011-09-27 12:43:52 »

Thank you all so much!

Regarding the books, I've actually heard of those, which is great because it makes me feel better about investing the money.

As for my other questions, I have no more doubts. Wonderful!
Pages: [1]
  ignore  |  Print  

EgonOlsen (77 views)
2018-06-10 19:43:48

EgonOlsen (57 views)
2018-06-10 19:43:44

EgonOlsen (77 views)
2018-06-10 19:43:20

DesertCoockie (259 views)
2018-05-13 18:23:11

nelsongames (157 views)
2018-04-24 18:15:36

nelsongames (156 views)
2018-04-24 18:14:32

ivj94 (897 views)
2018-03-24 14:47:39

ivj94 (161 views)
2018-03-24 14:46:31

ivj94 (810 views)
2018-03-24 14:43:53

Solater (174 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

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