Jump to content
SubSpace Forum Network

Recommended Posts

  • Replies 391
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted (edited)

Trying to code a camera... And work with temporarly generated map data...

 

 

 

Edit1: I have a working camera, but everything seems to fly in the opposite direction.. :-/

 

 

Edit2: Fixed. Works.

Edited by jabjabjab
Posted

Well i have somewhat of a collision system working... (rather extremely buggish and not done)

 

Im also getting a really weird jvm crash bug if i go in and not move for 2 seconds and do something (unless im in debug mode which makes no sense (probably memory));

 

Also did some work on background and speed capping.

Posted

http://i559.photobucket.com/albums/ss31/XDreamersMS/Continuum/ScreenShot7.jpg?t=1315795608

 

 

 

3'rd time's the charm. I managed to sufficiently rig the CLT Edior's source and make it send me back the map tile ID's ... Let's hope i can get the bitmap, and convert it to a png and then take this and make it display upon an tile entity accordingly.

Posted (edited)

I think I am giong to keep the tileset seperate from the map. (opens up to alpha possibilities which we should NOT LIMIT).

 

 

I mean sure the bitmap data would "lay waste" but would keep the lvl file structure same, just need to make a saved png of the tileset and get away with it.

 

 

http://i559.photobucket.com/albums/ss31/XDreamersMS/Screenshot-1315821362519.png?t=1315821467

Edited by jabjabjab
Posted (edited)

I would gladly love to get things set up for this.

 

 

I have to admit though I knew I would come across people saying this is obviously a waste of time, though granted everything we do can be considered this without a central focus, which this game lacks to the extremes xD

 

But more importantly Im learning how to do things i once never thought i could ever understand, and Im learning how to code, especially games. I think this is building critical logic for me to use in later projects that will help me build my success.

 

And to think of it, because continuum is so stable and reliable, it just gives me much more of a challenge, which to me I dont like easy things.

 

In the end, if many zones wish to not move, it is not my decision to let their projects do what they want to, but it is my decision to let my project do what I want it to, and also for people who are helping me out to achieve what they also want to do.

 

Kindof funny how such a radical community becomes stubburn enough to tell me they will 'never move' well i cant help em out now can I?

 

 

 

Anyways this client is java, so it should with no doubt be able to run on a webpage, so a forum and a website will be needed in the slight future when all of this comes to be stable enough to test out. So if this can be provided dav, i would gladly appreciate it.

 

 

Edit: Oh you said project forum.. Sorry i mis-interpreted. I will get this it's own website and seperate forum all together when i can, Though I still appreciate it.

Edited by jabjabjab
Posted

I think I am giong to keep the tileset seperate from the map. (opens up to alpha possibilities which we should NOT LIMIT).

 

 

I mean sure the bitmap data would "lay waste" but would keep the lvl file structure same, just need to make a saved png of the tileset and get away with it.

Once you are compatible with eLVL chunks, you could dump the alpha-channel, or additional custom tileset with alpha channel in a eLVL chunk.

To minimize filesize, you could have the RGB data in a standard bitmap, and only the alpha-channel as a 8bit bitmap in the eLVL data. This gives you full backward-compatibility for other clients to work with maps that support it, and full foward-compatibility for your client to open older maps.

The easy way would be to leave the bitmap tileset, and put a full PNG with alpha channel in a eLVL chunk. But you get a lot of duplicated data that way.

Posted (edited)

It's pretty obvious I don't know how to do this, so for this current time, i will stick with this.

 

Also almost done with collision data.. yay.

 

Edit: Go find me sounds to put for bong noises :p

Edited by jabjabjab
Posted

It's pretty obvious I don't know how to do this, so for this current time, i will stick with this.

 

Also almost done with collision data.. yay.

 

Edit: Go find me sounds to put for bong noises :p

 

You can find alot of free sounds here

Posted

It's pretty obvious I don't know how to do this, so for this current time, i will stick with this.

I'm not suggesting you do this right now, but maybe in the future...

 

Anyway, I don't think transparency on the tileset would be worth the effort... having transparency on LVZ images, however, would be awesome.

Posted

Im so confused as to how to take care of tile collisions (being that i want to only flip x and y on certain places on the collision. The collision detection for the tile to the ship is just fine.. but trying to tell it which side it came from and react based on that is just too freaking complicated.

 

Thinking about putting rectangle objects inside tile rectangle objects to fix this.

Posted (edited)

Collision in subspace is not that hard, everything is a rectangle.

This is a basic way you can do bouncing bullets.

Java syntax with imaginary classes and instances

It uses centisecond precision, just like subspace (100x per second)

 

// Part of some kind of update loop

import javax.vecmath.Tuple2d;

public class Weapon
{
   public static final long TILE_SIZE = 16;
   
   public int type; // enum
   public Map map;
   public Tuple2d position;
   public Tuple2d velocity;
   public Centiseconds lastUpdate;
   
   public Weapon(Map map)
   {
  	 this.map = map;
  	 position = new Tuple2d(0,0);
  	 velocity = new Tuple2d(0,0);
   }
   
   public void update(Centisecond now)
   {
  	 Centiseconds deltaTime;
  	 int a;
  	 
  	 if (!lastUpdate)
  	 {
  		 lastUpdate = now;
  		 return;
  	 }
  	 
  	 deltaTime = now - lastUpdate;
  	 if (type == Weapon.BULLET)
  	 {
  		 for (a = deltaTime.intValue(); a > 0; --a)
  		 {
  			 moveVertical();
  			 moveHorizontal();
  		 }
  	 
  		 lastUpdate = now;
  	 }
   }
   
   // returns true if it hit a tile
   private boolean moveVertical()
   {
  	 Tile tile;
  	 double newY;
  	 Tuple2d newPosition;
  	 long tileX, tileY;
  	 
  	 position.y += velocity.y;
  	 
  	 tileX = (long) position.x / TILE_SIZE; // get rid of the point number (not the same as floor() )
  	 tileY = (long) position.y / TILE_SIZE;
  	 
  	 tile = map.getTile(tileX, tileY);
  	 if (tile && tile.isSolid()) // hit a wall
  	 {
  		 // move the bullet so that it is right in front of the tile, but not ON the tile
  		 if (velocity.y > 0)
  		 {
  			 // moving towards the east
  			 position.y = tileY * TILE_SIZE - 1; // position is now at the end of the previous tile
  		 }
  		 else
  		 {
  			 // moving towards the west
  			 position.y = (tileY + 1) * TILE_SIZE; // position is now at the start of the next tile
  		 }
  		 
  		 // bounce
  		 velocity.y = -velocity.y;
  		 return true;
  	 }
  	 
  	 return false;
   }
   
   // returns true if it hit a tile
   private boolean moveHorizontal()
   {
  	 Tile tile;
  	 double newX;
  	 Tuple2d newPosition;
  	 long tileX, tileY;
  	 
  	 position.x += velocity.x;
  	 
  	 tileX = (long) position.x / TILE_SIZE;
  	 tileY = (long) position.y / TILE_SIZE;
  	 
  	 tile = map.getTile(tileX, tileY);
  	 if (tile && tile.isSolid())
  	 {
  		 if (velocity.x > 0)
  		 {
  			 position.x = tileX * TILE_SIZE - 1;
  		 }
  		 else
  		 {
  			 position.x = (tileX + 1) * TILE_SIZE;
  		 }
  		 
  		 velocity.x = -velocity.x;
  		 return true;
  	 }
  	 
  	 return false;
   }
}

Edited by JoWie
Posted

Might as well leave some room to define a region path (array of points) for each tile that defines the outer outline of the tile and to do a Path-Rectangle collision afterwards.

 

Or a spatial subdivision algorithm like an octree to define finer blocking regions, depending how heavy the intersection calculation is (a few rect-rect in a tree is probably faster)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...