Convert XNA + VB.Net game into MonoGame -
i'm writing strategy game in xna , vb.net. technology combination looked quite choice, right until decided switch monogame (but keep game logic in vb.net intact).
the problem monogame not support vb.net. did research , seems have 2 options:
- rewrite code c#
- write small c# wrapper around monogame , turn game logic code library
needless say, both of these options suck. missing option here? don't mind giving considerable effort making thing work in monogame, rewriting isn't option.
my findings far:
while browsing web, stumbled across a monogame template vb.net. while looked needed, crashed upon loading after running plain new project. proceeded google error, got near running thing.
to explain technology choice (because will ask):
why xna? used before, i'm familiar , though it's outdated, suits needs , should still work couple years.
why vb.net? have huge experience , prefer it's syntax on c#. important me since i'm writing rather large-scale strategy game , keeping code clean , understandable essential.
why not c#? experience. worked c# little on year, ain't natural yet. vb is.
i found solution. failry painless way make work monogame template mentioned earlier. there several small issues approach, nothing problematic.
issue #1: error when starting monogame project.
after running new vb monogame template project, nasty error thrown upon startup (system.typeloadexception in mscorlib.dll). happened since template reference incorrect version of monogame library (i'm using windows , there android library linked project). solution: remove monogame reference new project, , use browse add correct version.
issue #2: content project missing in monogame.
monogame not have content project, rather folder called 'content', behaves project. add content xna content project folder , works. amazing!
what failed loading sounds , fonts uncompiled content files (e.g. myfont.spritefont). monogame content, sound , font files had replaced compiled version xna project.
plus there 1 small nuisance - each content file must marked 'copy always' or 'copy if newer' (default 'copy never'). didn't find way change of them @ once, doesn't take time.
issue #3: xna project automatically resolving imports.
xna project had 1 'syntactic sugar' advantage. never realized until switched mono, never saw single line called 'imports' in xna project. made massive use of this, having many small classes consisted of few lines , used 'list' of 'vector2', etc. after porting monogame had go through several hundred compile errors due missing imports.
i'm still wondering whether caused xna project or other config in visual studio itself, must liked it. if know this, please share.
conclusion:
looking back, process of porting monogame took me month figure out - when had pieces, entire process took 4 hours 100+ source file + 100+ content file project. i'd guys @ monogame did tremendous job, , did gentleman modified template work vb.net.
Comments
Post a Comment