Author Topic: XNA 3D Hex Map system  (Read 85369 times)

Trent

  • Sergeant
  • *
  • Posts: 190
XNA 3D Hex Map system
« on: 22 August 2011, 14:35:31 »
First, hello everyone! I'm new to the board.

I've been interested in Battletech for .. ohh.. 25 years? Been messing around the last few days with a 3d hex game engine (which I'm writing from scratch). I've played MegaMek a few times (faster than playing on a tabletop) but it's .. sluggish.

After 4 days I've ended up here:

(Threw some freebie 3D tank & tree models in to start out my terrain object / unit engine) 


Zoomed out on map size 40


Zoomed out on map size 320



So far I only have the basic camera, texture, heightmap, and specular lighting engine done. But, considering I've only had 4 days to work on it, and it's my first attempt at a 3D game..  I think it's going rather well, all things  considered. Still need to do bumpmapping, water, skybox,  multiterrain, etc etc.. lots of work. :)

The large map shown above is currently rendering at 60fps on a 460gtx / i7. It's built in MS XNA4 on the .NET framework with DX10+ compatibility - meaning, the engine will compile and run on XBox or PC.

The question I have is this... what is "legal" with regards to licensing the Battletech engine as it pertains to computer games?

FYI I own a software company, but so far, this is just a side-project as a hobby.


cavingjan

  • Spelunca Custos
  • BattleTech Volunteer
  • Major
  • *
  • Posts: 4470
    • warrenborn
Re: XNA 3D Hex Map system
« Reply #1 on: 22 August 2011, 14:45:45 »
Licensing would need to be directed toward Microsoft.

mbear

  • Stood Far Back When The Gravitas Was Handed Out
  • Major
  • *
  • Posts: 4507
    • Tower of Jade
Re: XNA 3D Hex Map system
« Reply #2 on: 22 August 2011, 14:50:26 »
Quote
The question I have is this... what is "legal" with regards to licensing the Battletech engine as it pertains to computer games?
Microsoft purchased FASA Studios, which was the electronic branch of FASA. So Microsoft owns the electronic rights for BattleTech. Last I heard they were licensed to Smith and Tinker, Jordan Weis' new company. Haven't heard anything else since though.

You might also be better served by looking in the Computer/Console Games board, or talking to the team behind MegaMek. They've probably got a better idea of what to expect.

And I'm sure eventually Bad_Syntax will eventually show up here and tell you his experience trying to get Microsoft on the phone to talk licensing.
« Last Edit: 22 August 2011, 14:52:19 by mbear »
Be the Loremaster:

Battletech transport rules take a very feline approach to moving troops in a combat zone: If they fits, they ships.

You bought the box set and are ready to expand your BT experience. Now what? (Thanks Sartis!)

Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #3 on: 22 August 2011, 14:52:02 »
This could get interesting then. My company is a Microsoft Certified Partner / ISV, so we may actually be able to get someone to tell us the time of day in Redmond. :)

Don't know how often company folk drop on the board, but from a legal standpoint does Catalyst / CBT have any objections to us working on this project, if it ever develops beyond the "personal use/hobby" level? It's one thing to say Microsoft holds licensing rights on software, but when we start talking about the content, types of units, rules, etc, that's a different story altogether.

Thanks in advance,

Trent

mbear

  • Stood Far Back When The Gravitas Was Handed Out
  • Major
  • *
  • Posts: 4507
    • Tower of Jade
Re: XNA 3D Hex Map system
« Reply #4 on: 22 August 2011, 14:54:14 »
This could get interesting then. My company is a Microsoft Certified Partner / ISV, so we may actually be able to get someone to tell us the time of day in Redmond. :)

Don't know how often company folk drop on the board, but from a legal standpoint does Catalyst / CBT have any objections to us working on this project, if it ever develops beyond the "personal use/hobby" level? It's one thing to say Microsoft holds licensing rights on software, but when we start talking about the content, types of units, rules, etc, that's a different story altogether.

Thanks in advance,

Trent
Herb and Randall don't appear on these boards very often. For questions like yours you should probably ask on the "Ask the Line Developer" board.
Be the Loremaster:

Battletech transport rules take a very feline approach to moving troops in a combat zone: If they fits, they ships.

You bought the box set and are ready to expand your BT experience. Now what? (Thanks Sartis!)

Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #5 on: 22 August 2011, 15:19:31 »
Microsoft purchased FASA Studios, which was the electronic branch of FASA. So Microsoft owns the electronic rights for BattleTech. Last I heard they were licensed to Smith and Tinker, Jordan Weis' new company. Haven't heard anything else since though.

You might also be better served by looking in the Computer/Console Games board, or talking to the team behind MegaMek. They've probably got a better idea of what to expect.

And I'm sure eventually Bad_Syntax will eventually show up here and tell you his experience trying to get Microsoft on the phone to talk licensing.

Yeah, implementing the rules are a massive undertaking. I've got another .NET project which I'm working on that allows building of Mechs/Vehicles/etc, uses a MySQL DB for data storage (so DB's are portable and lets me make use of relational data). The construction rules are pretty intense, though.

MegaMek is a great program, but limited on # of units, etc. I've got a powerhouse of a system and a 12v12 against the AI takes literally all day. I've always dreamed of building a 3D hex engine (I'm a strategic war buff). Market for games overall has declined greatly, and something like this is so niche that it really is limited to "people like us", so there's no money in it, but that's fine by me. This doesn't feel like work, and it's relaxing. :)

I'll probably end up using the engine (once I've got all the mapping pieces finished, line of sight, pathfinding, etc) for something a hell of a lot simpler than BattleTech at first. However, that's where I want to eventually end up.

Depending on where things end up I may just put the completed XNA 3D hex engine under GPL and gift it.

Bad_Syntax

  • Lieutenant
  • *
  • Posts: 918
    • Battletech Engineer
Re: XNA 3D Hex Map system
« Reply #6 on: 22 August 2011, 15:46:17 »
I did something very similar to this a few years back.  I did it all in .NET, but didn't use XNA.  I essentially had all the BT maps at the time as little 16x17 pixel images.  One for height, one for terrain.  Then I could load any number of them up in 3D, paging them as necessary.  I had trees, rocks, rubble, bushes, different terrain, water, and it ran ok.

3 things stopped me from making something of it:
#1.  I had no graphics I could use (hexagon textures mostly).
#2.  I had no models I could use (I had a single animated Votom, a Warhammer, and a Stinger, that was it).
#3.  Lack of motivation.

If I would have had 2 of 3 of those, I may have done something, heck, even today if I had 2 of 3 of them I'd probably do something.

Implementing the game rules are a very daunting task, I wish you the best of luck.

I'm much more interested in a strategic game, down to say company level (with individual units represented, but not controllable outside of a company/trinary level).  I am trying to hold out for IO to come out, but I may just jump the gun and write my own game engine as IO is a long time coming, and the previous ISIF rules were as broken as rules could be.
Battletech Engineer
Disclaimer:  Anything I post here, or anywhere else, can freely be used by anybody, anywhere, for any purposes without any compenstation to or recognition of myself.

Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #7 on: 22 August 2011, 17:35:40 »
I did something very similar to this a few years back.  I did it all in .NET, but didn't use XNA.  I essentially had all the BT maps at the time as little 16x17 pixel images.  One for height, one for terrain.  Then I could load any number of them up in 3D, paging them as necessary.  I had trees, rocks, rubble, bushes, different terrain, water, and it ran ok.

3 things stopped me from making something of it:
#1.  I had no graphics I could use (hexagon textures mostly).
#2.  I had no models I could use (I had a single animated Votom, a Warhammer, and a Stinger, that was it).
#3.  Lack of motivation.

If I would have had 2 of 3 of those, I may have done something, heck, even today if I had 2 of 3 of them I'd probably do something.

Implementing the game rules are a very daunting task, I wish you the best of luck.

I'm much more interested in a strategic game, down to say company level (with individual units represented, but not controllable outside of a company/trinary level).  I am trying to hold out for IO to come out, but I may just jump the gun and write my own game engine as IO is a long time coming, and the previous ISIF rules were as broken as rules could be.



I'm not really looking for ground-breaking, eye-popping graphics. Circa 1995 is good enough for me. :)

There's a ton of free models out there to use for clutter, bushes, trees, etc; the trick is finding low-poly count ones, as artists who upload models for free tend to go way overkill (as they mostly use it as an example of "hey look what I can do". Those trees in the screenshot, for example, were free, but have over 60k polygon count, as every single leaf is drawn! So I can't draw too many of THOSE on the screen - think I have it set at 200, which are randomly assigned to the hex grid as the map is created.  Meanwhile the tank was a very low poly count mesh, with an independent turret for rotation. It was also a free download in a pack that contained a helicopter and some other stuff.

I was planning originally to use only a few graphics for units - one mesh for each unit type, basically.

Just finished a basic height-based texture map shader:



Haven't implemented a shadow shader yet - those are a bit daunting.

Skybox next, then water with reflection, then ... god it never ends. I don't know if I can do this solo, unless MAYBE I plan on finishing it sometime around my 70th birthday. :)

Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #8 on: 22 August 2011, 17:40:29 »
I also tweaked my random terrain code to make hills work sort of "together".. a certain % are elevation 0 (water, which eventually will go negative).  Elevation 1 is ground level. A certain % of elevation 1 is made in to elevation 2, then it makes several passes for each additional "height layer", checking the neighboring hex heights to determine if it should be part of a hill. If it is part of a hill, 50% likely it goes higher.

That way it's much harder to get random outcroppings .. possible still due to some glitches with even-row offsets, but the maps are looking more "natural".


ShadowRaven

  • Lieutenant Colonel
  • *
  • Posts: 8159
Re: XNA 3D Hex Map system
« Reply #9 on: 22 August 2011, 17:49:07 »
so far I would say that's looking pretty cool. Are you familiar with the game "Scorched Earth 3D"?  It has an ability to view the map with essentially a free floating camera, which I feel would be a must for a game like this.
We are Clan Snow Raven. Masters of the void, and reapers of your souls

befriend (v.): to use mecha-class beam weaponry to inflict grievous bodily harm on a target in the process of proving the validity of your belief system.
— From a post on rpg.net

Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #10 on: 22 August 2011, 17:58:23 »
Played that a few times. For that mater, I played that when it was 1992, I had a mullet, the largest hard drive on the market was a 540GB that cost $330, and it was still a 2D game. :)

I tossed the models in for some clutter, but the only purpose I have right now is to make the engine, not a game. Games can come later and take any form. What I want is a platform for building hex based games (in XNA) of any sort - I've got a lot of WW2 boxed sets from a looooong time ago I could convert to PC (Panzer Blitz, Stalingrad, Blitzkrieg, Rise and fall of the Third Reich, etc).

Many of those are far simpler than Battletech, with stricter rules sets, and would let me cut my teeth on creating an actual game without a crapload of unneeded complexity. But the engine would be common between them; movement, pathfinding, ranged combat (line of sight, modifiers for terrain type), and so on. I need a library of functions on the basic engine I can pull from so later I can pull off functions like CalculateDistance(HexStruct StartHex, HexStruct DestHex), have Interfaces built that'll guarantee compatibility for units (i.e. all units must have a facing, a mesh, all must have the same properties and functions for the interface to use such as "AllowMovementWater", etc)


Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #11 on: 22 August 2011, 18:00:11 »
PS the camera is free moving right now, but I've built it to work like a normal strategic game. You can use CTRL+Mouse to rotate around and pan the pitch angle up & down, mousewheel zooms in and out, and the edges of the screen will pan your view relational to the camera direction. It feels right.

PeripheryPirate

  • Warrant Officer
  • *
  • Posts: 686
  • Your friendly neighborhood Periphery pirate!
Re: XNA 3D Hex Map system
« Reply #12 on: 22 August 2011, 20:35:35 »
Lookin' nifty. I had an XNA class back around the new year, and it was fun. I've dabbled in it a bit since and even made my own 2D game when I had some time to spare earlier this summer, but I'm back to a busy schedule so my tinkering is limited.

Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #13 on: 22 August 2011, 21:33:50 »
Water done, including fresnel effections on refraction / reflection, and bumpmapping. :)



Now if I could only solve that "Trees growing out of Tank Turret" problem... :)



(Maybe he's just hiding...)

Shijima_3085

  • Warrant Officer
  • *
  • Posts: 516
Re: XNA 3D Hex Map system
« Reply #14 on: 22 August 2011, 21:56:04 »
"Don't shoot me.  I'm a bush.  Nothing to see here.  Nothing but us bushes."

Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #15 on: 22 August 2011, 22:27:09 »
It's the patented new "Stealth Armor" tank - the Shrubbery Mk 1.

Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #16 on: 22 August 2011, 23:02:08 »
Specular lighting and the water makes beautiful waves that move ... and I'm done for now. Have to go work my real job the rest of the week. :(



Kind of surprised, that water turned out pretty sexy. :)

Got quite a lot done so far .. today wraps up day #5.

Hopefully I'll have more updates next weekend1

jh316

  • Warrant Officer
  • *
  • Posts: 407
Re: XNA 3D Hex Map system
« Reply #17 on: 23 August 2011, 09:47:28 »
Hell, even without rules implemented this would be a nice thing to release as a tool for GMing online. I know I prefer doing my own rolling so I can add modifiers on the fly which megamek can't do. Can run battleforce on it, too. A version using squares could be done for Quickstrike (It's easy to convert quickstrike to 1 square = 1 inch).

hellghost

  • Recruit
  • *
  • Posts: 15
Re: XNA 3D Hex Map system
« Reply #18 on: 23 August 2011, 11:04:32 »
Very Nice Work ! I hope that the olde's of the license will say yes !

PeripheryPirate

  • Warrant Officer
  • *
  • Posts: 686
  • Your friendly neighborhood Periphery pirate!
Re: XNA 3D Hex Map system
« Reply #19 on: 23 August 2011, 12:48:40 »
A version using squares could be done for Quickstrike (It's easy to convert quickstrike to 1 square = 1 inch).

Only if you're moving in just four directions. Squares are terrible, measurement-wise, for moving any kind of diagonally.

Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #20 on: 23 August 2011, 17:06:28 »
RE: Squares.. there's a reason why (most) all wargames used hex based systems, and it's not just for equilateral movement - it also allows for more precise facing calculations. When you're dealing with arcs of fire, hit locations where armor factors may differ based on exposed side, etc, it is really a requirement.

There are cases where hexes flat out suck - consider the facing movement costs in Battletech. Unless you are moving up & down or diagonal, moving horizontally costs a LOT of movement points as you have to make a facing change every time.

The only other real option for strategy games is to use NO tiles whatsoever, to make it completely open. When you do away with hexes, it *does* solve a lot of constraint problems for line of sight, and other issues. For line of sight you just draw a line and if anything intersects, you have no line of sight.. However you have a great deal of other, new concerns (such as unit stacking, object collision, and so on.) As soon as you do away with a structured system for location & facing, you have to be a lot more tolerant of loose rules and arbitration thereof.

My original plan was to build a game that used a conventional smooth terrain map. However, I quickly realized that if I did that, it added a whole SLEW of physics questions I wasn't prepared to answer (no rules to back me up), such as calculating a slope, how much a unit slows or speeds up when traveling up or down a slope, what the maximum slope a unit can move on would be, and so on.

In the end I decided to start a hex engine because everything (well, MOST everything - there's some arbitrary rules dealing with line of sight when a line goes perfectly through two adjacent hexes).  Anyway, it can be defined in one way or another with an algorithm without bringing physics in to play, which means I can ultimately complete the engine more quickly and get to the good part (playing!).

New obligatory screenshot follows. :)



Need to go back and do some abstraction work and general cleanup before I do more features.. trying to figure out what to do with the horizon at the moment, then on to clouds, I think.

RavensPsi

  • Corporal
  • *
  • Posts: 53
Re: XNA 3D Hex Map system
« Reply #21 on: 23 August 2011, 17:20:34 »
Hello Trent
   This looks great. This could be used like a 3D Vassal. As a play by mail or even a play by post where you can keep track of both sides or used by a GM to send to both players. I am not saying that is what you have to do, but just showing that you wouldn't have to code the rule.

http://ourbattletech.com/
Clan Snow Ravens Psi Galaxy "Nevermore"

Talz

  • Sergeant
  • *
  • Posts: 189
Re: XNA 3D Hex Map system
« Reply #22 on: 23 August 2011, 18:09:56 »
Nice, this could be very interesting to watch.  [rockon]

Jackmc

  • Captain
  • *
  • Posts: 2681
    • How I pay the bills
Re: XNA 3D Hex Map system
« Reply #23 on: 23 August 2011, 18:22:12 »
The only other real option for strategy games is to use NO tiles whatsoever

No not really.  Octagons work /very/ well with the dead space between them serving as a place to lay chits or move-mod dice.  The only issue other than the art illustrating firing arcs is with the cost of facing changes, and a few test games of BT showed that a rule of "1 MP ='s up to 2 faces" works without issue.   

-Jackmc


Trent

  • Sergeant
  • *
  • Posts: 190
Re: XNA 3D Hex Map system
« Reply #24 on: 23 August 2011, 19:33:21 »
No not really.  Octagons work /very/ well with the dead space between them serving as a place to lay chits or move-mod dice.  The only issue other than the art illustrating firing arcs is with the cost of facing changes, and a few test games of BT showed that a rule of "1 MP ='s up to 2 faces" works without issue.   

-Jackmc

Never thought of octagons. Would be pretty hard to implement in code, though.

This is becoming kind of an obsession now. I got home from work and the first thing I did was plop myself down in Visual Studio. :)

New screenshot - just finished the most rudimentary of editing functions, terrain height modification. Now the maps can be made more "realistic" instead of random. Once I code some terrain overlays, and work up a save / load function, I'll be good to move on.

Oh yeah, the screenshot:



All I gotta say, is the entire time I was clicking cells to make that map above, I was saying to myself "I can't f'n wait...." - It's actually starting to look like what I envisioned in the beginning.  :)


Sartris

  • Codex Conditor
  • BattleTech Volunteer
  • Colonel
  • *
  • Posts: 20067
  • Cap’n-Generalissimost
    • Master Unit List
Re: XNA 3D Hex Map system
« Reply #25 on: 23 August 2011, 20:43:20 »
me gusta.  Keep us posted!

You bought the box set and are ready to expand your bt experience. Now what? | Modern Sourcebook Index | FASA Sourcebook Index | Print on Demand Index
Equipment Reference Cards | DIY Pilot Cards | PaperTech Mech and Vehicle Counters

Quote
Interviewer: Since you’ve stopped making art, how do you spend your time?
Paul Chan Breathers: Oh, I’m a breather. I’m a respirateur. Isn’t that enough?

RJM

  • Sergeant
  • *
  • Posts: 171
  • "How do I define honor? Success." -Vlad Ward
Re: XNA 3D Hex Map system
« Reply #26 on: 23 August 2011, 20:47:14 »
Watching this with great interest!

Jackmc

  • Captain
  • *
  • Posts: 2681
    • How I pay the bills
Re: XNA 3D Hex Map system
« Reply #27 on: 23 August 2011, 21:23:05 »
Never thought of octagons. Would be pretty hard to implement in code, though.

I doubt that unless you're using something that already has precoded hexes but not octogons which seems unlikely since there's some scientific and engineering uses for octo-paper.  In fact, the grids I used for the test were from oneo f several on-line appelts that will draw either hex or octo grids.

-Jackmc 


Cannon_Fodder

  • Warrant Officer
  • *
  • Posts: 642
  • Dream of freedom from the 2d6 bell curve.
Re: XNA 3D Hex Map system
« Reply #28 on: 24 August 2011, 02:01:18 »
If you want to make a game that's a little less daunting or don't feel like replicating MegaMek's work there is always the Battle Force rules in Strategic Operations. There are a lot of people clamoring for a BF game.

Avatar by ShadowRaven  Sig banner by HikageMaru

Revanche

  • Warrant Officer
  • *
  • Posts: 567
  • Fanah’s Fangs (formerly of the Talitha Division)
Re: XNA 3D Hex Map system
« Reply #29 on: 24 August 2011, 10:34:02 »
If you want to make a game that's a little less daunting or don't feel like replicating MegaMek's work there is always the Battle Force rules in Strategic Operations. There are a lot of people clamoring for a BF game.

Hear, hear!

 

Register