Public Group

Help me begin making a game based on straight lines

This topic is 966 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello guys, I've lately been thinking of making a "Math game", based on straight lines and angles between them, so, the idea is as follows:-
-I want to make a grid where each intersection of two x and y lines creates a point, and I want each point to have a certain coordinate.
-Player 1 starts by selecting a point, the point's coordinates are saved in a text file, and then the player 1 selects another point, the coordinates are saved as well.
-The length of the straight line by units is calculated.
-Player 2 selects a point on the straight line.
-Player 1 is moved to that point.
-The slope of the straight line is calculated
-The equation of the straight line is calculated
-From the equation and the point selected by player 2, the length of the perpendicular to the straight line is calculated, the perpendicular is drawn, and the player is moved till the end of that perpendicular.
-Player 2 forms a new straight line.
-Player 1 is projected in the angle between the 2 straight lines, if the angle is 45 or 135 degrees, the player is moved 5 steps.
-And so on, until player one reaches a trap X (loses) or O (wins)

So, the question is, how can I get started making that game? I know all the formulas I will need, but I don't know how to make the grid or make each point have a coordinate on it, I know how to save in a text file, but I don't know how I can perform the operations on them without interference from the players and function calls, I don't how how I can start making it, so if someone could guide me in the right direction, I'd greatly appreciate it.

Also, I only want to make this project to get used to the Maths and the Physics I will need for making games and stuff, and maybe I can have fun playing it sometimes too, lol. If it's not worth it, please let me know, if it's too complex for me, also let me know, if I have logical errors, I'd greatly appreciate it if you tell me.Thanks guys! :)

EDIT: I'm sorry for being vague, to answer your questions: I am a beginner and I made a few simple games in C++ and Allegro5, like pong, arkanoid,a game where a car tries to get away from falling objects which speed up over time, a game with two balls representing players trying to get each others in a black circle. I still haven't started working on the project yet. I have no experience using OpenGL or D3D, I don't know if this is a suitable project to start using them.

Edited by Luna Wu

Share on other sites
Sounds pretty straightforward. I guess most of it depends on how fancy you want the UI to be.

If it were me, I would make a simple C# Windows Forms program to draw lines and handle mouse input (both are extremely easy to do in Windows Forms). Basically just wait for the current player to pick point(s), and then update your UI after each click: update the lines, show indicator saying which player's turn it is, etc.

If you're familiar with a different language and API, you could use that instead. You didn't mention any programming languages in your post, so I don't know what you're experienced with.

Share on other sites

Also, I only want to make this project to get used to the Maths and the Physics I will need for making games and stuff, and maybe I can have fun playing it sometimes too, lol. If it's not worth it, please let me know, if it's too complex for me, also let me know, if I have logical errors, I'd greatly appreciate it if you tell me, as I'm not very good at logical stuff lol (trying to improve that though).Thanks guys!

There are lots of unknowns that make it difficult to answer your questions

It is difficult for us to know if this is too complex for you because you haven't stated what level of programmer you are (the fact that this in beginners forum doesn't  mean you are not capable of doing this, You have to state in details what experience and  knowledge you have and what you have learnt in the past, because without this, no one on this forum can say whether you are capable of completing the project successfully or not)

Nypyren has suggested its straight forward. It is for anyone beyond complete beginner status in this field.

The 2 quotes below contradict each other

but I don't know how I can perform the operations on them without interference from the players and function calls,

This quote suggests you have started the game but are stuck on this issue. If so be more explicit by showing us the code you have so far so we can help

I don't how how I can start making it

On the other hand this suggests you haven't started at all

Also I'm assuming you are coding the game from scratch and that it's purely 2D (if otherwise please reply so)

What programming language are you using?

You say you know the maths you need... does this include vector maths? Your equations on paper seem to indicate you do

Are you going to be using OpenGL (ES), D3D or other?

Its best if you attempt what you can and show us where you are stuck or have errors.

Answer these questions first then people on this forum would be able to help you better

If you are a complete beginner and haven't decided on what language yet, then i would suggest you code this project in Java or C#

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• Forum Statistics

• Total Topics
633744
• Total Posts
3013653
×