Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post Posted: September 10th, 2017, 4:06 pm 
User avatar

Joined: September 9th, 2013, 12:58 am
Posts: 75
Location: Germany
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


Top 
 Profile  
Reply with quote  
 Post Posted: September 10th, 2017, 9:26 pm 
 

Joined: May 19th, 2016, 6:48 am
Posts: 34
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 viewtopic.php?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! ;)


Top 
 Profile  
Reply with quote  
 Post Posted: September 12th, 2017, 2:02 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3448
Location: Japan
Code looks pretty good so far. I'll be keeping an eye on this one :)

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post Posted: September 12th, 2017, 8:50 pm 
User avatar

Joined: September 9th, 2013, 12:58 am
Posts: 75
Location: Germany
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


Top 
 Profile  
Reply with quote  
 Post Posted: September 14th, 2017, 9:11 pm 
User avatar

Joined: September 9th, 2013, 12:58 am
Posts: 75
Location: Germany
- 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

_________________
Carpe noctem


Last edited by SlevinKelevra on September 15th, 2017, 6:50 am, edited 1 time in total.

Top 
 Profile  
Reply with quote  
 Post Posted: September 15th, 2017, 1:42 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3448
Location: Japan
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


Top 
 Profile  
Reply with quote  
 Post Posted: September 15th, 2017, 6:55 am 
User avatar

Joined: September 9th, 2013, 12:58 am
Posts: 75
Location: Germany
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


Top 
 Profile  
Reply with quote  
 Post Posted: September 18th, 2017, 9:25 pm 
User avatar

Joined: September 9th, 2013, 12:58 am
Posts: 75
Location: Germany
- 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


Top 
 Profile  
Reply with quote  
 Post Posted: September 20th, 2017, 9:35 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3448
Location: Japan
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


Top 
 Profile  
Reply with quote  
 Post Posted: September 20th, 2017, 9:09 pm 
User avatar

Joined: September 9th, 2013, 12:58 am
Posts: 75
Location: Germany
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


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2, 3  Next

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron