Empires on UE4: UE4 is FREE edition

Discussion in 'Off Topic' started by Kylegar, Mar 3, 2015.

  1. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    New thread celebrating that UE4 is now free for everyone. It's time to get this show (back) on the road.

    Note: Because the latest version of Unreal Engine has a git source control extension, we will be going back to Git.

    Lets coordinate a community project to create an Empires sequel on the Unreal Engine. The Engine is 100% free to develop on (they take 5% of revenue after release), and has Incredible support for an Empires-like game.

    You don't need to code or be able to model to contribute to this project. Unreal Engine has a visual scripting system that's incredibly easy to use. We will be making use of it.


    The project's current Engine version is 4.7.1.


    Getting Started


    To download, just head over to Unrealengine.com, register, and download.

    Once you have the launcher, you need to download 4.7.1. It's about 2gigs.

    You will need git extensions to acquire the project.

    Once you have that, you need to go to the project on Github and Fork the project. You then clone your fork of the project and make changes to that. When you have what you want done, create a pull request.

    You will also need Visual Studio so you can compile the project. It's free.

    Development Plan

    So, I'm making a change to the development plan.

    From now on, we will be porting models/assets from the sourcemod first, then replacing them later. Spending time creating new assets is going to be a pain and will slow this project down. I want to get the game as playable as possible first before spending time making it look pretty.

    Additionally: All new game mechanics will be implemented in Blueprint first before ported to C++. This is to decrease the minumum level required for a new contributor to get involved. Only when we declare a feature 'Complete' will we move it to C++ and make use of that speed increase.

    Finally: Create Objects, not Systems. Our goal is to create a working game, so develop features such that you are creating things that people can use and play. For example, don't bother creating a gamemode system that support TDM/Conquest/CTF. Create a TDM gamemode first. We can then promote the general code up to a 'Team Gamemode' level and create CTF from that.

    Additional note to Programmers: Do not modify the engine. This will help us keep the engine version up to date with the latest and greatest features. If you need to make a change to the engine for some reason, you better be willing to make a epicly long post on this forum explaining why and how all other options to keep things game level didn't work. If you make an engine level change, forward it upstream to Epic to be included so we can get off of custom engine builds.

    Community Organization

    Since anyone and everyone can now contribute to this project, We will now start using IRC to do development.

    All of these channels are on irc.gamesurge.net

    General Empires Channel: #empiresmod
    Project Development Channel: #empires2


    If this project really starts taking off, I'll make some subforums here.
     
    Last edited: Mar 3, 2015
  2. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    So how the hell does the Unreal Engine work anyway?

    A Development Primer on working in the Unreal Engine

    So, you've started up the empires 2 project. What the hell are you doing?

    Take a moment to familiarize yourself with the Editor. Figure out how to move, how to move things, how to modify objects in the world. Use the built in tutorials (which I've heard are great but I've never used them).

    If you want to work on the game, You need to know how to use Blueprints

    This is probably the most important thing to learn (For everyone, including anyone doing stuff with Art, Sound, or other stuff. Blueprints are core). This stuff is incredibly easy to understand (it's a drag and drop node editor), so get familiar with it. Create an object that changes color when you walk close to it. Create an object that kills random people in the radius every 10 seconds. Do something simple with Blueprint and get your feet wet.

    Once you are done with that, lets talk about the Engine.

    Engine Overview

    So, now that we are building a game, how do you get started. There are two categories of blueprint objects. Actors and Engine Classes

    Actors are the objects you place in the world. Buildings, guns, players, rocks, buildable materials... Everything in the world is an Actor. In Source terms, these are Entities. They should be pretty familiar to you and it should be obvious how best to create Actors.

    Engine Classes are where things get interesting. There are a number of these classes and they all do somewhat different stuff.

    Game Mode - Every game has a game mode. It exists per-level and is destroyed and rebuilt when you transition to another level. This isn't just checking to see how many kills or whether the Command Vehicle is dead... This also handles Player spawning and how players interact with eachother. This is Server-Side only.

    Game State is a data class that exists on the Server and All clients. Think of it as a partner to the Gamemode that allows for the game mode to show clients how the game is going. The Game State should keep track of how many resources each team has, who their commander is, and stuff like that.

    Game Instance is an object that local to every game and exists from the moment the game starts to the moment the player exits the game. This is where you handle things like menus, options, and the like.

    Player Controller is a server-client object that is given to every player. While there is a 'Player' object, It's better to think of the Player Controller as the player. It can Possess certain Actors (anything derived from Pawn), and whichever Actor it is possessing receives Input from that PlayerController. If you are thinking that to implement Vehicles, you simply need to Posses that vehicle... you are on the right track.

    Player State is a server-client object where data is stored. Think of this like a player version of Game State. You store your players Kills, Deaths, score, XP, Level, Their loadout... Even their Player Name and Ping is located in this class.

    Dealing with Multiplayer

    This is probably the hardest part of developing on UE4. It's the part that tripped me up the most, and I think I've finally figured it all out.

    Knowing what happens on the Server and what happens on the Client are incredibly important. Only the server has Authority over what happens in a game. This is the same as Source engine, but it works very differently in UE4.

    For example:

    A player presses the W key. You want your character to do something. You go into the Event Graph and create an event for when W is pressed.

    It looks something like this:

    [​IMG]

    This will happen on the Client only. You need to create an RPC in order to tell the server to do something.

    What you do is Right-Click, type 'Custom Event', click 'Add New Custom Event...'. Name it whatever you want. In that event's properties bar (on the right) select the Replicates drop down box and click 'Run On Server'.

    [​IMG]

    This will make the new event run on the server. Compile the blueprint. Right click on the graph again and type in the name of your RPC you created. Add it to the graph and drag the Pressed pin over to the new RPC.

    [​IMG]

    Now the string "On the Server" will only print on the server.

    There are 3 types of RPCs.

    • Run On Server - Can only be called on the client. Executes on the server. Use this to request things from the server, like to shoot, move, spawn, etc.
    • Run On Owning Client - Server notifies client of something that happened. Send them detailed Take-Damage information (where from, how much, if they are dead).
    • Multicast - Send simple damage information (They got hit, so spurt blood and make a 'Hurrrgh' sound.)

    Knowing when and where to use these is important. Input always takes place on the client. Gamemode events always take place on the server. So on and so forth. You always have to send an RPC to the server if the client wants something changed. This includes changing things with Player State and Game State.


    Additional Resources

    If you need help with Unreal Engine thingies, here are some places to look

     
    Last edited: Mar 3, 2015
  3. Deiform

    Deiform Member

    Messages:
    2,492
    Likes Received:
    10
    Trophy Points:
    0
    Looks good, development plan follows what Lionhead Studios do (I guess you read the same comments and articles I did).

    For people who don't know much about this engine, you can do ANYTHING in it. Bone animation, rigging, mapping, everything apart from modelling is all done through the editor.

    An easy first task for someone new is to take this tutorial they released earlier today and use it to script grenadier mine behaviour. Easy peasy! (Not sure if HP is implemented yet though) The video tutorial archive is really comprehensive too.
     
    Last edited: Mar 3, 2015
  4. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    Yeah, damage is in.

    Almost the whole infantry gameplay stuff is 'Done'. There is a bug where the weapon doesn't attach to the hands correctly, otherwise it all works.
     
  5. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    I'm going to use this post for UE4pires specific stuff. Things like custom blueprint nodes, workflow examples, etc.
    Importing Srcpires Assets into UE4
    Firewarrior wrote a good guide to do this with Blender:

    http://forums.empiresmod.com/showpost.php?p=502329&postcount=130

    Here are the SMDs and the textures as PNG:

    https://drive.google.com/open?id=0B5prZNxOmeijbUI1ZlJGTU5YNm8&authuser=0


    Code Naming Convention

    In an attempt to reduce confusion and strangely named objects, the following naming convention will be used on all objects:

    • C++ Base Classes will be named 'EmpBaseX'
    • BP Base Classes will be named 'EmpX'
    • 'Final' classes will be named 'X'

    where X is the name of the object.

    For example, the C++ base gamemode is called 'EmpBaseGamemode'. The Blueprint base class is called 'EmpGamemode'. Team Deathmatch is called 'TeamDeathmatch'.


    Developer Folder

    The Developers folder is a place where you can work on things in a clean room environment and integrate it into the rest of the game later. It's a place to practice and get feedback, as well as to test out features and determine if something is working or not.

    To Access the Developer Folders, in the Content Browser's View Options, select 'Show Developer Folders'.

    If you don't have a local Developer folder (or want to rename yours), just add a new folder to the Developers top level folder.


    [​IMG]



    Note about my (RoyAwesome) developer folder:

    My folder will always contain test objects for certain features I write in C++. Things like custom gamemodes that implement blueprint stuff, Objects that can be used and do random shit, things like that. It's probably the first place to look if you need to see a working example of some C++ code and/or how to do something.

    I will also have every single one of my tutorial blueprints in that folder as well.

    Feel free to explore whats in my folder, but I will not pull anything that changes something in my folder.

    Creating UI elements

    Creating UI in UE4 is a Designer centric and super straightforward process (which is very different from Source lemme tell ya). It's 100% blueprint and it's something that anyone can pick up and just do.

    To get started creating UI elements for UE4pires, take a look at the UMG documentation. This will give you a pretty good overview of the basics of creating UI elements, but it does not cover how to get your UI element on the screen.

    So, for UE4pires, we will split up the types of UI elements. There will be Game level UI elements (HUD, Class Select, etc), and Menu level UI elements (Server browser, Options, etc). Game level UI elements will go into the HUD object (located in Blueprints/TestHUD), where Menu elements will be located in the GameInstance object (Blueprints/EmpGameInstance).

    So, once you decide you want (or need) to create a UI element, Start by creating a folder in the UI/ folder in the content browser. Name the folder what object you are working on.

    For this example, we will be adding the player's health to the HUD. So we will create a folder named HUD. Inside that folder, we will create a top level widget. This is the widget that will be added to the screen and should have a Canvas Panel attached to the root of the widget.

    [​IMG]

    Once the top level is created, we need to create a simple widget to add to it. So, we are going to create a new widget called 'Health Counter'. Since we are going to determine it's size in the top level widget, delete the Canvas Panel.

    For the health counter, We are going to create a horizontal box, add some text and bind those text elements to properties. How to do this is covered in the UMG documentation (so read that, or look how it's done in the game files).

    Once we have everything bound and created, we are going to add the Health Counter widget to the top level HUD widget. Find it in the 'User Created' category and position it.

    [​IMG]

    Now that we have added a health counter to the HUD, we are going to add the HUD to the screen. Since this is a Game UI element, open up the TestHud and add in two custom events (right click, type 'custom event', select Add Custom Event...). One for opening your UI element and one for closing it. They should look like this:

    [​IMG]

    Remember to create a variable in the HUD blueprint

    Now that we have a simple function to open and close the HUD, we should create the back end to open the HUD. Each widget is different when it comes to what should be done (Class Select needs a button, HUD when a player spawns, etc), so I wont cover back end here.

    Hopefully this will help create new UI elements.


    Creating Weapons

    To create a new gun in UE4pires, you first need to create a new Blueprint. The parent class should be 'EmpInfantryWeapon'.

    Once you have your new weapon, open it up in the BP Editor. There are two mesh components, 1p mesh and 3p mesh. The 1p mesh is the mesh you see in 1st person (View Model in Srcpires), 3p is the mesh that everyone else sees (World mesh in Srcpires).


    Once that is done, you need to to your Self category and start adding some data.

    First, we need to create an Animation Set. This is a set of animations and effects for the weapon. (NOTE: Animations will probably move out of this and it will be sound/particles only).

    [​IMG]

    For now, we can leave most of these blank. Give it a fire sound and a muzzle flash so we know the gun shoots.

    Next, we need to set up the Firemodes. Firemodes dictate how the gun behaves.

    [​IMG]

    The first array is 'Firemode Data'. We want to create a number of these equal to the number of firemodes we want (FullAuto, Single Shot, Burst, etc). Think of this as 'How does the gun shoot'.

    • Ammo Consumed Per Shot is how much ammo is consumed when a shot is fired. Defaults to 1.
    • Rounds per Minute is how fast the gun fires at max rate. Default is 600.
    • First Shot Fire Delay is how long in seconds the first shot lags before firing. This is useful for stuff like sniper rifle delays. Default is 0. Cannot be less than 0.
    • Rounds Per Shot How many bullets does this gun fire in a single shot? This is for creating shotguns. Default is 1. Cannot be less than 1.
    • Firemode Class Sets the class that defines how this gun will fire. Firemode is a blueprintable class. Default is None. (NOTE: Must be set for the gun to fire).
    • Ammo Pool Index Sets what Ammo Pool this firemode draws from. Default is 0. Cannot be less than 0 or more than the number of ammopools.
    • Animation Set Index Sets what Animation Set this firemode uses. Default is 0, Cannot be less than 0 or more than number of AnimSets.
    • Recoil Data Index Determines what Recoil Data Struct is used when firing a bullet. Default is 0. Cannot be less than 0 or more than the number of Recoil Data Sets.
    • Damage Unused. Use the Ammo Pool's damage. This property will be removed.

    The second array is Ammo Pools. Think of this as 'What does the gun shoot'. Multiple firemodes can pull from the same ammo pool (sharing Full Auto/Single Shot clips), or can have different ammo pools for different firemodes (for creating an under barrel shotgun or grenade launcher drawing from a different ammo pool). You need at least 1 ammo pool.

    • Max Ammo How much ammo can this ammo pool have? Defaults to 120.
    • Clip Size How many bullets are in each magazine? Default is 30.
    • Reload Time How long does it take to reload this ammo pool? Default is 0.
    • Damage How much damage does this ammo type do? Default is 100. Characters have 1000hp.
    • FireType Determines how the bullet behaves. This is blueprintable. You should be using FakeProjectile for bullet weapons, and create your own Projectile firemode for non-bullet options. Instant (Srcpires style hitscan) firetype is also available.

    The final array is Recoil Data. This determines how the gun recoils after each shot. It's very in depth and there are many settings. Hopefully it creates interesting and varied weapons.

    [​IMG]

    • Vertical/Horizontal Recoil Min/Max Determines the range of the random recoil value (in Degrees) generated per shot. This value is multiplied later by the multipliers
    • Left/Right Recoils Determines the direction of recoil. One of these boxes must be checked, and both can be.
    • Left/Right Recoil Bias Biases the Left/Right random selection to pick either Left or Right recoil. If one of these is 1, it will always chose that. Value must be between 0 and 1.
    • First Shot Recoil Multiplier Multiplies the first shot's recoil by this amount. Must be >= 0. 0 FSRM means the first shot will have 0 recoil.
    • Standing/Crouch/Prone Recoil Multiplier Multiples the recoil value by this based on your stance. This is used to reduce the recoil based on stance.
    • ADS Move Speed Multiplier Scales your move speed when ADSing. .5 means you move at half speed. 1 means you move at full speed. 0 means you cannot move when ADSing. Must be >= 0.
    • Stand/Crouch/Prone Hip/ADS Move/Still Determines the base Cone of fire values (in degrees) for these stances. This is a minimum Cone of Fire for this stance. Must be >=0
    • Stand/Crouch/Prone Hip/ADS Bloom Determines how much (in degrees) is added to the base value for each shot. This increases the Cone of Fire per shot. Can be negative to make the gun more accurate as it's fired.
    • Max Stand/Crouch/Prone The maximum Cone of fire for the stance. Must be greater than the minimum.
     
    Last edited: Mar 11, 2015
  6. Grantrithor

    Grantrithor Member

    Messages:
    9,820
    Likes Received:
    11
    Trophy Points:
    0
    I'll start updating. Can we get a list of things that are currently being worked on or that are in a working state? That way someone doesn't go and implement something that's already implemented.
     
  7. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    Working:

    Weapons, Damage, Muzzle flashes.

    Gamemode Respawning and Damage notification

    Main Menu (it's done. It works. It has music.)

    "Working" (needs to be improved):


    Class selection and definition.

    Needs to be done:

    Port Models. Make Maps. Make HUD. Make Class Selection UI. Make particles. Impact Effects. Respawn point selection (and using it).
     
    Last edited: Mar 3, 2015
  8. Z100000M

    Z100000M Vithered Weteran

    Messages:
    9,120
    Likes Received:
    70
    Trophy Points:
    0
    happy to know youre back on track kyle
     
  9. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    I was kinda waiting for something like this to happen. I wanted to have a community project that everyone contributed to, but it turned into only me working on it.

    Now everyone can contribute.
     
  10. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    Update:

    Code is now fully updated for UE4.7.

    I also exposed a dick ton of new events to Blueprint for Gamemodes. That means everyone here can now create game mode things if they want. You can do things like Modify damage dealt between players, Implement spawnpoint choosing (this is huge), and determine if friendly fire is a thing. All from Blueprint.

    I am going to continue to expose functions to Blueprint to allow you guys to implement things that are needed.
     
  11. zenarion

    zenarion Member

    Messages:
    953
    Likes Received:
    0
    Trophy Points:
    0
    Nice job Kylegar! Looking forward to see how this turns out.
     
  12. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    I smell FF mode
    ohh ohh point based skills you have to buy with certain amount of points.
     
  13. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    Yeah, sure, why not :D
     
  14. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    Main Menu has been redone and done well. It also includes the Empires main menu theme (which I couldn't bear for it not to exist, even this early in development).
     
  15. f1r3w4rr10r

    f1r3w4rr10r Modeler

    Messages:
    2,475
    Likes Received:
    4
    Trophy Points:
    0
    Are we currently still planning on copying over Empires 1:1? Because right now it seems to be either that or some rather headless development, where nobody knows where we are really going. Wouldn't it be better if we at least had some goals defined and maybe write them down somewhere else than a forum thread? (Hint Hint: Task Tracker)
     
  16. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    Yeah, I was talking to candles about that.

    I want to basically port empires over (nearly 1:1 as possible), then modify out from there. That way we have both a base game to play and judge changes against, and a platform for exploring more interesting game mechanics.

    Unlike srcpires whos codebase is notoriously terrible, this will be very easy to modify and change mechanics. Things like being able to just up and add aircraft without any difficulty by creating a new type of vehicle movement component, stuff like that. If we get to having Empires ported, it'll be super straight forward to change and improve from there.

    EDIT:

    Anyway, what is straightforward to work on:

    Class Selection: UI needs to be started. Backend is work in progress (I'm going to improve that tomorrow).

    Respawn Selection: Back end is now fully exposed to Blueprint. Feel free to override "Select Spawn Point" in the Game Mode and start cracking.

    Minimap: Needs UI work. Back-end is all engine level stuff.

    HUD: Back end is done, needs UI work.

    Code Stuff:

    Fix the attach problem with weapons. Current weapons are respecting rotation but not pitch in first person. They work in third person.

    Impact Effects. Either expose impacts out to Blueprint (best idea) or code it in.
     
    Last edited: Mar 3, 2015
  17. f1r3w4rr10r

    f1r3w4rr10r Modeler

    Messages:
    2,475
    Likes Received:
    4
    Trophy Points:
    0
    To be honest, my major problem if I were to work with you on this is the way you do the source control, both for code and assets. My stuff was just simply overwritten multiple times, because you forgot to do a pull before starting to work. I'm not really keen on having to do stuff again, just because you forget to do that.
    That's one problem, the other is a lacking organization system. Forum posts are not suited for that purpose.
    (Those are pretty much the same problems my bf has with this as well, otherwise he would help too.)
     
  18. Kylegar

    Kylegar Specstax Rule

    Messages:
    2,170
    Likes Received:
    0
    Trophy Points:
    0
    So, I think the best solution to the overwriting problem is to just do forks/pull requests. Rather than commiting directly to the repository, you commit to your fork and submit a pull request when it's done. Since you have permission on the repo, you can just pull it yourself and it'll be fine.

    Another thing (Documentation Written) is to use Developer Folders to store things that are being worked on. Assets in Developer folders ideally would never be touched by another developer and aren't included in builds. It's a good safe spot to do work then integrate it in later. You can commit the content of the developer folder and others can see it and give feedback.


    Fixing that. Using IRC now (read the OP). I'm going to steal the source code from a friends bot that lets you leave messages to people when they are offline. deif, candles, and zenarion are on IRC now, so it should increase the level of talking and organization. I'll also look into a bnc for us so we can queue up messages.
     
    Last edited: Mar 3, 2015
  19. f1r3w4rr10r

    f1r3w4rr10r Modeler

    Messages:
    2,475
    Likes Received:
    4
    Trophy Points:
    0
    I'll have a look in the IRC when I am home. (IRC is not really suited for documenting long term tasks as well, just saying.)
    Considering how Git works with your local and remote repository, forking seems like an unnecessary step, but I'll have to see.
     
  20. Deiform

    Deiform Member

    Messages:
    2,492
    Likes Received:
    10
    Trophy Points:
    0
    Forking is going to be a benefit in the long run when everyone and their dad creates a fork of Empires to add in blimps.
     

Share This Page