Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
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  
  Making Different Levels?  (Read 2039 times)
0 Members and 1 Guest are viewing this topic.
Offline jparril1

Junior Devvie





« Posted 2011-03-10 21:23:54 »

Hey Guys,

       So Ive been moving along pretty well lately, and I think its time to take my games to the next step. Im trying to figure out how to implement a level structure. For instance right now Im working on a shooter kind of like space invaders. I want there to be a level structure, so for instance the first few levels increase in alien ship count and speed, and then every 5th level is some sort of boss battle. Im having trouble figuring out how to achieve this. Is this a technique that I should save until Ive gotten better at this? I mean I know how to increase the difficulty and make a boss battle, but I can only understand how to implement them as totally separate games. How can I create a flow that carries through the entire game experience?

I was thinking of doing it with states. So Like each level is a state, and if the game is in a certain state, code is executed that pertains to that state. So if level5 is the current state, some boss code will run.. does that make sense, or way too complicated?
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #1 - Posted 2011-03-10 22:33:44 »

Depends a lot on what you're going for. How procedurally generated is your game? How pre-built. A fully pre-made game should have a Level object that can be loaded from some sort of file. Then there is only one Level active at one time, and perhaps different ways to link between them (like in an RPG, a door in one level might lead into another one). In your game, you can just have them lead to one another in a linear fashion as long as the order is stored somewhere.

I would imagine your Level object to be something like this:
1  
2  
3  
4  
5  
6  
7  
8  
public class Level
{
    Wave[] enemyWaves;
    float powerupChance;
    EnemyType[] possibleEntities;
    float scrollSpeed;
    //etc.
}


Pretty much anything that is specific to an individual level should be a member in the Level object. Then you just create the objects somehow (whether through a level editor or a text file or XML or whatever). I usually have the World contain one level, then as the player moves around the World fetches data from the Level to decide how to respond. In your case, that means the World would spawn enemies based on timing, scroll the screen at different speeds, etc.

See my work:
OTC Software
Offline ReBirth
« Reply #2 - Posted 2011-03-11 10:45:35 »

What a damn, I'm creating clone of space invader too (in pulpcore but) and going to implant the levels. On my design, the key is located on the method where everything be declared (ship, aliens, speed, etc) called newGame(int level). I pass a value of next level and the method will determine aliens, speed, etc for next game based on that value. Example

1  
2  
3  
4  
void newGame(int lvl){
    for (int i=0; i<lvl*6; i++)
        aliensContainer.add(new Alien());
}


On that example, each level will increase the aliens by 6 (lvl1 6 aliens, lvl2 12 aliens and so on).

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

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #3 - Posted 2011-03-11 18:23:03 »

Yeah, you could certainly do that. I try to avoid it these days because it's so difficult to maintain - at the very least I make text files for each level and then just parse them. That's just as fast to implement.

See my work:
OTC Software
Offline ReBirth
« Reply #4 - Posted 2011-03-12 03:26:56 »

If you want to have a boss each 5 levels you need to check (simply by %5) the value and make it appear a boss rather commonAlien*6. Hope can help you.
Yeah, you could certainly do that. I try to avoid it these days because it's so difficult to maintain - at the very least I make text files for each level and then just parse them. That's just as fast to implement.
not only difficult. That also just applies on linear way Cheesy

Offline jparril1

Junior Devvie





« Reply #5 - Posted 2011-03-12 03:33:40 »

Thanks guys. Game programming is proving to be harder than any programming project Ive ever had in school, BY A MILE!
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #6 - Posted 2011-03-12 05:46:58 »

Thanks guys. Game programming is proving to be harder than any programming project Ive ever had in school, BY A MILE!
To be a good game programmer you need to be a jack of all trades, whereas most other areas you just need to be a specialist.

See my work:
OTC Software
Offline ReBirth
« Reply #7 - Posted 2011-03-13 03:29:18 »

Thanks guys. Game programming is proving to be harder than any programming project Ive ever had in school, BY A MILE!

yeah, because you just need to pass your teacher's taste in your work Cheesy

Offline jparril1

Junior Devvie





« Reply #8 - Posted 2011-03-13 03:35:17 »

Yeah I guess so. Its just so rewarding, I got my character to jump tonight and I havent been so excited in ages lol
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #9 - Posted 2011-03-14 17:59:10 »

Yeah I guess so. Its just so rewarding, I got my character to jump tonight and I havent been so excited in ages lol
Haha awesome. Congrats. Smiley

See my work:
OTC Software
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.

Mr.CodeIt (10 views)
2014-12-27 04:03:04

TheDudeFromCI (14 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

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

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

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

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

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

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

CopyableCougar4 (102 views)
2014-11-29 21:32:03
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!