Editor Update

Feature Development, World Editor

I’ve made some more good progress on the world editor.  Here is the full list of features as of today:

  • Relatively full saving and loading capabilities.  That is, you can save and load terrain changes and the location, rotation, and scale of objects in a scene.  Terrain data is saved in a custom heightmap image file.
  • Terrain editing including raising and lowering terrain and smoothing.
  • Add assets to a scene from a menu.
  • Translate, rotate, and scale assets that are added to a scene.

Listing it out, it’s not all that impressive considering the amount of work it has taken to get the editor to this point.  Still, I’m fairly happy with it and I’m pretty much at the point I wanted to reach by the end of February, so that’s encouraging.

I think the best course of action is to release a new version showing off the features of the world editor.  I’ll try to do that tomorrow.  Then I need to spend some serious time actually designing the game.  I have a vague idea of how I want the game to look and work, but I can’t develop from a vague idea.  I need specifics about classes, races, maps, battle systems, crafting systems, economic systems, etc., etc.  So after a version release tomorrow I’ll spend several days, if not more, trying to get the very basics of an actual game planned out so that I can start working on features in a more coordinated way.

Oh, and I guess I need to get an asset spotlight done as well.  Hopefully I can do that over the weekend, although designing assets of any value without a real game plan in place is … challenging.  Still, I’ll make something generic that I know I can use no matter what.

Editor update

World Editor

I’ve been making decent progress on the world editor over the last week.  I missed my deadline to do an asset spotlight on Friday because I just haven’t had the time to work on it, but hopefully I’ll get something together this week.  In the world editor you can now add assets to a scene and move them around.  By default everything just “sticks” to the terrain, but you can move things vertically as well if it’s needed.  I probably need to look into a finite state machine since keeping track of all the different modes and sub-modes within the world editor is getting a little hairy.  I’ve never used an FSM before but I think if I put the time in to understand it, it would serve me well.  For now I’m just going to push forward, but that will definitely be part of a future code refactoring.  I need the ability to save a scene out to a file and then I think I will transition back over to development on the game and just add features to the world editor on an as-needed basis.

Speaking of the game, I really a clearer idea of how my world will work and look.  I want to create original lore wherever possible and thought I would try to create a new battle system as well, but after thinking about it a bit more I realized the battle system I was imagining wouldn’t work well in a real-time multiplayer environment, so I’ll probably just stick with a classic MMO-style battle system.  I would like to make a crafting system that challenging and rewarding at every character level, so I’m thinking that will be a big part of the game.  But before I do any of that I need a basic story outline and some ideas about races and classes that will be available when the game first launches.

More editor progress

World Editor

Last night I finished almost all of the items on my to-do list for another world editor update.  Specifically, I can now:

  • Zoom the camera in and out so that seeing and moving around a large map is much easier.
  • Change the size and strength of the selection sphere.  Changing the size is pretty self-explanatory, but changing strength means that vertices move up and down faster or slower (depending on the strength of the tool) when raising/lowering the terrain.  This is handy for making big changes, then coming back to fine tune things.
  • Smooth terrains.  I don’t really like the smoothing functionality right now, but it does work.  The problem with it is that all the vertices within the selection sphere move toward the average height of all the selected vertices at the same rate.  So vertices right out at the edge of the sphere move up and down by the same amount as those near the center of the selection sphere.  Ideally I would be able to choose this behavior, or have the default that smoothing has more effect on vertices near the middle and less effect on those near the edge.  I tried doing it this way but ran into some issues with the lerp function in THREE.js.  In any case, it works okay for now and I can improve this later.
  • Flatten terrains.  This tool is super basic at the moment since all it does is set the y value of any vertices inside the selection sphere to 0.  Eventually it would be nice to have the option to set the desired flattening height, but that’s definitely a job for another day.

I did NOT make any improvements to the selection tool within the world editor.  I looked at DecalGeometry but didn’t really like it.  I did some research on shaders but quickly realized I don’t even know the basics of shaders.  This doesn’t seem like a feature that should hold up progress so I’m going to leave it for now, but this is something I want to improve eventually and I think learning more about GLSL would be time well spent.

These are some nice improvements but I still have miles and miles to go.  I think the next feature to add is the ability to place assets into a scene and save out a map file.  I’m not going to worry about rotation or scale right now, just getting some stuff into the world then saving out a map file that can be loaded by the engine.  Hopefully this will only take a few days, and I’ll post again when it’s done.

Editor progress update

World Editor

After much wailing and gnashing of teeth I seem to have heightmap saving and loading working properly.  Now you can load up a scene, make changes to the terrain height, save the scene, refresh the page, load the scene you just saved, and the terrain changes you made earlier are persistent.  The heightmap data is stored in a PNG image that gets stored on the server whenever you save the scene.  This has been relatively complicated to get going because THREE.js dropped all non-buffer based geometry.  This is, apparently, a much more efficient way to send data to the GPU but it means you can’t just loop through a geometry object’s vertices.  Instead you must access the geometry’s ‘position’ attribute array, and make changes there.  It’s actually not that much different it just throws my head for a loop because geometries have position attributes as well as indices that define individual faces.  I may be overthinking the relationship between the indices array and the vertices array, but in any case it gives me trouble occasionally.  But, for now, scene saving is working again.

My next step is to implement camera zooming.  It’s really tough to edit terrains efficiently when you can only see the terrain from a fixed distance.  I then need to create different terrain editing tools that are adjustable.  Right now all you can do is raise or lower the terrain vertices within a statically sized selection sphere.  I need to be able to perform other functions like smoothing and flattening as well as change the size and strength of the selection sphere.  I also don’t like the idea of displaying the selection tool as a sphere.  Hopefully I can figure out how to make it a decal instead that changes appearance based on the size and strength adjustments made by the user.

I’ll be working on these features for the next few days and will post again when they are done.  Oh, and happy Valentine’s Day everyone.

A Bridge!

Asset Spotlight, Planning and Development

I missed my self-set deadline of last night by just a smidge, but here’s this week’s asset spotlight: a stone bridge!

This bridge would fit in a medium-ish sized town because it’s pretty big and would clearly take quite a bit of material to make.  Can I level with you guys here?  This particular asset may not be completely finished.  You might have surmised this by the terrible wood texture and the absolutely horrible, incomplete stone texture.  I’m only showing you this view because the other side of the bridge is just flat gray.  Anyway, there’s still some work to do but I wanted to get something posted regardless.  Who knows, maybe one day there will be an actual game to play along with a community of actual players, and maybe I’ll ask some of those nice people to help me with the art in exchange for credits or recognition in the game?  Make it kind of collaborative?  I don’t know.  There has to be an actual game first.

Anyway, I kind of rushed this out because I’ve been spending what little mental capacity I have on improving the world editor.  You can now open a new scene, use an interactive brush to raise and lower the terrain, then save the changes out to a heightmap file.  Of course, the heightmap is being written wrong right now so when you reload the scene using that file it puts all your changes in the wrong places, but I’m making progress nonetheless.

I’ll try a slightly less ambitious asset spotlight for next Friday, and hopefully post about world editor improvements before then.  Stay tuned.

Editor Progress

Planning and Development, World Editor

I’m making decent progress on the world editor rewrite.  I’m miles ahead of where I would be if I had started over from scratch, but it’s still fairly slow going.  Every time I start over on this project that I’ve been dreaming of finishing for the last roughly 15 years it gets a little better.  I don’t think I’m necessarily a better programmer now than I was 10 years or 5 years ago, maybe I just have better resources at my disposal (I’m looking at you, stackoverflow).  In any case, the world editor now loads a flat terrain with a grass texture on it by default.  You can open a single (for now) map that only contains a heightmap for the terrain and nothing else.  You can then pan and orbit the camera around to look at the bumpy monstrosity of a terrain, and even save it to a heightmap file.  Of course, you can’t actually edit the terrain  yet so you’re just saving the file back over the one already on the server, but you can do it.  Here’s what it looks like right now:

Pretty impressive, huh?  Ok, I know it’s not, but it’s a good start.

Speaking of heightmaps, the heightmaps I’m using allow an absolutely huge range of heights but with incredibly fine details.  The lowest possible height is -32,768 meters and the maximum height is 32,768 meters, but the height of each individual vertex can vary by as little as 4 millimeters.  I will never really need the extreme detail or extreme range possible with the heightmap system I created, but it’s nice to have and doesn’t really cost anything extra in terms of storage or computation over a standard grayscale heightmap.  I’ll have to do an entire post on how my system works one day.  I’m sure I’m not the first to do heightmaps this way, but I’ve never found any resources describing my system so it might make a good read for someone.

I’ll keep at it with the world editor and make a concerted effort to get a second asset spotlight posted this Friday.  Until then.

A Crate!

Asset Spotlight, Planning and Development

This is the first asset spotlight for the new project so I decided to go with something as simple and cliché as possible.  So I made a crate.

This is a rendered image out of Blender, so it isn’t necessarily exactly how it will look in the game world, but it should be pretty close.  I’m trying to keep everything as resource-light as I possibly can, so this crate has 240 triangles and a single diffuse texture that is 256×256.  The triangle count is actually a little higher than I expected but I wanted some minor wobbles in the actual geometry to try and make it look a little more interesting, and unfortunately that requires triangles.  Still, 240 is pretty low for a game asset of any size at all.

I’m okay with the look of the crate overall but the wood texture needs some work.  I don’t even have a drawing tablet right now so with my limited art skills and dragging around a clunky mouse this was the best I could do.  I will eventually redraw that.  The metal isn’t exactly professional quality, but I’m still fairly happy with it for the time being.

Once the game is a little farther along I will do asset spotlights using renders from the actual game, but for now you can at least see where I’m trying to go with this.

Speaking of the game world, I found the code for the world editor I had previously written so I am in the process of tweaking that to work for the new environment of this iteration of the game.  That should save me a ton of time because the editor is already around 1800 lines of code, and tweaking that much code base rather that rewriting from scratch will be a big help.

I’m going to try really hard to post to the blog every Friday this month and so far I’m off to a good start, so fingers crossed I’ll see you in a week with another update.

Development plan – 2022.01.31

Planning and Development

I have implemented the most very basic features of a game.  Namely, you can walk around a flat map with a camera that follows the camera and which you can clumsily control.  I think the next best thing to begin working on is the terrain.  The problem with this is that it opens a huge can of worms.  Said can is opened due to the fact that I am not using a game engine to develop this, only THREE.js, and so I need a tool to create a terrain.  I could always just use an image editor to create a monochrome heightmap then alter the base plane to fit that heightmap but that’s not really a full solution.  Well, I guess I mean it’s just very difficult to maintain.  I would have to guess about the y-location of every asset I ever added to a scene because it would be nearly impossible to tell the height of the terrain at any given point in the world.

So what does this all mean?  It means I need a world editor.  I need a tool where I can create, load, and save chunks of the game world.  I’ve actually done a good bit of this work on previous incomplete projects so it’s not a completely overwhelming thought.  That being said, if I’m working on a world editor then I’m obviously not working on visible features in the game.  Still, it’s a necessary tool that I absolutely won’t be able to move forward without.  I will probably spend the month of February working on the world editor and hopefully I will have a mostly-functional tool by March 1.  In between coding I will be working on story lines, lore, and creating some proof-of-concept art assets to use once the editor is available.

So, the schedule for the month of February is as follows:

  • Blog some kind of art asset February 5th, 12th, 19th, and 26th.
  • Work on the world editor and get a usable scene in place for a new release on March 1st.

I think that’s a reasonable schedule and I’m going to try very hard to stick with it.

v0.00.002 Release

Release Announcement

Today I finished most of the features I said would be in v0.00.002 so I went ahead and released it.  I found a slightly better process to obfuscate all the code and pack it into a release, so hopefully that will make future releases a little easier.  Check out the game page to see the newest release and the notes.  I’m going to spend a day or so thinking about what I want to put into the next release then I’ll post about it.  And then I guess I’ll start actually working on it.

Camera Controls

Planning and Development

Tonight I implemented some glitchy but improved camera controls.  You can now spin the camera around the player and move the pitch of the camera up and down, as well as zoom in and out.  Right now there are no limits on any of these controls so you can spin around like crazy, move the camera past vertical up and down, zoom in past the character model or out infinitely, etc.  But those limits can be put in place pretty easily.

I’ve implemented these same controls numerous times in other projects and every time I go back to a YouTube channel called ThinMatrix for reference.  He has lots of nice tutorials on game development and the video that I always reference is here, so check it out if you are interested in that type of thing.