Page 1 of 2

RTS Game - new project

Posted: September 3rd, 2017, 2:22 pm
by Byteraver
Hi Guys

I've been gone for summer holidays and right now I'm a bit busy with moving towards my new place (we bought a house yay) but I keep programming when I can. I thought it would be fun to keep you guys informed with my progress all along, so I'll try to update this post every now and then.

The goal is to make an RTS game such as StarCraft I. Of course, without the fancy graphics, as I have no drawing skills whatsoever :mrgreen: . Also, I'm not a team of 50 people ;)

Just as with the arkanoid / breakout game (http://www.planetchili.net/forum/viewto ... =byteraver) I start with the tools that I need to design the game with. I want to make it as versatile an easy to use as possible, so I created an .INI file reader. I made a small ini file that describes some units and buildings to test it. Here is a portion of it:

Code: Select all

; First we define the different types of units that can be present in the game
[Soldier]
type=unit              ; should be on top. Can be "Unit" or "building"
HasRadarCapability=No  ; whether it can detect hidden units
CanMove=yes            ; whether it can move
CanFLy=No              ; whether the unit is an airplane
CanJump=No             ; whether it can jump onto higher ground or from a cliff
MoveSpeed=10           ; how fast it can move
MaxHealth=100          ; its maximum health, can be more than 100
MaxShield=0            ; its maximum shield level
MaxEnergy=0            ; its maximum energy level
FiringRange=250        ; how close units have to be before unit can shoot them
AntiAirFirePower=10    ; how effective unit is against enemy aircraft
AntiGroundFirePower=5  ; how effective unit is against enemy ground units
FiringRate=15          ; how fast it shoots
NeededCargoSpace=1     ; how much it occupies if transported
CostToProduce=50       ; How much money it costs to produce this unit
CargoCapacity=0        ; how much cargo it can carry
Requires=Barracks      ; building(s) required to produce the unit

[Tank]
type=unit              ; should be on top. Can be "Unit" or "building"
HasRadarCapability=No  ; whether it can detect hidden units
CanMove=yes            ; whether it can move
CanFLy=No              ; whether the unit is an airplane
CanJump=No             ; whether it can jump onto higher ground or from a cliff
MoveSpeed=20           ; how fast it can move
MaxHealth=400          ; its maximum health, can be more than 100
MaxShield=400          ; its maximum shield level
MaxEnergy=0            ; its maximum energy level
(...)
I'll try to define as many things as possible (buildings, scenario's, landscapes, unit properties, etc) inside the ini file to make the game highly customizable.

Since I really loved the ease of use of the Starcraft terrain editor I decided I wanted the same kind of experience for my own terrain editor. I believe I succeeded in doing so, unfortunately I can only show a simple text-version of what a landscape would look like, as this was the fastest way to visualize the landscape on screen for debugging (the red square is a cursor :lol: ):
Image

Re: RTS Game - new project

Posted: September 5th, 2017, 1:31 am
by chili
Stuff looks cool man! I have a soft spot for texmode games as well. Caves of Qud is my motherfucking jam (I refuse to play Dwarf Fortress though).

Your bottom up approach of making support tools before beginning a game engine is a little strange, but it seems to work for you so I ain't gonna complain ;)

Re: RTS Game - new project

Posted: September 7th, 2017, 9:24 am
by Byteraver
I had to look up the whole rogue like game thing, it is new to me. Maybe because I never really was into the Role Playing Game genre nor the Heroic Fantasy theme. Looks cool though, would be a fantastic learning project for aspiring programmers I'd say. I really like how only the stuff that the player can see is drawn.

About the RTS Project: I figured that if I wanted to make several terrains easily I would need a terrain editor, so I started with that. Cutting the project up in manageable chunks is important for me, I don't loose courage this way ;) I do have a road map in my head, something like this:

- .ini file Reader: "done"
- Terrain editor: still need save & load routines, possibility to add objects (ramps, trees, ...). I'm still wondering if I should save the terrain in a text file (.ini) or in a binary file. I'm actually thinking of using .ini files only for everything to make the program as accessible as possible
- Create terrain graphics in a procedural manner so the game can still be played if bitmap data is missing (sprites)
- Make a graphic version of the terrain editor (mouse driven)
- Work out the logic of a scenario (starting points, dialogue triggers, winning / loosing triggers, what units / buildings are available to the player and / or the enemy, ...)
- Enhance the terrain editor to create a campaign editor
- Create fog of war logic (hidden terrain, previously scouted terrain, monitored terrain)
- Implement path finding algoritm
- Create basic game mechanics (loading units, buildings, conditionals, scenario's from .ini files)
- Create a castle defender game type (build a base, defend against attack waves)
- Create an RTS game type (create "intelligent" enemy)

See? Almost done :lol:

Re: RTS Game - new project

Posted: September 8th, 2017, 1:20 am
by chili
Have you considered using an xml format (or even json?) There are parser libs for those that would make your life a lot easier, and xml is the industry standard for these kinds of files.

If you're interested check out pugixml

Re: RTS Game - new project

Posted: September 8th, 2017, 9:18 am
by Byteraver
Hi Chili, thanks for the suggestion. I did consider JSON but thought it would be easier to parse .ini files than JSON files (maybe I'm wrong ;)). We use XML at work, I have to deal with it regularly to check what went wrong with customers buying products, creating email addresses, hosting accounts and so on and I find that it is a super ugly, reader unfriendly syntax. The useful information is hidden between all those tags. It should be rather easy to parse though.
JSON is much easier to read but arguably harder to parse (I didn't try). As I don't like to use other people's code I choose the .ini file "layout" because I like how clean it looks. Maybe it's just down to personal preference.

Re: RTS Game - new project

Posted: January 7th, 2018, 9:47 pm
by Byteraver
Hi Everybody!

TL;DR: https://github.com/TheRealByteraver/RTSProject. Change the #define "GAME_FOLDER" in "globals.h" to reflect the correct location of the "RTSMedia" folder, or put that folder in the root of your C:\ drive.

Can't say I'm the most regular poster here sorry :( I wanted to show some progress I made on the terrain editor - I made a graphical version, complete with a mini map :) Editing has yet to be implemented, working on that right now. As an image says more than a thousand words, I added a screenshot for you to "enjoy" :lol: .

A valuable thing I learned - I think - is that the bigger your program is, the more solid it has to be (sturdy, bugfree, whatever you want to name it). Otherwise debugging can become incredibly hard. Except for the font that is used in the game or the definition of the race (like Terran, Zerg or Protoss in StarCraft), the startup procedure will pretty much recreate folders / graphics if these are missing during startup.

The desired screen resolution can be set in the "RTSProject.ini" file in the "RTSMedia" folder.
2016-07-01-Screenshot.PNG
Terrain editor Screenshot
(49.12 KiB) Not downloaded yet

Re: RTS Game - new project

Posted: January 8th, 2018, 6:15 am
by albinopapa
The UI looks clean, I like simple RTS games like Age of Empires, hopefully your interface is as simple and clean as that one. I don't like TOO many options really. Easy to play, tough to beat is a good formula. Keep it up.

Re: RTS Game - new project

Posted: February 16th, 2018, 7:07 pm
by Byteraver
Hi!
The terrain editor part of the Campaign Editor is almost ready. You can now draw terrain and doodads. Doodads are additions such as trees, buildings, bridges, all kinds of artefacts basically. You can easily make your own by editing the world .ini descriptions in the /Worlds subfolder. For now they only include ramps and smooth diagonal terrain edges. See the attached image for a screenshot (the forum only allows for images 700 pixels wide which is a bit narrow for most screenshots).

If you just want to play around with it, you can extract the .zip file and run engine.exe from the RTSProject folder :)
RTSProject.zip
(268.78 KiB) Downloaded 131 times
Have fun.

Edit: due to a bug I only discovered just now, the program will recreate the desert.ini world each time during startup, so you can't add your own doodad's yet. But that's not important right now anyways.

Re: RTS Game - new project

Posted: February 16th, 2018, 8:06 pm
by albinopapa
You might change the window style to popup if you are going to have your own title bar, seems silly to have two. If you do change it to popup, make sure you have a way to close the window like pressing ESC or through an in game menu.

Re: RTS Game - new project

Posted: February 16th, 2018, 8:24 pm
by Byteraver
You're right, ideally I'd like to be able to run it full screen. But I haven't tried to figure that out yet, as it is not the highest priority for me now.