Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Sep 2012
Offline Last Active Jul 22 2016 12:37 PM

#4989508 [JAVA] My program just freezes like 2 seconds in. No warnings, no errors, no...

Posted by on 12 October 2012 - 10:32 AM

Your problem lies in the moveTowardsCenter() function. In there you have this code:
[source lang="java"] while(realYValue == desiredPos){ enemyY = HEIGHT / 2 - 80; }[/source]
This creates an infinite loop. I would expect you wanted this:
[source lang="java"] if(realYValue == desiredPos){ enemyY = HEIGHT / 2 - 80; }[/source]

#4987844 "Getters" and "Setters" - do you write them if you don't...

Posted by on 07 October 2012 - 08:50 PM

"Getters" and "Setters" are an interface to the data contained in your class. It is typically good practice to do this when you allow data in the class to be accessed externally.
For instance if you had a variable in your Ball class named "speed", you may want to increase this as the game goes on longer. This would require a setter because the game needs to externally increase it. Then lets say you would like to check to see if the ball is off screen. This would require a getter for the position to figure out where the ball is.
Of course you could make the data public in the class but this is considered bad style and should be avoided except when absolutley necessary.

If it is only used in the class and never changed outside the class it should not have a getter or setter.

Hope this helps.

#4986194 AABB Collision Detection

Posted by on 02 October 2012 - 02:54 PM

What I am unsure of, is how this could be best made to working with moving solid objects (other than the player.)

This is a big issue in games and there are many ways to solve this based on how accurate you want it to be. I would suggest checking out this article first.

#4986162 Handling a 2D procedural world

Posted by on 02 October 2012 - 01:28 PM

I highly doubt that it fails due to the size of the file because it is only 305MB. How much memory does it peak at before it throws the out of memory error?

Chunks are always a good way to go.
You say your world size is 10240 * 512 which is about 5 million tiles. This does not need to be loaded or saved all at once and should be streamed.
All of these chunks can be in the same file(file seeking) or different files, whichever is better for your needs but does not seem to be the bottleneck here.

The issue may be because the objects are not correctly serialized. Check here under 'Making an Object Serializable'.

I am still trying to determine what data you are serializing because 305MB seems rather high for tile based, even for 5 million tiles. So, what exactly are you serializing?

#4986087 AABB Collision Detection

Posted by on 02 October 2012 - 10:16 AM

Managers in my opinion are fine but if you have a manager for everything then it is really easy to get in trouble. For example if you have a manager for enemies, tiles, players, platforms, items, etc. then your code would get very complicated very quickly (i.e. game object that belong in two managers, how to iterate through all collisions efficiently,etc.). I would suggest having only a couple of managers such as sprites and maybe tiles. It is important to group as many objects as possible into as few managers as possible.

I feel that the code is a little heavy handed in places - e.g. passing the tile manager as an argument.

The code that you presented is not that heavy handed except that you need to be careful passing by value rather than passing by reference. For instance, passing the tile manager here:

void cPlayer::moveObject(cTileManager* TM)

is ok because it is a pass by reference, but here:

float cPlayer::collisionCheckX(cGraphicalObject A, cGraphicalObject B)

it may hurt you because you are passing by value.
Another option is to let the manager deal with the collision code and report it to the object through a callback or message and the object can choose to act or not. This makes it so that the objects do not have to know about any managers and only have to implement a couple of callback functions like TileCollision or SpriteCollision.

Also, checking for just a set number of tiles, 2 in your case, can cause problems with objects moving through tiles. For instance if the speed of your object causes it to move more than 2 tiles, the object would pass right through the tile. The solution to this is to get all tiles that the object moves through and checking from closest to farthest if there are any collisions.

Hope this helps

#4984005 Hi, I'm new and need some advices

Posted by on 26 September 2012 - 09:55 AM

Let me be the first to say, Welcome to fun and exiting world of game programming!!!

There are a lot of resources available for software and tutorials...but the right software and tutorials for you will be based on your programming experience and what you want to achieve.

If you are completely new to programming I would suggest learning a language like python first to get an understanding of programming.

Then you can move on to game development.

What type of experience do you have?

#4983811 evil and good choices in singleplayer rpg

Posted by on 25 September 2012 - 06:05 PM

I guess the big question is how you convey characters. If you have characters saying everything they are doing its bad and having a player choose between obvious good vs evil vs neutral choices is basically the same thing.
If you have the characters act out actions it would be much more interesting. That is based on the players actions and having just 3 choices rather than good, bad and evil.

#4983801 evil and good choices in singleplayer rpg

Posted by on 25 September 2012 - 05:27 PM

I do think you are right on the grey area of good and evil. I think that the play between the two can be explored more in video games but there is a conundrum that is associated with story and choice. If you give the player more choice you have less control over story. And if you want to tailor an experience it is hard to give the player meaningful choice.
What most video games lack in my opinion when it comes to good and evil is subtlety. There is always an obvious good and obvious bad.

Ok, that makes sense now. It is a very good idea to have multiple developers on story because each has a very different perspective. This is true in any game.

#4983784 evil and good choices in singleplayer rpg

Posted by on 25 September 2012 - 04:33 PM

Everything you are saying implies that you are or are planning on making a game. If you are just ranting/complaining about games in a genre, this is not the place.

#4983763 Tile based RPG with Pyglet

Posted by on 25 September 2012 - 04:00 PM

A good start for this would be to load all textures into a dictionary where the key is a symbol.
An example of this is:
"-": grassImage,

and then loop through your map and draw based on the tile location:
[source lang="python"]tileMapping = { "-": grassTexture, #preloaded ...}TILE_SIZE = 16 # for examplexCoord = 0yCoord = 0Map = ["-----"] # Preloaded mapfor row in Map: xCoord = 0 for tile in row: tileTexture = tileMapping[tile] x = xCoord * TILE_SIZE y = yCoord * TILE_SIZE # Draw Tile Texture Here at x,y xCoord += 1 yCoord += 1[/source]

Hope this helps