Jump to content

  • Log In with Google      Sign In   
  • Create Account


0Circle0

Member Since 31 Jul 2011
Offline Last Active Mar 13 2014 11:47 PM
*****

#4850282 What is a good algorithm to test whether a triangle intersects cube

Posted by 0Circle0 on 17 August 2011 - 06:37 AM

I posted in your other post. that shows an example both in 2d and 3d where no points from either object are inside the other object but are still intersecting. You will have to implement and edge collision detection rather than the more common point collision.

You could do something like the second image which makes the box a set of triangles and splits the triangle into more triangles. Now you can see there is a point intersection, and the more triangles you split it into the more accurate it is. In the second image you can clearly see compared to the first which had no point intersections that now there are 2 points intersecting. Image 2 has a higher polygon count.

Attached Thumbnails

  • example1.jpg
  • example2.jpg



#4850263 Starting C++ game. Need some help.

Posted by 0Circle0 on 17 August 2011 - 05:50 AM

You'll find that creating a character(sprite) sheet with each stage of the animation will be easier than calculating the movements and where to draw each line on the fly. Not to mention a lot less lines of code.


#4850249 Map editor

Posted by 0Circle0 on 17 August 2011 - 05:28 AM

Where do you specify the number of each tile?


That is done automatically with mappy. First tile on the tile sheet at (0, 0) = Tile 1. (0, 1) = Tile 2. And so on down the sheet. With mappy you can even remove unused tiles to make the tile sheet smaller in size, or join more than one tile sheet(assuming they are the same size tiles) together and export as a single big image. Mappy also has collision code that you can export, trigger code as well. Lots of stuff. I think mappy has header files for SDL. I know it does for allegro cause I use mappy all the time with allegro. I have to do some minor editing for it to work with java and there isn't a native library like for C/C++ but even then it works well.


#4850018 CLOSED:Sprite Generator I made

Posted by 0Circle0 on 16 August 2011 - 02:12 PM

Minor bug fix.

1. Grabbing an image now works as intended.
2. Animation preview no longer plays slowly on initial start up.
3. Animation preview will display correctly.


Updated first post.


#4849984 Map editor

Posted by 0Circle0 on 16 August 2011 - 12:54 PM

I use mappy all the time, makes making maps really easy. Once you export as text if you want that format where it is just the numbers just open with notepad remove the initial
const short tt_map0[100][100] =
then find/replace all "{" with "" and "}" with "" and "," with "" and ";" with ""
that will give you this look
 73 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 
74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 
74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 
74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 
74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 
74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 74 
74 74 74 75 
 79 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 80 
 79 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 80 
spaces between each, though I would keep the "," so you can easily signify a new tile, you can also post it directly into your source when you first export as text with minimal changes, which is the preferred way.


#4849797 Starting C++ game. Need some help.

Posted by 0Circle0 on 16 August 2011 - 05:15 AM

C++ has some good libraries. SDL, Allegro and SMFL are ones that come to mind. All easy to learn and use.


#4849741 Collision Detection

Posted by 0Circle0 on 16 August 2011 - 01:36 AM

Depending on the speed of each object. We will assume 1-5 pixels at a time. Using the following code, assuming 2d:
Where F = First, S = Second, M = Max, and X and Y are obvious.
private boolean CCD(int FX, int FY, int FMX, int FMY, int SX, int SY, int SMX, int SMY)
	{
    	if (FMX >= SX && FMX <= SMX && FMY >= SY && FMY <= SMY ||
            	FX >= SX && FX <= SMX && FMY >= SY && FMY <= SMY ||
            	FX >= SX && FX <= SMX && FY >= SY && FY <= SMY ||
            	FMX >= SX && FMX <= SMX && FY >= SY && FY <= SMY ||
            	FX <= SX && FMX >= SMX && FY >= SY && FY <= SMY ||
            	FX >= SX && FMX <= SMX && FY >= SY && FY <= SMY ||
            	FX >= SX && FMX <= SMX && FY <= SY && FMY <= SY ||
            	FX <= SX && FMX >= SMX && FY <= SY && FMY >= SY ||
            	FX <= SX && FMX >= SMX && FY >= SY && FY <= SMY ||
            	FMX >= SX && FMX <= SMX && FY <= SY && FMY <= SMY ||
            	FMX >= SX && FMX <= SMX && FY >= SY && FMY <= SMY ||
            	FX >= SX && FX <= SMX && FY >= SY && FMY <= SMY ||
            	FX == SX && FMX == SMX && FY == SY && FMY == SMY)
        	return true;
    	else
        	return false;
	}

If the object is moving at 1 pixel at a time, you don't need any loops, just make a single check and change its position if no collision. If an object is moving faster than 1 pixel at a time you need to know how fast it is going and make a loop moving the object 1 pixel at a time until either ObjectSpeed == NumberOfPixelsMoved or there is a collision in which case you wouldn't move at all. Check for collision then move 1(this is key) unit at a time, this will keep the objects from massing together as they wont be able to. This works great for any box shaped objects of any size.


#4849616 MMORPG - What language, what engine, where to start?

Posted by 0Circle0 on 15 August 2011 - 05:08 PM



LOL, is that profile pic a joke or something?


Pic is not directly loaded from this site, but instead it came with the login from using facebook login(IE facebook profile pic). Try to stay on topic. It is not the pic that gives information, but instead the user. Don't care to change it.


#4849597 CLOSED:Sprite Generator I made

Posted by 0Circle0 on 15 August 2011 - 04:29 PM

BIG update.
Fixed all browser issues with saving. Every browser should work perfectly. (IE, Chrome, Firefox, Opera, Safari are the only ones I tested and they work great now.)

Updated First post.


#4849545 Match 3 engine

Posted by 0Circle0 on 15 August 2011 - 02:31 PM

PopCap Games Framework, is what I think you're looking for.
The engine can be downloaded here, hasn't been updated since 2009 though.
http://www.moddb.com/engines/popcap-games-framework/downloads/popcap-games-framework-v13


#4849226 [HELP] Side Scrolling 2D game in SFML

Posted by 0Circle0 on 14 August 2011 - 09:24 PM

Say map is 10000x10000 like previous person stated lets assume that you want to scroll left and right. The "MAP" will have a fixed position, we will say 1 to 10000, and the viewport(or section that is viewable to player) is 640x480. If you wanted to scroll right:

Record the locations, X and Y or Both (both for top/bottom left/right scrolling). Then you need an Offset variable, I usually use OffsetX and OffsetY. Every time the player pushed the arrow(or whatever) that would move the character you change the Offset variable.

When drawing the map you need to make the starting position(X or Y) of your map that you are drawing increased by the Offset variable and then the ending position increased by the Offset + Screen(Width or Height depending on which you want to scroll)

Here is a coding example. Written in Java, but gives you a basic example. Ripped right out of my Scrolling RPG example. Ignore the collision code. Will supply entire source that I ripped this out but the code examples below should have good readability as I use decent variable names.

private void DrawMap(Graphics g, int[][][] map)
	{
    	for (y = MapOffsetY / BlockHeight; y < MapOffsetY / BlockHeight + ScreenHeight / BlockHeight + 2; y++)
    	{
        	for (x = MapOffsetX / BlockWidth; x < MapOffsetX / BlockWidth + ScreenWidth / BlockWidth + 2; x++)
        	{
            	if (y < MapMaxY && y >= 0 && x < MapMaxX && x >= 0)
            	{
                	Block.setFrame(map[MAPNumber][y][x]);
                	draw_sprite(g, Block, x * BlockHeight - MapOffsetX, y * BlockWidth - MapOffsetY);
            	}
        	}
    	}
	}
...
private void MoveMap(int[][][] map, int[][]BlockStruct)
	{
    	int keystate = getKeyStates();
    	if (MoveMap)
    	{
        	if ((keystate & RIGHT_PRESSED) != 0 && ScrollRight
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX + (charBlob.getWidth() / 2) + STEP * 2, myBlob.y + MapOffsetY - (charBlob.getHeight() / 2) - STEP) == 0)
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX + (charBlob.getWidth() / 2) + STEP * 2, myBlob.y + MapOffsetY + (charBlob.getHeight() / 2) + STEP) == 0)
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX + (charBlob.getWidth() / 2) + STEP * 2, myBlob.y + MapOffsetY) == 0))
        	{
            	MapOffsetX += STEP;
            	if (MapOffsetX > (MapMaxX * BlockWidth) - ScreenWidth)
            	{
                	MapOffsetX = (MapMaxX * BlockWidth) - ScreenWidth;
                	ScrollRight = false;
                	MoveRight = true;
            	}
            	blobMove = true;
        	}
        	if ((keystate & LEFT_PRESSED) != 0 && ScrollLeft
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX - (charBlob.getWidth() / 2) - STEP * 2, myBlob.y + MapOffsetY - (charBlob.getHeight() / 2) - STEP) == 0)
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX - (charBlob.getWidth() / 2) - STEP * 2, myBlob.y + MapOffsetY + (charBlob.getHeight() / 2) + STEP) == 0)
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX - (charBlob.getWidth() / 2) - STEP * 2, myBlob.y + MapOffsetY) == 0))
        	{
            	MapOffsetX -= STEP;
            	if (MapOffsetX < 0)
            	{
                	MapOffsetX = 0;
                	ScrollLeft = false;
                	MoveLeft = true;
            	}
            	blobMove = true;
        	}
        	if ((keystate & UP_PRESSED) != 0 && ScrollUp
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX - (charBlob.getWidth() / 2) - STEP, myBlob.y + MapOffsetY - (charBlob.getHeight() / 2) - STEP * 2) == 0)
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX + (charBlob.getWidth() / 2) + STEP, myBlob.y + MapOffsetY - (charBlob.getHeight() / 2) - STEP * 2) == 0)
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX, myBlob.y + MapOffsetY - (charBlob.getHeight() / 2) - STEP * 2) == 0))
        	{
            	MapOffsetY -= STEP;
            	if (MapOffsetY < 0)
            	{
                	MapOffsetY = 0;
                	ScrollUp = false;
                	MoveUp = true;
            	}
            	blobMove = true;
        	}
        	if ((keystate & DOWN_PRESSED) != 0 && ScrollDown
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX - (charBlob.getWidth() / 2) - STEP, myBlob.y + MapOffsetY + (charBlob.getHeight() / 2) + STEP * 2) == 0)
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX + (charBlob.getWidth() / 2) + STEP, myBlob.y + MapOffsetY + (charBlob.getHeight() / 2) + STEP * 2) == 0)
                	&& (Collided(map, BlockStruct, myBlob.x + MapOffsetX, myBlob.y + MapOffsetY + (charBlob.getHeight() / 2) + STEP * 2) == 0))
        	{
            	MapOffsetY += STEP;
            	if (MapOffsetY > (MapMaxY * BlockHeight) - ScreenHeight)
            	{
                	MapOffsetY = (MapMaxY * BlockHeight) - ScreenHeight;
                	ScrollDown = false;
                	MoveDown = true;
            	}
            	blobMove = true;
        	}
    	}
	}


Pastebin of entire code: Canvas Java Sorry that you'll have to look through 655 lines of code, but this is a working example.

Hope that helps. This is Java for Mobile devices, should give example. There is A* implementation in code and a lot of collision code you can ignore, but no time to edit it all down to the basics.

If you need the basics I could write a simpler example tomorrow that does just the scrolling.


#4849206 CLOSED:Sprite Generator I made

Posted by 0Circle0 on 14 August 2011 - 08:34 PM

Very good ideas, which most of which are on the to do list. Will be releasing the final version without much additions here soon. Have a plan to add most if not all of what you said. I have noticed that people are finding Firefox to freeze the application on them. I am quite sure this is from not having the most current java installed as I can not duplicate the error within Firefox myself.

I can make female stuff available for males and the opposite but reorganizing the accessory lists would prove to be a problem. How things are laid out it would lower the possibilities you can make. Notice the crossover between male and female on first 2 images, they are the same graphic. Instead of actually making a new category or more, I was going to allow usage of multiple from the same sheet. So you would be able to use the hairpins and scarfs as you mentioned later. I just want to get the basic engine set up before I start doing hard edits. As of now the images are already drawn for me, I would have to draw my own from this point on.

Weapons and Shields:
This is a good idea; however not being a graphic artist they may not even look that good, that and having no attack animation might not be feasible, will have to see.

Eye category:
I planned on doing this in the beginning, though the faces are actually set up with the hair directly, meaning I have to split the hair away from the faces to do this, I had already planned on doing this but editing a few hundred images will take a bit.

Adding Hair styles:
Goes the same for the shields and weapons, not being able to draw is a real problem for me.

I really need to figure out why some people can save and others cannot; Opera is the only browser I know of that no one has had problems with. Firefox a few, but I am sure that is a java issue. No matter what I try I cannot get it to do the error. JRE and Java must be fully updated and the addon Java Console must be installed for Firefox, sure that is installed with Java on Firefox. My last update for Java was July 20 2011.

Updated first post with newest version.

EDIT: Please make sure you check the Error section on first post, if you have done everything in that post and still cannot save let me know. DO NOT skip anything. MAINLY the browser MUST be completely closed before running this application as Java itself will not work correctly with the Saving of the image.


#4848173 How to approach a retro "Tunnel scroller"

Posted by 0Circle0 on 12 August 2011 - 05:43 AM

To me it looks like one image that is being scaled from small to large and then flipped in one frame and inverted in another and flipped + inverted in the another, giving the illusion of 4 frames when there is really only 1. Those old school games had to be very small. Adding 1 or 2 more images where you do that same control randomly flipping and inverting or both for a given tile and scaling it will give the appearance of many more tiles to the untrained eye. You might need to keep track of a fake depth for objects as well.

Not sure of any functions on the android as I do not program for one, being that I do not own one :), concept sounds about right cept for maybe the maps which can bloat quite large unless you randomize it. Which will give each player a different experience every time.


#4847703 How to get people to play my free, finished game?

Posted by 0Circle0 on 11 August 2011 - 08:47 AM

When a person first plays a game, not all controls are going to be used, they may even just button mash. As the game gets played more though a person develops more of an understanding and begins to adapt. This can be said for near everything in life. I have implemented manual shield in my games, but from what I have seen in popular games, more often than not, the shield is an automatic response to getting injured, reducing the shield at the same rate as health but also taking a portion of the health that would be lost.

If an injury takes 10 life away, and shields are max, then shields are reduced by 10 instead and health reduced by 5, This gives the appearance of having more health as long as there are shields to expend, In this example where Shield strength and Health are at 100, the person can be thought of as having 125 life instead of 100, Not a big difference but keeping the manual shield and if it is pressed while keeping its current function might help the game. If you don't ever use the shield you still get some functionality out of it where as manually using the shield you get full functionality.

Just an idea.

If you did port for mobile devices though, removing the manual shield and making it automatic would most likely be a must, more so for the IPhone where there are no buttons, however the IPhone does have tilt sensors and can tell when it is being shaken, using that for bombs and using a box reticule then when clicking on the penguin could cause you to use the ladle would easily be implemented as well. Not sure how you could exploit the IPhone more as most games I have seen only have a few things you can do with them due to not having extra buttons.

Another EDIT: In the event of porting to a phone one must look at the memory imprint as phones are limited, highly doubt a 24mb unpacked program will fly on the IPhone, not with out storing all the files in a database or "If ported to Java" all that is compressed in the JAR anyways, So it will be smaller, but still around 16mb, now remove all the dll's that are used roughly 7mb and you get a 9mb game, as well removal of what looks to be sprite masks so half of 1.4mb making the game just above 8mb in total. Is still a decent size game but workable for phones. Then it is just hours of optimizing, where what is smooth and working on a PC might not be on a phone where the CPU is severely limited. And the dreaded Out Of Memory error (Which is thrown at compile time instead of run time) will end the project almost instantly.


#4847622 UI Design + Sprites for an online poker game

Posted by 0Circle0 on 11 August 2011 - 05:29 AM

Here are some cards you can mess around with, kind of the basic design used by nearly EVERY card company.

Cost depends on what programs you use and if you can draw, GIMP = free

Attached Thumbnails

  • cards.png





PARTNERS