"NXBG" Hexagon-Multiplayer-Tactic-Game

http://188.165.235.130/nxbg/nxbg_2014_03_10.jpg

VIDEO:

oq-LycuXuSA

wjiJhYAEwGM

Hi there.
First, excuse my bad english (im a german coder).

As you can see in the video, im working on a multiplayer strategy/tactic game with my favourite tileset: HEXAGONS (one of my first played games was battle isle).

At the moment players are able to move (wasd) around the map.
Collision detection and jumps on/from blocks are working.
Multiplayer part (tested with up to 15 players) is working too.
Mapeditor (ugly, but only for me) is usable.

Next:

  • I have to create new Player-Models (as you can see, i used model & skins from minecraft).
  • Damage (via mouse-hovered fields on the ground)
  • Include “fractions” (there will be 3 fractions on every map, fighting each other, building structures)
    *** edit: i ment “factions” (thanks quew8 for correcting me) ***

next multiplayer-test-session: sunday, 16.03.2014 18:30 -> 19:30 (link will follow)

Looks very pretty (I like hexagons too). The lighting is very pleasant to look at but somehow I don’t think it’s actually lighting at all. At least not the conventional phong/specular etc. And I love how it took me several minutes to realize that random hexagonal columns aren’t natural formations. To me it gives the ambiance of an extremely playful game. I hope you’ll keep that aesthetic.

I’m curious as to whether you’re going to go for hexagon based players? I’m thinking of meshes made completely of hexagons. Might be really cool. Probably be super ugly. I’m no artist so I can’t quite imagine it. Maybe partially comprised of hexagon at least? Damn, you got me babbling about hexagons now.

So what does NXBG stand for? Would that be German for “Hexagon-Multiplayer-Tactic-Game?” Because if so you might want to think up a snazzier title too? Something about hexagons I’d guess.

Also in your post you wrote “fractions” whereas I think you mean “factions.” A fraction is that mathematical thing with a numerator and denominator. Like 1 / 2. A faction is a group of like-minded individuals working towards the same goals. Like NOD & GDI in CnC Tib Wars.

The above and the fact that there is no playable demo for me to indulge myself in are the only qualms I have so far.

Edit: Sorry I got a bit carried away there.

thank you for your answer and suggestions.
you are right: i ment “factions” - in german its “fraktion”, there the “r” is coming from ::slight_smile: - im sorry

the light isnt a real light - thats right 8)
im going through the webGL-interface to change the “vertice-colors” of every face of the terrainobjects (hexagon-columns).
so the “flat” bottom hexagons on top of every column are made of 6 faces with 3 vertices per face. every vertice could have a colour, that “overlaps” (does this word exists ???) the basic-texture.
so im calculating nearby hexagons and change the color of every vertice on every face on every hexagon, depending of the fields nearby.
this is done once at start. so i manage 60FPS (this time, more objects will follow and eat performance :persecutioncomplex:).

if you have questions, please ask.
i need this resonance, it holds my motivation up :smiley:

the name “NXBG” is just a working title - “nx” is my nickname in games, as dj and as coder :slight_smile: (nx comes from ennix - long story…)
im searching for a good title. but there is much time to do this.

Looks really good.
Am interested to see what you have in mind for building structures and how they affect the game.
Keep up the good work :slight_smile:

Hi, and thanks for your answer / question!

i wanted to wait with more infos, cause im not sure if all these ideas find into the final version. but here are more details:

There will be a huge world (lets call it a lobby with graphic interface) with different maps (different biomes. snow, lava, desert, isles, …).

static structures:
on every map are structures/locations like: “sentry”, “supply-camp”, “bridge”, “tower”, “fort” up to big castles.
all these locations have “claim-spots”. a small sentry has one claimspot. the big castle has 5 or more claimspots.
if players of one faction stays inside this (simultaneous in all spots of one location), the claimspot will slowly raise to 100% (if all players are alife and out of fight inside the spots ;D)
then this location changes the owner to the claiming faction. now the new owner can upgrade this location.
possibilitys like: make the sentry stronger, upgrade claimspots to need more time to complete claim, produce more supplys at a supplycamp, …
all this upgrades needs supplys from supply-camps… u know what i mean 8)

dynamic structures:
at many spots on a map, players can build barricades between 2 high “columns” to make it easier to defend some towers or the castle…

all this differs from map to map.
there are small maps, where 5-10 players can get a lot of points for there faction.
and big maps, where (i hope) “zergs” of 40 and more players are fighting the same time :o

i have a lot of detailed features in my head 8)

at the moment i work at the combat-system.
i would say, i have a flow.
give me 2-3 days, i will upload new pics and video.
maybe i can give out a link to test the game.

at this sunday 16.03.2014 between 18:30 and 19:30 i turn on the server to make another multiplayer-test.
you are welcome :slight_smile:

there is a lot of work to do :slight_smile:
its a one-man project :persecutioncomplex:

i added 3 more screenshots.
as you can see, there is the first attempt of including combat-system (on the lower left :persecutioncomplex:)
and i used different views to show the possibilyties of this engine.
every field (hexagon) has values for cameraHight, cameraDistance, cameraLookAt to use for different locations (inside castle, dungeon, canyons…)

http://188.165.235.130/nxbg/nxbg_2014_03_11_1.jpg

http://188.165.235.130/nxbg/nxbg_2014_03_11_2.jpg

http://188.165.235.130/nxbg/nxbg_2014_03_11_3.jpg

This looks interesting…

[trolly]
this would be so mutch better with boxes =D… if you get it [obs] not meant to offend you

[real]
this is cool really cool cus i cant even create a 3d box in java 3d XD

ennix : appoligizes for bad english, and then speaks almost perfectly.
VIrtueel : native speaker, impossible to understand.

Keep it on topic, please.

Good looking stuff. I like using hex-tiles too.

Couple of questions:

  • How are you doing your hit-testing?
  • What scheme are you using for your hex-coordinates?

thanks for your questions.

first the hit-testing answer:

there are two types of render-objects:

  • fixed objects (only terrain, with precalculated shadows using vertex-coloring the faces), this is merged as one big object to improve performance.
  • dynamic objects (player, portal-objects, obstacles like barricades), these are all separately added to the scene.
  • a mixture of both for the “hover-hexa”, the hexagon-texture (6 faces) on the top of every hexa-column. this is the important object to get the position for all actions.

i check all the intersected objects by using a raycast from mouse-pos to the 3D-scene, after i converted this to 2D.
so i know at which dynamic object my mouse-cursor points.
if it points on an “hover-hexa” i can get the x/y pos of the 2D hovered position in the 3D world.
(i assigned names “xPos/yPos” to every hover-hexa when i first render the map).

now to your question:
i dont check the detailed position of all players.
every player has a hexagon-position (x/y) on the map. as i know the hover-hexa-x/y position of my mouse, i know which player(s) i can hit.
now the “trick”. i dont use single player-shots in the game.
all positive actions (healing, speedup, stealth, strengthUp, …) and negative actions (poison, slowDown, fireCondition, …) are actions only on the hover-hexas.
so the players “throw” fields with actions on the hover-hexas.
every player who is in this action-field is affected by it…

ever action has values for duration, intensity,… so players can stack this actions at one field.
this prefers group-players: one throws chains to constrain players, the other one throws his upskilled fire-damage field on the victim :slight_smile:
(btw: every player can only take 8 different actions in his action-slots to use in combat. but can change this actions at his base)

i hope, i have explained it understandable :slight_smile:


second question (hex-coordinates):
on my first attempts i used axial-coordinates. but after many hours/days of testing different situations i decided to use offset-coordinates.
its much easier to store (not that huge array-overhead), and the little workarounds (usually mod-functions) are good to handle.
btw: this site ist great when using hexagons: http://www.redblobgames.com/grids/hexagons/

i wrote some little helper-functions to get the adjacent hexagons. so the new shadow-calculations (improved since the last screenshots) are easier to handle.

new Video (this time with free cam-mode - for editing), better shadows, new textures and first use of the new mapmaker (png-heightmap to database plus fine tuning via ingame-editor):

wjiJhYAEwGM

i’m proud to announce, that many new features have found there way into the game.

  • when starting the game (just open the link in browser), you will be assigned to 1 of 3 factions and spawn in the right base
  • you can use 5 different actions (lavafountain, healpuddle, chains, fireball and speedup) by “throwing” it on fields below other players
  • these actions will affect depending on there values friendly or enemy-players
  • some (ugly) bars for showing values like health, move-points, attack-points (and 2 other types mana+support)
  • finally i improved the map with some cool terrain structures like caves, hills and lakes

i will tweak the performance, so we can do the testsession tomorrow with ~20 players (i hope)
server is online from 18:30 till 19:30, no download needed. runs in browser.

greets!

wow.

thanks for testing. this was fun!

i got dozens of ideas (and bug-reports).

next test will follow.
now i have to sleep.
cu

Interesting. I followed a similar path as well: separating the terrain features from more dynamic features. How do you efficiently hit-test the hover-hexas though? In my implementation (400x400 hexes) I used an oct-tree with axis-aligned bounding boxes for the fixed terrain. I then ray-cast as you do. As for the dynamic entities I still iterate over each and every one but I figure that I won’t have more than a couple hundred on screen max. I thought about your tip of tying a dynamic entity to a hover-hexa but it doesn’t account for smooth animation transition and/or flying.

Do you apply radius as well e.g. an AoE could affect 1 tile (radius 1) or 7 tiles (radius 2)?

Interesting, I’m using his axial-coordinates (see code comment below). Calculating distance is really straight-forward. Can you expand a little more why you found it troublesome? I had no trouble with distance, hit-testing, and A* path finding. Was wondering about storage though because the diagonal offset is awkward for rectangular maps.

Thank for pointing to Amit’s site. He’s really improved it since I looked at it a few years ago.


A hexagonal tile grid is actually a projection of cubes onto the plane where
x+y+z=1.  Representing a coordinate in 3-axis (each 120 degrees apart) has a
few benefits.  For example distance calculations are much simpler.

I choose to orientate the hexes with a vertex on top.  If I wanted to display
an English word using tiles then it would be horizontal.

Absolute hex coordinate: i,j,k



               / \     / \     / \     / \
k axis        /   \   /   \   /   \   /   \         i axis
             /     \ /     \ /     \ /     \
    \       |       |       |       |       |        /
      \     | 0,-2,2| 1,-2,1| 2,-2,0|3,-2,-1|      /
        \   |       |       |       |       |    /
           / \     / \     / \     / \     / \
          /   \   /   \   /   \   /   \   /   \
         /     \ /     \ /     \ /     \ /     \
        |       |       |       |       |       |
        |-1,-1,2| 0,-1,1| 1,-1,0|2,-1,-1|3,-1,-2|
        |       |       |       |       |       |
       / \     / \     / \     / \     / \     / \
      /   \   /   \   /   \   /   \   /   \   /   \
     /     \ /     \ /     \ /     \ /     \ /     \
    |       |       |       |       |       |       |
    |-2,0,2 |-1,0,1 | 0,0,0 | 1,0,-1| 2,0,-2| 3,0,-3|
    |       |       |       |       |       |       |
     \     / \     / \     / \     / \     / \     /
      \   /   \   /   \   /   \   /   \   /   \   /
       \ /     \ /     \ /     \ /     \ /     \ /
        |       |       |       |       |       |
        |-2,1,1 |-1,1,0 | 0,1,-1| 1,1,-2| 2,1,-3|
        |       |       |       |       |       |
       / \     / \     / \     / \     / \     / \
      /   \   /   \   /   \   /   \   /   \   /   \
           \ /     \ /     \ /     \ /     \ /     \
            |       |       |       |       |       |
            |-2,2,0 |-1,2,-1| 0,2,-2| 1,2,-3| 2,2,-4|
            |       |       |       |       |       |


                        |
                        |
                        |

                      j axis



Note that the i and j axis mimic screen coordinates.

For painting purposes doubles may be used to interpolate between tiles and
in these circumstances, the coordinates are fi,fj.

Distances or relative positions on the horizontal plane are denoted by
di,dj,dk.

To convert to/from cartesian coordinates (see Displayed.java):
x = w * sqrt(3) * (i + j/2)    (note x can also be calculated from k)
y = w * (3/2) * j

where w = length of hex edge

hi,

thanks for your reply and questions.

after the online-test yesterday i figured out, that the moves from hex to hex are just a little bit too jerky and imprecise.
we played with 5-10 people and had some cool fights. but rotating in 60 degree steps is hard for players eyes when playing more than 10 minutes…

the system with throwing actions below the players is cool and works very fine. but players could escape too fast from this affected hexagon.

another problem is the performance when more than 1000 dynamic objects are at one map at the same time… like you figured out too.

i will discard the mouse-hover-hexa-system and try another way:
throwing actions (bottles with poison, fire, healthpotions, stealth-potions, slowdowns, …) could be done by aiming with mouse an click & hold to set throw-power = distance.
by calculating velocity+gravity (and some other factors) i know the position where it explodes on the map^^ maybe it could be hard to calculate cause of ostacles…
but this offers some new cool possibilities: players could use heavy cannons or other immobile weapons to defend towers/castles…
i will try and tell the results ;D

about your questions applying radius of effects:
yes, every action has its distance and a radius of affected hexagons.
but because of my failure, that the hexagons are too big (this time), the difference between radius 1 and 2 is much too hard.

with my next engine-try (this week), i will use smaller hexagons to get better aoe-results. but now i have to discard the hover-hexas, cause they are dynamic-objects…
another big step will be this change: i discard the moving from hex-center to hex-center and try a pixel-accurate moving over hexagons. this will cause heavy-brain-pain because of a harder collision-detection,
but i will give it a try :o
my first idea to solve this is: i just check collision like circle vs circle :slight_smile: player is a circle, and the smaller hexagons too ::slight_smile:
i will try and post my results.

about the hex-coordinate-system:
when using offset-coordinates, the important thing is the right using of some mod-functions. if you mastered this, it will be like easy x/y rectangle coordinates.
dont underrate the problem with the storage of your map. especially when using chunks on bigger maps.
and distance-calculations with offset-maps is easy like hell :slight_smile: same as getting neighbor-hexas…
by playing with small hexagon-samples - amit is right on his page to use the axial-system - i tried all the ways and i finally arrived at the offset-system :slight_smile:
i will use this. u can use any other system :slight_smile:

well, its time to start an improved engine-try.
people wait for next test on sunday 23.3. ;D

greets from germany

if someone is interested in some short-term online-tests or other developing things and big progress-jumps feel free to send me an email: marcel at nxserver.de
i will invite you for next tests. no worrys about spam - i dont have the time to write many emails 8)

Thanks for the response, I love talking hexes!

The hover hexes can be static. What I did is that I stored the center point of each hover hex. Then I constructed an oct-tree in normal 3D space. From here a hit test occurs if the ray is within a certain distance of the point. Of course this isn’t pixel exact (testing a circle rather than a hex) but in my experience it’s close enough.

Hrmm… can’t you just move the camera farther away? ;D There might have to be larger differences in height to compensate.

As for radius 1 (1 hex), 2 (7 hexes), 3 (19 hexes) it definitely is an interesting problem coming up with a good AoE gradient.

I’ll fire off an email to you. Definitely interested in testing your game.

hi.

you pointed to an interesting idea with the distance-system.
i played around the last 24h :persecutioncomplex: and got a good solution to increase performance and get a very good feeling when throwing actions below other players.
i will work hard the next days and present the new version.

thank you loom_weaver!

also your second idea to move the camera farther away is as simple as brilliant… i think programmers often lose sight of the wood for the trees ::slight_smile:

i will keep you inform about progress.

the last engine-version suggested 2 and more layers to move on. but there was only 1 ground-layer with different heights and another above, but not to go on.
with the new hexa-engine-version i will try to add gravity and (quasi) infinite layers, so players can walk above and below other players :expressionless:
i will give it a try