OpenArthurianX6 – Saving and Loading Games

Mirrored from OpenArthurianX6 devlog

:: Finally managed to make saving and loading work, which involved doing a big refactor on the data that was being kept on each entity. I’m using my own circular-functions library and even had to push a small bugfix after about 4 years. See it working in the video below.

This will require some more testing, some bugs likely managed to slip in since it’s a big change.

Also, since the last update, the changes done by Jucarave for door handling were merged in, as well as the popups with item descriptions.

Next up to finish milestone is:

  • Line of Sight, still thinking of how to do it, considering the following options:
    • True LOS using raycasting or shadowcasting like a traditional roguelike, might be a bit heavy in the processing and might look a bit weird with the scrolling, but would be more accurate and apply to a lot of different situations without special casing. Just need to define whether a particular cell type is opaque or not.
    • Ultima 7-like, using different “zones of sight”, so if you are inside a building you can only see inside the building (but you can also see other nearby building through the walls!), and if you are outside the buildings you can only see the wilderness (but you can see through buildings!).
    • Ultima 6-like, with more elaborate areas of sight, so once you open a door you “unveil” the room, but then would have to keep track of these areas, and model them as part of the maps. Also you can see other unveiled rooms thru the walls.
  • Reading Books, which should be simple enough.

 

Screenshot Saturday

This week we have progress in Expedition, OpenArthurianX6 and Age of Golf

OpenArthurianX6 – Enemies doing ranged attacks

Making the enemies being able to attack the player with ranged weapons required two things: first was allowing defining initial inventory for mobs (so that they could have ammunition for the weapons).

This was already possible for NPCs, but not for MobTypes. I considered merging this data together but rather decided against it so that you could have NPCs share MobTypes without having to duplicate data. So now you can define initial inventory for both (and it will be added together).

After modifying the “base” mobs tileset to handle two types of soldiers (swordSoldier and xbowSoldier) with different weapons and inventory, I ran into problems with the process of embedding the tileset on the tiled map. It just doesn’t seem possible to update the embedded tileset with modifications (Once embedded it’s copied into the map, and I couldn’t find a way to replace it without deleting the tiles that were already using it).

However, on a second thought, I think it makes sense for the mob types and NPCs to be used in a given map to be embedded as tiles on its tileset. This means I’m ditching the idea of a “master” external tileset for the mobs, instead, each map will have tiles with custom properties for it.

Once that was in, I implemented some basic AI for the enemies, if they have a ranged weapon and there’s a clean LOS, they will fire instead of bump-attacking. This worked well, however, I hit a problem with the hybrid realtime-turn based model since the combat mode was not being kicked until the projectile animation was over, it was possible to affect the flow just by moving around evading the projectile while on exploration mode.

ranged2

Plans for M1 are looking good, this is the list of pending tasks:

  • Implement “triggers” in combat based on a number of turns passing.
  • Transport to another map via trigger outcome
  • Fix bug: NPC interaction depending on having pressed a key
  • Fix bug: Crash when all party members killed
  • Add indicator for party member’s HP (New)
  • Fix conflict between party members and friendly NPCs in combat

All this should be done by the end of the week.

I’m also in the process of setting up a website for the project. This includes it having a logo, so if you think you can contribute with a cool looking logo, please let me know 🙂

OpenArthurianX6 – SkyBox tweaks

Back to development!

Added a mask for the celestial bodies on the skybox, tried first with a sprite mask but then realized a simple rectangular mask would work just as well.

Next up was sky color, dug up a very old sky color calculator thing done originally for Pixal in 2009

Screen Shot 2018-09-22 at 1.54.11 PM

Also found these notes which seems I used to code it :

atmosphereBase: Universe is black always, right?

lightStrengthForTheHour (Sun)

       0.0 ----------> 0.3 0.7 0.9 ------> 1.0 ------------------> 1.0 ------> 0.9 0.7 0.3 --------->
 HOUR  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21  22  23

baseLight: Stars emit white light.

It seems like the core of the tool is an interpolation function for these values, coupled with some research on how light works in the atmosphere (over-simplified of course). I went ahead and used the original old source code (probably one of my first works in JS) and transformed it into a decent module. It’s now integrated into the engine, in theory, this would allow to change some attributes of the atmosphere and have the color of the sky respond (small details, but it’s fun).

Screen Shot 2018-09-22 at 10.58.53 PM

Also allowed defining items for the NPCs, which allows Shamino to fire arrows.

Been considering how the UI should work (full-screen map vs. a layout similar to U6). For now, I think I’m going to continue on the route to create an exult/nuvie-like layout with floating windows. This also means much smaller reliance on the events log/messages window for things like combat, the damage will instead be shown on screen, for starters.

Another thing I’m considering is merging MobTypes and NPCDefinitions, I see a lot of overlap there, and it’s causing the code to be more complex than it should, what I’m thinking is a single list, so you’ll be able to define what a generic skeleton is, and in the future make spawners for them, but in the same set of definitions you would have for example Shamino, including his full dialog and initial equipment the current way things are laid out you reference a mob type from the npc definitions, but I’m finding out that most of the times you will not reuse an existing mob type….

Unless maybe if we need to have a lot of NPCs, reusing the same basic definition for a “townsman” or “children”… gotta think about this more before making the moves in the code