Black lighting in unreal engine 4

Today I was trying to do something very simple in UE4; making a checkerboard type level out of static mesh squares, below is an example of what I was hoping to achieve:

before build

Each square was a static mesh that I had created by turning a block brush into a static mesh and then had different materials applied. The problem was that every time I built my lighting things went black:

black

 

I tried changing every setting on the mesh that I could think of but could not find any way to stop this happening. In the end I gave up and went to maya to build my static mesh and imported it from there. Once again I’ve found problems when taking a BSP brush and trying to convert it into a static mesh, I think I’m going to stick to building all my geometry in maya and importing it from there. Here’s what I ended up with:

external mesh

 

Posted in Uncategorized | Leave a comment

Unreal Engine 4: Creating a triangle block

Today I was having a play around with UE4 attempting to creating a fairly basic level. One of the pieces I wanted in the level was a triangle block like a cube chopped in half as below:

triangle1

This was my first attempt which I did by creating a cube brush and then using the geometry editing weld tool to join some of the top vertices together. After that I triangulated and optimized to get the shape I wanted. While this looked ok when I turned this into a static mesh I started getting a lighting error “Object has wrapping UVs”. Skipping the triangulate and optimize step stops this error occuring but then the shape ends up with texture artifacts

triangle2

I had one more idea which was to use a subtractive brush at a 45 degree angle

triangle3

Finally I got what I was after. But I like this method the least as I have to manually line up the brushes and in this case I think I took 1 extra pixel off which may not be noticeable but I like things to be mathematically correct. Since I’m creating static meshes I might try building them in maya and see if I get better results there. I’m pretty new at this so if anyone has any better ideas of how to do this then let me know.

Posted in Uncategorized | Leave a comment

Project Drone: Day 3

Now that I had 2 drones moving around on the screen I decided that the world looked a little sparse with just a black background. I wanted to put some sort of simple backdrop which would later become my game levels. For now all I needed was a simple arena built out of a grid. Since everything is on a single level I figured I could optimise by having a single quad for the floor with models for each section of wall.

First up was building the floor. I started using the ModelBuilder to create a single quad. I was initially confused why it was only visible from the bottom but then remembered back face culling and reversed the order of the points so it would show up from the top. The next step was being able to put a tiled texture onto the floor. Getting a single texture was easy:

Material material = new Material();
Texture texture = new Texture(Gdx.files.internal("data/rock.png"));
material.set(new TextureAttribute(TextureAttribute.Diffuse, texture));

But tiling seemed a bit harder. I had to create a Mesh and use a deprecated method in ModelBuilder to create my tiled Model from that.

public Model createFloor(int w, int d) {
final Mesh mesh = new Mesh(true, 4, 6, new VertexAttribute(
Usage.Position, 3, "a_position"), new VertexAttribute(
Usage.TextureCoordinates, 2, "a_texCoords"));
mesh.setVertices(new float[] { 0, 0f, 0, 0, 0,
0, 0f, d, 0, d,
w, 0f, d , w,d,
w, 0f, 0, w, 0
});
mesh.setIndices(new short[] { 0, 1, 2, 2, 3, 0 });
Material material = new Material();
Texture texture = new Texture(Gdx.files.internal("data/square.png"));
texture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
material.set(new TextureAttribute(TextureAttribute.Diffuse, texture));
Model model = ModelBuilder.createFromMesh(mesh, GL20.GL_TRIANGLES , material);
model.manageDisposable(texture);
return model;
}

Wow, I need to get a new plugin to post code snippets. The indenting here is awful. Anyway, with my tiled floor done I moved onto the relatively easy task of adding a surrounding wall. I made the wall by having a single rectangular prism model and creating multiple instances in each square required. There would be more efficient ways to do this but for now it’s not really a problem.

Surrounding walls up

 

Now that I had walls and a floor though it meant moving my little drones into the centre. This would be easy to do but is also ultimately a waste of time, a better idea was to combine this into creating a player controlled drone and actually get somewhere on having an actual game. For this I created a Player class which ties keyboard controls into drone movement. It’s very simple for now but should be flexible enough to handle everything I needed. This immediately raised 2 problems:

  1. With the isometric view and the ability to rotate the camera the concept of up didn’t always match up to what was expected.
  2. The camera wasn’t in any way centred on the player.

Both of these issues pointed to the need to create an isometric camera built for my game. This was actually simpler than expected. This post gave me a nice overview so I simply switched to an Orthographic camera and set the position to be slightly offset from the player with a fixed direction. This wont be good enough for the final version since it needs smoother motion tracking but for now it lets me move on to more interesting things.

At this point I had all of the building blocks I needed to start building my game. I have a lot of different game concepts that I could start with. The key is picking the one that I can get working fairly quickly. Time to sit down and have a long think about this before I get back to coding.

Posted in Uncategorized | Leave a comment

Project Drone: Day 2

After getting things started yesterday my goal today was to be able to have 2 drones which were able to target and face their turrets at each other. For now I’m not going to deal with building a scene graph to see if I can get away without one, later on I’ll probably take the code I put in my DroneUnit class and generalise it for use in other places.

Adding a second unit was easy as expected, which at least lets me know that my design isn’t broken yet. Initially I tried using the setToLookAt method in Matrix4 to point but this caused quite a few problems. Luckily I had done the same thing in another project and the code was fairly easy to transfer. One thing that caused me problems was the order of operations. Rotation then scale was causing problems but rotation then multiplying by a scale matrix was fine. In the end I stuck with scaling then rotating which for now looks ok.

So a pretty small amount of changes but at least I completed what I set out to. And also got a start of a node based system for scene management.

facing1

Posted in Uncategorized | Leave a comment

Project Drone: Day 1

In my previous post I setup a libgdx project that rendered a simple model to the screen. The next piece I want to work on is creating some units for my game. I could find someone to help me with the modelling and may do this in the future but I want to be able to do this myself so I can better explain what I need if I decide I want to hire someone to do modelling work.

Since I know very little about modelling this means spending a lot of time watching tutorials. It’s strange moving into a completely new domain. Usually with programming even when moving to a new language I understand what tools are available so I look for tutorials or examples specific to what I want to accomplish. But doing that here may mean I miss out on something that will make my life easier so it’s back to basics.

After a small amount of work I had created a very simple and untextured base that I could use for one of my units. I know it doesn’t look like much but it’s a place to get started.base1The next step was to build a turret piece that could be placed on top of this base. This too I made as a very simple model to get things up and running quickly.

turret1

So now that I had some basic models my next task was to join them together. At this point I really wanted to jump in and start creating my class hierarchy but first I needed to read through the libgdx docs a bit more so I didn’t make some major design issues.  I found out about the AssetManager class which greatly reduced the need to manage model loading and after that it was a matter of being able to put the turret on top of the base. I’ve managed to do this despite there not being any concept of a scene graph in libgdx. Currently I’m updating child positions when the parent moves but I think this will cause me lots of problems later on. As you can see scaling the turret has messed up the lighting but I’m not sure why. Below is where the game is at by the end of day 1.combined1

Posted in Programming | Leave a comment

Getting started with libGDX

So today I created my first project with LIBGDX. Libgdx promised being able to deploy to iOS, android, desktop and webGL with the benefit that all the development is done on the desktop so no time is wasted deploying to devices or emulators. Once I installed all the libgdx prerequisites I tried to confirm that all platforms were building correctly. Desktop and HTML worked straight away, Android would not build initially because I had not downloaded the required version using the android SDK manager but worked afterwards. iOS built but would take some time to setup my provisioning so I decided to test it later. Since I had enough to test on the desktop and deploy anything I created to web for people to play with I decided to go straight to work and deal with android and iOS later.

Since I wanted to build the game around 3D graphics I found a tutorial for drawing a cube on the screen which gave me a good starting point. The performance in WebGL seemed terrible but I’m hoping this is simply because it is a debug version. I’m going to leave this issue until a later date.

But a cube was never going to be enough. The next thing I needed was to be able to load a custom model from a file. Luckily the next tutorial in the series covers that. One thing that wasn’t covered was where to put the assets. I found that the recommended way is to put the assets in the android assets directory which the desktop project links to so the files are not duplicated. So far this seems to be working.

This entire learning process has taken me a few hours, much less than the weeks it took me to write a model loader and create the openGL calls to display it so in that regard the library is looking pretty good. Now to sit down and start designing my game so I have something to work towards.

Posted in Uncategorized | 1 Comment

A new direction

1 week ago I landed back in Sydney after a few years living in London. Since I am now unemployed and have fairly low living expenses I decided that it’s a great opportunity to spend some time working on my own personal project.

Since I’ve always wanted to make games and I have experience in mobile development I reasoned that a game for mobile was my best bet. Initially I had been toying around with building my entire game in objective-C targeting iOS only and then converting core pieces to C so that I could use it with other platforms. While this was fun and I learnt a lot it was ultimately leading to very slow development. I was essentially having to rewrite a new 3D engine and I just can’t do that quick enough to develop a game at what I would call a reasonable pace. And then at the end of that I would have to do an engine rewrite to move to other platforms and then have to separate out all the iOS specific code.

So I started looking into using a third party library or engine. First up of course was Unity since it has the biggest following. I had a bit of a play but felt it was targeted too much at designers instead of developers. Too much was defined in the UI and not in code which just isn’t how I like to work. The next thing I found was libgdx. Unlike Unity the library was free and open source and let me have a familiar “main” method where my program starts. The language is java which I am slightly apprehensive about using for a game but the library has ways to minimise garbage collection to prevent hiccups and for what I want I don’t need extreme performance.

So today I’m trying to create a new project that can be deployed to multiple platforms. Hoping not too much time is wasted in the various setup bugs I imagine encountering.

Posted in Programming | Tagged | Leave a comment

Internet security and Amazon EC2

A few months ago I started trying out the free tier of amazon EC2. I set up my linux box to run a new pure JS version of my website. My original plan was to move everything over to EC2 and use that as my primary hosting from now on. I didn’t really have a lot of time to spend so I only paid attention to what I needed to in order to start up 1 machine and be able to ssh into it to install the programs I needed.

In the last few days my account was compromised, some instances were started and my monthly bill ended up at $280. Luckily I was back from holiday and able to check my emails or it could have easily ended up in the thousands. Thankfully amazon were nice enough to get rid of the charges since they were caused by someone else. I have since closed my account so that I don’t end up in this position again.

This is the first time I have had a problem with internet security. I’ve been of the opinion that nothing I have on the internet is really that important and for the most part this is true. Someone hacking my account and defacing my website would only be a minor inconvenience. I did not ever think about someone setting up a server farm and footing me with the bill.

Since this has happened I’ve rethought how I approach securing my accounts. I’ve changed a number of my passwords just to be sure and where possible enabled 2 factor authentication. Thankfully no one has yet gained access to any of my other accounts and I’m hoping my increased security will keep it that way.

Posted in security | Tagged | Leave a comment

What is really the world’s strongest beer?

For a while now Brewmeister have claimed the title of world’s strongest beer; first with Armageddon at 65% and now with Snake venom at 67.5%. I’ve not had Snake venom but I purchased Armageddon while it was still the worlds strongest beer and recently consumed it. I drank the entire bottle over the course of a few hours to make sure the alcohol didn’t sneak up on me and after finishing it I can guarantee you that it is not anywhere near 65%.

Sadly I don’t have any scientific equipment so I can only base this on the following observations:

  1. Unlike other strong spirits there was no burning or warming sensation while drinking it. Initially I just put this down to it being a high quality brew.
  2. I was not able to light it on fire. This I also put down to the difference between a spirit and a beer (even if it has a high alcohol percentage)
  3. After consuming the entire bottle I was not drunk in the slightest. This was the big one for me. The only reason for this is that the labelled percentage is incorrect.

From my fairly unscientific methods  I would place it at under 20%. I have found another blog post from Sweden that has down some tests and came to a similar result http://www.portersteken.se/2013/02/varldens-starkaste-ol-eller.html
I also searched and found numerous other posts from people who have had this beer came to the same conclusion.

So if the percentage written on Armageddon is a lie then why would I believe that Snake venom is any different? So given that this brewery cannot be trusted to correctly label their products which then is the world’s strongest beer? Are other breweries doing the same thing and if it is only Brewmeister then why haven’t they been called out?

Posted in beer | Leave a comment

The Big Album of Beers

Today after a long break I finally finished the basic version of my big album of beers search page. For over a year now I’ve been photographing every beer I drink and putting it into a Facebook album called the big album of beers. As this album has grown it has gotten sometimes difficult when looking for new beers to remember if I’ve already had the particular beer. This is compounded often by hazy memories of having the beer in the first place.

What I’ve done is create a javascript page which displays the contents of the album with an additional search field. Unlike Facebook it loads all the images at once rather than in blocks which makes finding what I’m after a lot easier. This concept could be made to work for any Facebook album but the parsing of the meta data would need to be changed to match the content.

For those who are interested, here’s the technical details:

All the code is available at: https://github.com/skorulis/blackbird

The list of beers is pulled from Facebook using a ruby script. The script takes the caption from the photo and breaks it into name, alcohol percentage, comment and rating. I did this as an offline script opposed to javascript for 2 reasons:

1. I don’t have to deal with authorisation tokens and logins on the web page. My ruby script doesn’t need code for this, when I want to update the list I simply get a new token from the Facebook graph explorer.

2. If the beer text doesn’t fit my expected formatting the ruby script will crash and I can work through any problems until it works, if this was online the page would break every time I put in a bad title for a beer.

I’m using ember.js to handle pretty much all the javascript on the page. I’ve used ember for the rest of my site and found it fairly simple once you get over the initial steep learning curve. That said I still have a few issues yet to be solved:

1. The search can be a bit slow and since it’s on the UI thread causes a pause on the page. It’s acceptable right now but I would prefer to kick this onto a background thread. I’m sure this is possible but is going to be more effort than it should be.

2. I would really like to have this available as part of my main site so I can keep all the site navigation and other goodies. I definitely don’t want to have to combine the javascript from here with my main javascript as this will bloat my main site over time. I also don’t want to have any copied code. A html frame may solve my problem but not in the nicest way. What I really want is to have a sub ember application running inside my main one. Anyone know if something like this is possible?

Next steps are to add a details page for each beer to keep a bit more information when I have it. Also some more detailed filters would be nice and possibly a sort order.

Posted in Uncategorized | Leave a comment