maanantai 25. heinäkuuta 2016

Background image and camera following player



So today I added a background image and made the camera following the character. Each client now gets the info about which character it is controlling, that was not needed before. Also modified sprite drawing so that the sprite textures can have different sizes. Thinking about using Kenney assets to make the game look better, first I would have to add loader for sprite-sheet XML descriptions. Probably it would be helpful to add materials to a database.
I'll be travelling for next two weeks, there will probably be no progress during that.

perjantai 22. heinäkuuta 2016

Today's progress

Made the socket.io server secure, it was very easy, just had to use https instead of http. Worked on Ethereum stuff, added support for delegated messages in the game server. This way the player does not have to interact with Ethereum directly. Here is a snippet showing how it is supposed to work:

    function delegateConnect(address snd, address addr,
                             uint8 v, bytes32 r, bytes32 s) {
        bytes32 hash = sha3("connect", snd, addr, nonce[snd]);
        if (!connection[sha3(snd,ecrecover(hash, v, r, s))]) return;
        nonce[snd]++;
        delegations[snd]--;
        connection[sha3(snd,addr)] = true;
    }

Next week I'll make the camera follow the character in the game, and support for background images in levels.

torstai 21. heinäkuuta 2016

Some progress on Ethereum backend

I managed to make a page where it is possible buy shares and connect accounts. I used eth-lightwallet, ethereumjs-accounts doesn't seem to work anymore. I'm thinking about switching to use simply web sockets instead of socket.io.

Also worked on uploading contracts into testnet, best way seems to compile using solc npm package. Then I upload the contract and store the results to database.

keskiviikko 20. heinäkuuta 2016

Fireballs


Modified the fireball so that it now destroys enemies. Also made fireball power-up item that is needed to shoot the fireballs.

On the back-end side, I'm working on Ethereum integration. The idea is that anyone can run a server, but there is still a single identity for players. There are also rewards for best levels. Started writing a contract, and got a node running in the Ethereum testnet.

tiistai 19. heinäkuuta 2016

Linking accounts

I didn't have much time today, but still implemented linking accounts. Linking accounts is useful so that the secret key doesn't have to be copied around. I think I'll implement better fireballs tomorrow, and hopefully some other stuff.

maanantai 18. heinäkuuta 2016

User Login

Today just added simple user login. Authentication is implemented using elliptic.js. It is not really very secure, because the web page is in full control of the key, perhaps there is a plugin or something that could help. Next I'll have to add a way to link several keys with an account. Should not be too complicated, but I'll be otherwise busy tomorrow.

perjantai 15. heinäkuuta 2016

Hazards


Today I made the monster more dangerous and added fire. When the player dies, it just respawns in the same level. Also added some sound effects. Just used Bfxr to make the effects. Monday I'll work on user management and registration.


torstai 14. heinäkuuta 2016

Level editing



I added a dialog for selecting which type of element to add, so now some basic level editing can be made. Also removing elements works. I decided to have a selection tool for selecting the elements, and also added inspecting the properties of the selected element to the dialog. Different kinds of elements have different properties, and these properties should be editable. A useful feature is that a coordinate property can be selected from the screen.
The edits are sent to the server, and the server updates the properties. Next I made a dialog for editing level properties. For now it is only possible to choose a name for level and then save it to the database.
Next I'll make the monster more dangerous and add some environmental hazard like fire.

keskiviikko 13. heinäkuuta 2016

Multiple levels

There was only support for one level on the server, so I had to refactor it. Basically I had to associate the players with levels. I also added storing and loading the levels from MongoDB. Everything seemed to go smoothly.



To see if multiple levels really work properly, there must be portals between the levels. I got one problem here, but it was a silly bug where I had = instead of ==. Next I added spawn points for levels. If there is no spawn point, the player will spawn at the same point it was in the previous level. The game runs surprisingly solidly considering how sloppily I have coded it. Next I'll add a dialog to select tools for level editing.

tiistai 12. heinäkuuta 2016

Locked doors


Today I added locked doors, so that the player will need a key to open them. I decided to keep the door in the collision map even when it is open, there is just a flag that tells that it wont collide with anything. Perhaps this will be a good decision, if I need to search for objects in an area.

The next step will be adding support for multiple levels, and portals between levels. I'll probably use MongoDB to make the levels more persistent.

I also made a grid to make editing levels easier. When the grid is on, the added elements will be added aligned to the grid, otherwise they will be added freely. Easiest way to add a grid is using THREE.PlaneGeometry with a wire-frame material. The formula for aligning into grid is ⌊v/λ+1/2⌋λ where λ is the grid size. I use rounding instead of floor because the my objects are centered to their position i.e. if the position of an object is (200,200), then that is the position of their center.


Platformer Game

The plan is to make a simple co-operative online multiplayer platformer game. Currently there is a simple graphics engine and a way to check collisions for AABBs. The online code is basically the simplest possible, there is no interpolation etc. The sprites are drawn with one draw call, not sure yet that there will be enough elements so that it makes a difference in performance.