• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Development] 2D Platform game

Status
Not open for further replies.
Sup guys, it's been a while. :)

I'm working on something new these days, and I made huge progress in my game developing "carrier".


As you can see on screenshot (attachment down below), it's 2D platform game in really early stage and so far I finished with things like:
- Movement and jump system
- Animation
- Gravity
- Collision

There are screens (for example main menu) and few more things worth mentioning like map-generating scrips that load levels from different files and so on.

I'm pretty much done with basic stuff, core things still missing are enemy units, items (coins and such) and object you can interact with (doors, keys, chests etc).

I have very nice ideas, terrain and whole design support multi-layer patter (not shown right now) that will add depth into the game view. There will be UI as well (need to hide blue text :p ).

I'm open for suggestions, critics, new ideas.

Have a nice day.

Update (10-Jan-15): Added Editor and Editor1 image.
Update (15-Jan-15): Added Youtube video.
 

Attachments

  • Untitled.png
    Untitled.png
    174 KB · Views: 351
  • Editor.png
    Editor.png
    201.5 KB · Views: 2,562
  • Editor2.PNG
    Editor2.PNG
    396.5 KB · Views: 773
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
How are you planning to support (or if you already do) slopes?
That's where the code becomes messy.

I am also making a 2D platformer, so we could share information if you want.

And just out of interest, are you using SDL/SFML/whatever for graphics, or OpenGL?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,195
How are you planning to support (or if you already do) slopes?
Does he not support them already? I mean he does not seem that racist...

Joking aside angular terrain would fall under variable collision shapes. This would mean some form of vector based collision geometry instead of a simple bitmap.
And just out of interest, are you using SDL/SFML/whatever for graphics, or OpenGL?
Who says he is going cross platform? He could simply be using Direct2D or 3D seeing how it is for Windows. That said it is a good idea to abstract the graphics enough that a new front end could be written if porting is required.
 
Right now I use grid like structure (so no slopes) to handle collision.
It's somewhat messy but I'm still learning. And yes there is a way (so far I can think about this one), usually called perfect pixel collision, where you basically check specific pixels intersecting objects.

I'm codding this in C# using XNA tools. Right now it's easier for me to work on Windows, but I will switch to mono easy, when I make some huge progress worth distributing it on other operating systems.

@GhostWolf, I will gladly check your project. In fact, health competition can't hurt right.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Having a uniform grid doesn't mean you can't support slopes, they just need different handling.
I myself have slopes implemented such that they have two Y offsets, one at each end, where 0 means the top of the tile, and 1 the bottom. So, [0,0] is a normal tile, [1,0] is a 45 degree / slope, and so on.
This supports any angle between 0 and 45 (didn't bother with slopes that end mid-tile, although supporting them isn't hard either).
Of course, the logic of the collision detection needs to be changed, because slopes are tiles that you can get into without colliding, while also needing to collide with them under some conditions.

A bonus of having semi-generic slopes like this (instead of say fixed low/high slope), is that you can query pathing for walking enemies quite easily, by just checking if the offsets of two adjacent tiles match where they connect.
So if you have a 45 degree / slope, and then a regular tile, you know that the offsets where they meet are both 0, and so it's the same floor level.
But I don't know if you'll actually need this (probably you will though).

My project isn't open source, but I wouldn't mind talking about implementing different entity types, and having them dynamically configured in a level file.
For me, everything beside the players is just a normal entity object, whether it's a key, button, door, moving platform, melee enemy, ranged enemy, and so on (and in fact you could mix and match to have a moving button, or an enemy that you can grab and use as a key, or any weird thing like that too, if you so desire).
Each entity is just a set of attributes and components that tells it what to do, and which you can define dynamically in the level file.
 
I load pathing from separate data container and it's grid based. It works right now and I won't bother improving it before I finish with other stuff.

My current goal is to make this game working for level 1 only. Then I will see what can be dynamically handled so I can load that from file. Once I got into that stage, I will create Map Editor for my game (Windows Form Application) and I will handle maps (levels) from there.

I already gathered tutorials and resources needed, all I need is time and devotion.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
So based on what you wrote, I assume your grid is made of indices to a texture array?

My grid is made of indices to a tile type array, where each tile type defines not only the texture used by it, but also whether it is solid, sloped (using the aforementioned offsets), and all sorts of other properties.

In case you are interested, here's an excerpt of my JSON demo level, though it's a bit messy (I keep making it neater with time, though):
JavaScript:
{
    "LevelName":"Demo",
    "ViewSize":[42,18],
    "Gravity":[0, 25],
    "Samplers":[
        {"File":"tile.png"},
        {"File":"ltt.png"},
        {"File":"lts.png"},
        {"File":"rts.png"},
        {"File":"rtt.png"},
        {"File":"lbt.png"},
        {"File":"lbs.png"},
        {"File":"rbs.png"},
        {"File":"rbt.png"},
        {"File":"ltn.png"},
        {"File":"rtn.png"},
        {"File":"lbn.png"},
        {"File":"rbn.png"},
        {"File":"water.png"},
        {"File":"lava.png"},
        {"File":"acid.png"},
        {"File":"ladder.png"},
        {"File":"rockwall.png"},
        {"File":"end.png"},
        {"File":"yellowkey.png"},
        {"File":"pinkkey.png"},
        {"File":"yellowdoor.png"},
        {"File":"pinkdoor.png"},
        {"File":"yellowlock.png"},
        {"File":"pinklock.png"},
        {"File":"wood.png"},
        {"File":"button.png"},
        {"File":"teleporter.png"},
        {"File":"smoke.png"},
        {"File":"lavaspecial.png"},
        {"File":"fireball.png"},
        {"File":"atlas.png"}
    ],
    "TileTypes":[
        {"Sampler":1, "Solid":1},
        {"Sampler":2, "Solid":1, "VerticalDirection":3, "YOffsets":[1,0.5]},
        {"Sampler":3, "Solid":1, "VerticalDirection":3, "YOffsets":[0.5,0]},
        {"Sampler":4, "Solid":1, "VerticalDirection":3, "YOffsets":[0,0.5]},
        {"Sampler":5, "Solid":1, "VerticalDirection":3, "YOffsets":[0.5,1]},
        {"Sampler":6, "Solid":1, "VerticalDirection":4, "YOffsets":[0,0.5]},
        {"Sampler":7, "Solid":1, "VerticalDirection":4, "YOffsets":[0.5,1]},
        {"Sampler":8, "Solid":1, "VerticalDirection":4, "YOffsets":[1,0.5]},
        {"Sampler":9, "Solid":1, "VerticalDirection":4, "YOffsets":[0.5,0]},
        {"Sampler":10, "Solid":1, "VerticalDirection":3, "YOffsets":[1,0]},
        {"Sampler":11, "Solid":1, "VerticalDirection":3, "YOffsets":[0,1]},
        {"Sampler":12, "Solid":1, "VerticalDirection":4, "YOffsets":[0,1]},
        {"Sampler":13, "Solid":1, "VerticalDirection":4, "YOffsets":[1,0]},
        {"Extends":"Water", "Sampler":14},
        {"Extends":"Lava", "Sampler":15},
        {"Extends":"Acid", "Sampler":16},
        {"Sampler":30, "Solid":1, "VerticalDirection":4, "YOffsets":[1,0], "Collidable":1}
    ],
    "EntityTypes":[
        {"Extends":"Ladder", "Sampler":17},
        {"Extends":"RockWall", "Sampler":18},
        {"Extends":"Teleporter", "Sampler":28, "Size":[2,3]},
        {"Extends":"EnemyShot", "Sampler":31},
        {"Solid":1, "Spawn":4, "SpawnSide":2, "SpawnDelay":2, "Size":[2,3], "Sampler":32},
        {"Solid":1, "Spawn":4, "SpawnSide":1, "SpawnDelay":2, "Size":[2,3], "Sampler":32},
        {"Extends":"Ladder", "Sampler":32, "AutoClimb":1}
    ],
    "Layers":[
        {
            "Depth":1,
            "Border":1,
            "Map": [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                        [1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                        [1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                        [1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,1,1,12,0,0,0,0,0,0,8,9,1,1,1,1,12,0,0,0,0,0,0,0,0,0],
                        [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],
                        [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,15,15,15,15,15,15,15,15,15,15,17,1,1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],
                        [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                        [0,0,0,0,0,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,1,1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                        [0,0,0,0,0,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,1,1,1,1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                        [0,0,0,0,0,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,1,10,0,0,0,0,0,0,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
                        [1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,10,0,0,0,0,0,0,0,0,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
                        [1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
                        [1,1,1,0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,12,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1],
                        [0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,15,15,15,15,15,15,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1],
                        [0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1],
                        [0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1],
                        [0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
                        [0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,1,1,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
                        [0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,1,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
                        [0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,12,0,0,0,1],
                        [0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,1,1,1,12,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,0,1],
                        [1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,12,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,0,1],
                        [1,1,1,0,0,11,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,0,1],
                        [0,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,0,1],
                        [0,0,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,0,1],
                        [0,0,0,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,1,0,0,1],
                        [0,0,0,0,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,1,0,0,1],
                        [1,1,12,0,0,0,0,0,0,0,11,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1],
                        [1,1,1,1,1,1,1,12,0,0,0,11,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1],
                        [1,1,1,1,1,1,1,1,12,0,0,0,11,1,1,1,1,1,1,1,1,1,15,15,15,15,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,13,1,1,12,0,0,0,1],
                        [1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
                        [0,0,0,0,0,11,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
                        [0,0,0,0,0,0,11,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
                        [0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1],
                        [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,1,1,1,1,1,1,12,0,0,0,0,0,13,1,1,0,0,0,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
                        [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,16,16,16,1,1,1,1,1,1,1,1,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,1],
                        [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,16,16,16,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,14,14,14,14,14,14,14,1,1,1]],
            "Entities": [
                {"Extends":1, "Position":[19,29], "Size":[2,6]},
                {"Extends":1, "Position":[42,25], "Size":[2,14]},
                {"Extends":1, "Position":[45,39], "Size":[2,6]},
                {"Extends":1, "Position":[53,33], "Size":[2,5]},
                {"Extends":2, "Position":[54,9], "Size":[1,3]},
                {"Extends":2, "Position":[5,10], "Size":[1,5]},
                {"Extends":2, "Position":[11,42], "Size":[1,4]},
                {"Extends":2, "Position":[44,36], "Size":[1,3]},
                {"Extends":"End", "Sampler":19, "Position":[51,28], "Size":[4,5]},
                {"Extends":"Item", "Sampler":20, "Position":[13,21]},
                {"Extends":"Item", "Sampler":21, "Position":[62,45]},
                {"Solid":1, "Sampler":22, "Position":[28,34], "Size":[1,2]},
                {"Solid":1, "Sampler":23, "Position":[44,22], "Size":[1,3]},
                {"Extends":"Button", "Sampler":24, "Position":[27,34], "Require":10, "Target":12, "Action":"Disable Solid"},
                {"Extends":"Button", "Sampler":25, "Position":[41,37], "Require":11, "Target":13, "Action":"Disable Solid"},
                {"Solid":1, "Sampler":26, "Position":[14,18], "Size":[5,0.7], "Keyframes":[[18.5,18]], "Speed":8, "KeyframesMode":0},
                {"Solid":1, "Sampler":26, "Position":[50,27], "Size":[6,0.7], "Keyframes":[[44.5,27]], "Speed":8, "KeyframesMode":0},
                {"Extends":"Button", "Sampler":27, "Position":[31,34], "Target":16, "Action":"Enable Keyframes"},
                {"Extends":"Button", "Sampler":27, "Position":[49,37], "Target":17, "Action":"Enable Keyframes"},
                {"Extends":3, "Position":[24,15], "Target":21},
                {"Extends":3, "Position":[30,27], "Target":20},
                {"Extends":3, "Position":[1,43], "Target":23},
                {"Extends":3, "Position":[60,41], "Target":22},
                {"Sampler":29, "Position":[36,17], "Size":[3,29], "ApplyForce":[0, -30], "ForceCutoff":[0,-5]},
                {"Extends":5, "Position":[9,26]},
                {"Extends":6, "Position":[62,14]},
                {"Extends":7, "Position":[36,25], "Size":[0.1,14]},
                {"Extends":7, "Position":[38.9,25], "Size":[0.1,17]},
                {"Extends":"EnemyChaser", "Sampler":32, "Position":[23,42]},
                {"Extends":"EnemyChaser", "Sampler":32, "Position":[57,35]},
                {"Extends":"EnemyShooter", "Sampler":32, "Position":[40,43], "LineOfSight":20}
            ]
        }
    ]
}
For reference, a sampler is a layer above texture, and it can define all sorts of properties not shown in this level (mirroring, rotating, scaling, texture atlases, etc.)

When something extends something else, it copies it's properties. In the case that it extends a string, it means that it's a predefined object created by the code, rather than the level file.
 
Exactly, I split tiles into texture arrays so I can display multiple layers, same for pathing, just like in WE, totally different array handles collision.

Right now I use txt file to store all this data, but C# allows me to easily use XML files with my project, that way I can handle attributes and/or properties of classes easy. I will try to make it simple as I said for now. Because it's easy to handle 10x10 grid with 5 different textures, try 100x100 + few layers + 20 textures etc. That's why I need working editor first, when I manage to generate map automatically, I won't care about readable txt files or whatever, I will let code do work for me.

I was working like 4-5 hours on Map Editor now, it's really simple at this point, I can move map freely, draw basic rectangles on it and it handles basic menu options (save, load...). I still have a lot of work in front of me. For start it will be somewhat hard coded, but in future I may made few changes to allow people to use their own data.

I will work on it tomorrow and hopefully create first level with it to show you guys some progress. Maybe even upload youtube video.
 
Finally after hours and hours of work I made progress.
As you can see on images:
http://www.hiveworkshop.com/forums/...142321d1420908646-2d-platform-game-editor.png
and
http://www.hiveworkshop.com/forums/...42322d1420909300-2d-platform-game-editor2.png
Editor allows me to easy "paint" maps for 2D games.

You can move whole drawing board, set tiles dimensions and much more.

I will now work on splitting map into layers that will allow me to use options like undo, delete tile and so on.
Then things left will be "new map" button setup, "options" buttons and such to handle different map sizes and configurations.
And finally saving (generating) files in specific formats that my game can read and load content from.
 
I will now work on splitting map into layers that will allow me to use options like undo, delete tile and so on.
Done.
Editor now supports multi-layer drawing.
It's also possible to delete textures from grid.
Drawing different textures on same layer will redraw existing texture with new one.
Add View menu with setup to turn on/off layers.

EDIT:

Save/Load is now completed as well.
Fuck yeah!

EDIT:

I have uploaded video, there you go.
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
The only weird thing for me is that layers are selected in the spritesheet selector, rather than in the editor.

On my game, I am at the point where I want to implement an in-game scripting language, and I am really not sure how extensive I want it to be.
Even with very simple things, I am starting to see how easy it is to have the same bugs and issues that Warcraft 3 has with globals and waits.
 
I added some properties to right click mouse button, so you can quickly select desired pointer and/or layer. But thanks for suggestion, will implement that into tool-bar on main window as well.

Hmmm I can see scripting coming probably, in some way at least (probably GUI like interface for start), but I'm still way behind you. Horrible collision system I use must be fixed asap, and I'm working on it right now. Then I will be finally able to move to entities such as enemy units and items like weapons, power ups etc etc.

I'm really interested in your project. Could you share some pictures, or at least part of story-line if any. :)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
There's not much to show, my only sprites are random stuff I got from google in 5 minutes, and there's the debug layer above everything (transparent blue overlay), but...here goes.

What can be seen there is ladders, entities spawning fire balls, teleporters, external forces (big and long thing in the middle pushes you upwards), climbable entities which you can wall-jump from (actually overlaying the walls on each side of that same big upwards force), keys (items), locks (open doors if you have the keys), buttons, entities with keyframes that start moving when the buttons are pressed, and two enemy types - one patrols from side to side, and chases the player if he can see and reach him, in order to melee attack, and the other shoots fireballs when he can see the player on an height level that will get the fire ball to hit him.

The nice thing is that literally all of this is defined in the level file itself.
The chasing enemies are merely entities with the Patrol, Chase and MeleeAttack components.
The spawners are similarity entities with the Spawn component.
The locks are entities with an action that is triggered when the player uses the use button, and it requires the player to have the matching key, and in that case, disables the target door's solid state.
And so on.

Even with this, a lot of the stuff can actually be implemented in scripting and be even less hardcoded, if I'll choose to go that way (especially spawning).

There is of course support for any number of layers, and a parallax effect, and even more obvious stuff like camera-centering which isn't seen, because the camera view (specified in the level file like all the rest) is set to the size of the level.

Right now I am in the process of changing everything collision-related to work with bitwise categories (much like Box2D if you ever used it).
That is, every entity has a category (I am a ...) and a mask (I can interact with ...), and I added also category based solid state (I can have solid collisions with ...) and category based one-sided state (I act as a one-sided platform with ...).
This means that many things become configurable, such as walls being passthrough for specific entities, specific entities being able to stand on other specific entities, and lots of other neat stuff.

This is all still in JavaScript though. Once I stop destroying half the code base every day in order to improve it, I'll probably transition to C++ and OpenGL.
 

Attachments

  • amazinglookinggame.jpg
    amazinglookinggame.jpg
    170.7 KB · Views: 257
GhostWolf you made quite a wonderful job so far. Are you using HTML5 Canvas to draw that?

I can see how your objects can be converted into anything needed and interacted with in any way, cool. :D

However, I have been busy with exams and school work these days, but I think, I managed to improve collision system, and added few more features to Map Editor, making it easier for use.

Having a little different idea, my game won't be, let say, static, in a why that each level is always the same (mario game as example), instead I will try to make it a little more dynamic with things like, monster spawns, different loot to collect and so on, making it different for every new run. Something like RPG games but on 2D surface. As I said before, have many ideas, just not enough time. That's being said, after collision my next field of work will be UI, and that include, HP, Mana, Exp bars, buttons and other shit needed.
 
Status
Not open for further replies.
Top