JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by SlevinKelevra » September 10th, 2017, 4:06 pm

Hey guys,

I grew up with RTS games like Dune2 or C&C and I loved to play them. It has been a dream for over 20 years to code something like this myself. It is completely clear to me that this is a huge thing, especially when doing it alone and as a hobby (I dont have that much time for coding). That is also the reason why I postponed this idea all the time...

Long story short. I will give it a shot and want to share the progress with you guys. The starting point is the current Sprite repo from Chili. I have already added simple level and entity classes. The levels will consist of tiles (which at the moment can be empty or occupied). Entities can be placed into this map and get selected with left mouse click. Multiple selection possible with pressed SHIFT.

You can find the code here: https://github.com/Erazor1980/JARTS

I will try to work on small work packages in extra branches (like I did for the level/entity classes) and merge then into master.

Next step is path finding, I guess I will use the A* algorithm. Goal is that you can select an entity and right-click somewhere in the map, and it will move in this direction on the shortest possible path.

I will report here, when something showable is developed. Looking forward to your comments, suggestions, etc.

BR
Slevin
Carpe noctem

Byteraver
Posts: 60
Joined: May 19th, 2016, 6:48 am
Location: Belgium, Europe

Re: JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by Byteraver » September 10th, 2017, 9:26 pm

Cool! Your quest is similar to mine, ever since I got addicted to Dune II as a teen I thought about the mechanics of such a game and wondered about whether it 'd be possible to make it myself. I started with the terrain editor and made decent progress so far. Follow up in http://www.planetchili.net/forum/viewto ... f=3&t=4143.
I've seen some Youtube video's on the A* algorithm, it seems the best one out there for this purpose. I'm looking forward to implement it, it's a cool challenge.

We will be keeping an eye on your progress, good luck! ;)

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by chili » September 12th, 2017, 2:02 am

Code looks pretty good so far. I'll be keeping an eye on this one :)
Chili

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by SlevinKelevra » September 12th, 2017, 8:50 pm

After some fails it looks like I have managed to implement the A* path finding algorithm. If someone is interested in a good and short tutorial, check out this video:
https://www.youtube.com/watch?v=KNXfSOx4eEE
(Patrons should take a look into SF3000, ep 4)

I think I found a more or less convenient way to code this shit up. I am using the std::vector container for the open and closed lists to handle the nodes. To solve the "parent-pointer"-problem, when erasing Nodes from the lists I am using the parent index instead.

If you want to have a look into the code or do some A* tests, check out the "path-finding" branch from https://github.com/Erazor1980/JARTS. I did not merge into master yet.

Left mouse click: target tile selection (end of the path)
Right mouse click: source tile selection (start of the path)

The calculated path (if there is one) will be displayed.

Next step:
using pathfinding to actually move the entities through the level
Carpe noctem

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by SlevinKelevra » September 14th, 2017, 9:11 pm

- added unity movement, using Vec2 for direction and velocity, Frametimer for delta t
- there is no collision implemented yet, so more than one unit can stand on the same tile
- you can change the target of each unit during its movement (right click on another location while selected)
- you can select more than one unit when holding SHIFT and give all a target to move

Next steps:
- multiple selection rectangle (when holding left mouse button)
- (maybe) collision detection
- adding sprites
- more attributes
- attacks
Last edited by SlevinKelevra on September 15th, 2017, 6:50 am, edited 1 time in total.
Carpe noctem

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by chili » September 15th, 2017, 1:42 am

I think instead of allowing units to have free (float) positions, locking them to the tile grid would be a lot easier to work with (this is how starcraft/warcraft/c&c did it back in the day). You can make your tiles finer grained (smaller) to get a better feel of free movement.
Chili

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by SlevinKelevra » September 15th, 2017, 6:55 am

Yea, it was in mind at the beginning... and I rejected it because I thought that the complexity of the A* algo could be too high. Will definitely try it out next! It indeed sucks to deal with pos and tile_pos for each unit.
Carpe noctem

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by SlevinKelevra » September 18th, 2017, 9:25 pm

- added first sprites (tanks)
- added level sprite
- added multiple selection rectangle (holing left mouse button)
- drawing debug stuff (like current paths of selected units, tile grid), press "space" to enable/disable

At the moment the obstacle tile allocation is pretty inconvenient because I am not using a tileset for the map yet. It is just an image and I have to assign all obstacle tiles by hand.

If you want to play around with the current version checkout the master branch und run it in release (debug is too slow respectively not working properly!).

Next goals:
- I would really like to improve/add something like obstacle detection (for moving units). At the moment if you select all units and give them a target, they all end up in the same tile.
- New unit types
- Maybe enemies (and then of course shooting, life, etc.)
- Sounds
Carpe noctem

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by chili » September 20th, 2017, 9:35 am

Dogpile! :D

The hand-drawn terrain looks pretty sweet. Gotta get rid of those outlines on the thanks though :lol:

All-in-all, looking good bro ;)
Chili

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: JARTS - (j)ust (a)nother (r)eal (t)ime (s)trategy game

Post by SlevinKelevra » September 20th, 2017, 9:09 pm

chili wrote:Dogpile! :D

The hand-drawn terrain looks pretty sweet. Gotta get rid of those outlines on the thanks though :lol:

All-in-all, looking good bro ;)
Thx bro!

The "dogpile" thing is really a big issue. Dont know how to tackle it yet. The simple A* path finding is more a single agent thing. Will need something else for multiple units. Maybe this one: http://alborz-geramifard.com/Files/06AIIDE-bcp.pdf (dont know how difficult it is yet).

Any suggestions from you guys?

Tanks look indeed ugly, I know. Wanted to test the sprite tile set thing first. Will add better tileset soon. The hand-drawn terrain is not the work of my hand though :)

Currently I am working on unit improvements (extra branch). Already included:
- Unit types
- Jet as new unit (can reach every location on the map)
- First sound effects
- Improved sprite direction calculation
Carpe noctem

Post Reply