Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 02 Sep 2011
Offline Last Active Oct 16 2013 04:15 PM

#5022912 Moving a game object up and down in Java

Posted by on 18 January 2013 - 09:24 AM

Ok, I going to help you a bit more:


Lets say what do you want your object to do?

Your behaviour is something like this


Are we moving down?


Move down
If we are above 200, you want to make it move up. (Hint: State Change)



Move Up

If we are below 0, you want to make it move Down. (Hint: State Change)



#5022726 Moving a game object up and down in Java

Posted by on 17 January 2013 - 07:25 PM

I will give you another hint, you need a state for your object, that defines what it is doing ( moving Up or Down)

#5019351 Hey i'd like some knowledge

Posted by on 08 January 2013 - 09:56 PM

To tell the truth I would refrain from using a complex game engine to grasp concepts, Game Maker is fine for that, visual scripting and all.

After that, go with language smile.png

For starts pick a language and read about it, syntax and do general purposes exercices to learn how to do some basic stuff, after that pick a simple project and try to create your own little text game, and evolve from there. Thats what I did, kinda.


Well, not as advertising or anything but I am writting a small series in Game Programming Basics and Concepts, right now I only explained a Game Loop, I am not actually teaching how to code, but the concepts behind it. I may not be a professional, and some of my ideas might not be very correct, but that's the way I understood and the way I am trying to make people understand  this stuff. So you might enjoy reading those light posts on my blog and might learn a few things. Currently there is not much info, but I usually write a article each two to three days. Anyway....

#5019069 Teaching Very Basic Game Dev. - Best Program to Use?

Posted by on 08 January 2013 - 10:21 AM

Hum, the best thing that comes to my mind is actually game maker , you can create pretty complex things with the event system, and it could be use to teach a few programming techniques and concepts, loops and other stuff like that.


I think pretty much every single program that has a event system would probably do the trick, you just have to prepare yourself well to be able to teach it correctly and in a fun way :).


Also, GM has one plus of being able to code in  Cish like syntax, so you might be able to jump from events to the Game Maker Language if things go amazingly well :)



Best of luck 

#5018415 RTS, How to slow the combat and increase the tactics?

Posted by on 06 January 2013 - 09:04 PM

Well one thing is for sure all the combat is just a mathematical formula in one way or the other, so you will use equations. The variables on those equation are what you need to define.



So here are some ideas, Attack direction, Flanking  and ambushing.


Flanking is obvious, give advantage to the troops that flanks the others.

Ambush is  great way to use terrain and other features, if the enemie ambushs you, you could make the defender troop panick spread and lose morale.


Terrain height is great to give advantage to ranged attackers, the higher the terrain the better to certain limit or something.

Traps though the terrain is great, making you able to create murdor holes, landslides and other dynamic features are also good points.


Squad positioning also could take relevant input, if you go straight on with your melee warriors vs a group of ranged, while on range the melee would have advantage, maybe breaking the ranged units formation, no one would stand there to die In a field where you have a bow and knight is right next to you. So you could make units behave more human like, fleeing and etc.


This gives chance to another aspect, make the player be able to set up unit tactics. Like attak while the melee are not on range, once they get near, fallback and move the infantary forward. 

Simple commands like that could create a great combat experience. You could have each squad be lead by a General, an depending on the experience of the general be able to setup a larger queue of tactics. 


This way, all battles would be defined by tactics, and the sheer number of units won't be enought to take a good player that knows how to use the terrain and their generals.


Another idea that could be implemented is in the range wepon department, make the units go out of ammo, and need to reload (a few time without attacking, or going to get ammo), this would make players that know how to play to make the enemy use their ammo first, and attack while a opening is done. Or maybe the attacker could wait till the right time to call their ranged reinforcements and caught a player out of position.

#5016381 A Rubic's Cube Type Problem !

Posted by on 01 January 2013 - 09:36 AM

Why not render 3 * 3 * 3 Cubes with solid colors? and rotating them ? Wouldnt it be easier?

Also there are a hell of algoritms to sucessfully solve the rubik cube, searching google throws a hell of results.

#5016131 2D Camera Transformation

Posted by on 31 December 2012 - 12:42 PM

if (Position != position || Scale != scale || Origin != origin || Rotation != rotation)
scale = Scale;
origin = Origin;
rotation = Rotation;
position = Position;
transform = Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0)) *
Matrix.CreateRotationZ(Rotation) *
Matrix.CreateScale(new Vector3(Scale, 1)) *
Matrix.CreateTranslation(new Vector3(-Origin, 0));



This is exactly what I use, it works fine. Rotates around the center, zooms, translates, everything you wish for smile.png

EDIT: Origin is just your screen center. so in a 800 * 600 window, it is 400,300 vector.

#5016130 Programming a Game...

Posted by on 31 December 2012 - 12:41 PM

I have a few code that can be used, I will write a article on it once I get it on a more decent state.

right now I am going to write a Indepth  article on SAT 2D discrete and swept methods, you might see it popping around sometime soon :D

#5015774 How come many of you prefer to make games from scratch rather than use an eng...

Posted by on 30 December 2012 - 10:32 AM

Here :P

SFML is a free multimedia C++ API that provides you low and high level access to graphics, input, audio, etc.


SFML is quite nice I must say, and very easy to deveop with.

#5015566 How many levels is enough?

Posted by on 29 December 2012 - 05:09 PM

 Well, the number of levels is equal to the amount of content you have for you game :).


There is no magic number on how many levels you should have, instead you have to find the balance between your content and the number of times you can reuse it, for example in the game I am making, I don't have much content, so I am rotating scaling tinting pieces, and with this I can create about 5 levels that feel unique.


But you really should know, if the game doesnt feel repetitive to you, you can bet that it wont feel for the player, since you are the one who created it =) and are sick of testing it aswell.

#5014424 Game Multi-Threading

Posted by on 26 December 2012 - 10:15 AM

You can get along with only one thread, why do you want more?


You could have threads for networking,Audio,Rendering,Physics, ETC. Each subsystem of the engine could be a thread to improve performance. But only when needed, starting to write a multithreaded application is no trivial task. IMO you should create a engine and then update it to multithreaded enviroment.

#5013699 Programming a Game...

Posted by on 23 December 2012 - 10:29 AM

For small project I usually don't use Version control. But I think that might be something considering. Create a main repository for my "engine code" and branchs for games, thats something that just came to my mind, maybe worth to try.

#5013291 New to programming

Posted by on 21 December 2012 - 05:58 PM

If you are using Visual Studio it is already compiling your code to exe.

Check your project folders for a bin folder, it should be there.


Other than that, arrays:

Array are just a "bag" of something. for example lets say this, I want to store the name of 100 students.


How would you do it?Create 100 variables?

Ok it works. but what If I want to create 1000 students?


As you can see it becomes really troublesome to manage, so you create a array of strings in this case.


string array[1000]. 

It basically creates space in memory for 1000 strings.


To access a value you use array[index] and it returns the value that is stored there.To Save a value you do the same thing, but instead o array[index] = something.


Arrays are one of the most useful features in any program language.


In your case, this int array[8][8] creates a double indexed array, that means you have 8 positions and each of those positions has 8 more.

So in total you have 64 positions.


One example I can give you is, think of it has you have 8 students and each of those students have 8 grades that you need to store.

So each of those students could be simple array that holds grades right?

You could have 8 arrays, but the same as before what if I want 100 students?

You would create a 100 arrays? Why not use a array?


That is pretty much what it means.

A double index array is just a array of arrays. You can have in theory any number of arrays like int test[8][8][8][8] depending on your needs ofcourse.



As your second question, I learned to code by making programs for things that I needed. I needed to calculate vectors for maths class, so I made simple console program to calculate the vectors for me, and so on. Create Programs that are fun to you and at the same time useful, you will be motivated and ideas are everywhere. That is my major advice for you.

#5013222 Object Management Question

Posted by on 21 December 2012 - 01:00 PM

Well, my best bet is a simple one, and it has no performance hit whatsoever. Also everything would work as you have it right now.Well almost everything.

Create a base component class, that only has a method called Destroy/Dispose whatever you wish.

Then on your sprite class have a list of these components, when you add one it goes into this list, once you destroy the sprite, just call the Dispose/Destroy method from the interface, and each component would clean up after itself.
You get all of the good qualities from your original method, without any performance hit (well minus the inheritance, but you would just call it when you destroy the sprite)

If you need a more detailed explanation I can throw some pseudo code to you. =)

#5013188 Move look vector along terrain up and downs

Posted by on 21 December 2012 - 11:45 AM

Well, if you have the terrain normal its trivial isnt it? Since you can just Dot Product it to get the inclination of the slope. After than just calculate the Look Vector.