Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (525)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
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]
1  Game Development / Game Play & Game Design / Re: State-Controller-View-Model on: 2008-10-18 01:34:54
Take a look at http://www.puremvc.org.  I don't think PureMVC was designed with game development in mind, but they provide good diagrams and documents explaining how it works.  There are many forms of the MVC pattern, and the PureMVC is just one of them.  Still, you could gain something from looking at it, or you could go right ahead and implement their library.
2  Game Development / Newbie & Debugging Questions / Need better way to handle movement in 2D plane on: 2008-02-22 07:20:34
Currently I'm trying to work on movement AI for enemy Spaceships.  Simple stuff, just left, right, up, down movement.  I've implemented player movement by doing the simple move() function like this:

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  
public void move(Direction dir) {
      switch(dir){
         case NORTH:
            if((coordinate.getY() - y_speed) >= 0){
               // Set the sprite to the appropriate frame
               sprite = SpriteStore.getStore().getSprite(SHIP_PLAYER_UP);
               // Move the ship
               coordinate.moveY(-y_speed);
            }
            break;
         case SOUTH:
            if((coordinate.getY() + y_speed + sprite.getHeight()) <= BACKGROUND_HEIGHT){
               // Set the sprite to the appropriate frame
               sprite = SpriteStore.getStore().getSprite(SHIP_PLAYER);
               // Move the ship
               coordinate.moveY(y_speed);
            }
            break;
         case EAST:
            if((coordinate.getX() + x_speed + sprite.getWidth()) <= BACKGROUND_WIDTH)
               coordinate.moveX(x_speed);
            break;
         case WEST:
            if((coordinate.getX() - x_speed) >= 0)
               coordinate.moveX(-x_speed);
            break;
      }
   }


Sure, it might be a bad way to do something like this, and I'm quickly coming to this realization (I knew sooner or later I'd need something more versatile).  <tt>coordinate</tt> is just a Point(x, y).

My problem is that I'm having trouble using this method of movement to allow the AI to move the ship.  I've thought of dealing with vertical and horizontal motion separately using simple methods like this one, but I'd rather take the time to implement a whole new movement system that I know will allow for versatility down the road.

I'm aware of basic kinematics, and I'm currently browsing through an AI book that uses "correct" physics to simulate movement.  By this I mean using variables such as mass, acceleration, velocity, force applied, etc.  I'm also interested in implementing in 2D Vectors to handle magnitude and direction.  I imagine this wouldn't be too difficult since I'm already using Coordinates (Points).

Currently, my Ships only have an x_speed and a y_speed which is added (either as a positive or negative value) to their position to control their movement.

So my questions are:
 - If I were to use physics (F=ma, v, t, etc.), what variables would I need to store in my Ships?  How would the movements methods use these variables?
 - Would this allow for easier control by the AI?
 - If I didn't care about applying different forces, or about acceleration (if I just wanted the Ships to move at a constant velocity), would it be possible to just declare these variables constant somewhere and not worry about them?

To clarify my last question: currently I just move the Ships by a constant value , which for my purposes is fine.  But, if add in natural kinematics, would I still be able to easily move the Ships without caring about all the details, or am I going to have a little messier time since there will be several new variables added into the equation?

As of right now, I don't need to use the detailed movement that physics would allow.  But, I could very well imagine in the future that I would want to add Ship upgrades or power-ups that do utilize the details of kinematics to vary the movement of Ships.

Hm...hope things are clear enough.  Also, keep in mind that I've ran into this problem while creating AI, so anything that AI might want to use when dealing with movement is worth mentioning.  Thanks for any help!
3  Game Development / Game Play & Game Design / Re: mvc view on: 2008-02-17 22:43:04
Oh my god, I quit.  Here's the URL:
http://www.gamasutra.com/features/20050414/rouwe_01.shtml
4  Game Development / Game Play & Game Design / Re: mvc view on: 2008-02-17 22:41:32
You guys might find this article interesting.

<a href="http://www.gamasutra.com/features/20050414/rouwe_pfv.htm" target="_blank">The Guerilla Guide to Game Code</a>

Bad link.  Here's a better one <a href="http://www.gamasutra.com/features/20050414/rouwe_01.shtml" target="_blank">here</a>.  Sorry, couldn't figure out how to edit my post.
5  Game Development / Game Play & Game Design / Re: mvc view on: 2008-02-17 22:37:05
You guys might find this article interesting.

<a href="http://www.gamasutra.com/features/20050414/rouwe_pfv.htm" target="_blank">The Guerilla Guide to Game Code</a>
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

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

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

toopeicgaming1999 (12 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (29 views)
2014-11-25 11:26:43

Gibbo3771 (24 views)
2014-11-24 19:59:16

trollwarrior1 (37 views)
2014-11-22 12:13:56

xFryIx (76 views)
2014-11-13 12:34:49

digdugdiggy (53 views)
2014-11-12 21:11:50
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!