Use MakeHuman for game NPCs

MakeHuman python API, python plugins, etc

Moderator: joepal

Use MakeHuman for game NPCs

Postby philnguyen1994 » Sat Feb 18, 2017 2:17 pm

Hi all,

I'm working on an open-world game where I want to incorporate MakeHuman. I want the game to be able to automatically generate random humans (with different skin tones, shape and size) as non-playable characters ( a bit like the Sim game series).
I thought that maybe I will be able to achieve this by modifying the MakeHuman source code.

Would anyone have any advices on where to start looking at? Has anyone come up with something similar with MakeHuman (a sort of automatic character generation)?

Thank you very much!
philnguyen1994
 
Posts: 1
Joined: Sat Feb 18, 2017 1:02 pm

Re: Use MakeHuman for game NPCs

Postby joepal » Sat Feb 18, 2017 2:33 pm

I think most people who considered this has stumbled on two issues:

1. MH isn't built to be used as a library. It is built to be a GUI application. To use MH as a library would require quite extensive refactoring of the code. There is an outdated command line fork, but this too would be cumbersome to use as a library.

2. The MH license is AGPL, which is unsuitable for most real world scenarios surrounding library use, unless the application is also licensed AGPL.

It isn't easy to provide pointers for where to start if you want to refactor the MH code into something looking like a code library, since there are quite a lot of areas which would need heavy modification. But you could take a look at the command line fork and see where they started: https://bitbucket.org/MakeHuman/makehum ... dless/diff
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4465
Joined: Wed Jun 04, 2008 11:20 am

Re: Use MakeHuman for game NPCs

Postby badwolf » Sat Feb 18, 2017 6:37 pm

and of course if you somehow create a plugin that

1 builds a random character rigs it and clothes it
2 exports to DAE (unless you want to build an MHX2 importer for your platform)
3 plunks the files into a given location and adds whatever you need for NPC use

you might be able to swing it


just remember the OUTPUT is CC(Zero) the program itself is AGPL
badwolf
 
Posts: 272
Joined: Fri Feb 06, 2015 12:41 am

Re: Use MakeHuman for game NPCs

Postby Nick_Angel » Fri Feb 24, 2017 12:44 am

Hello Phil,

I am working with a group of real neckbeards along the same lines of generating random humans using MakeHuman. They came up with a simple solution and told me to be sure to share it here, because sharing is what we are all about. The solution requires some 3rd party tools I am sure you have or can easily obtain.

Download the file MH Crowd.ods attached to this posting.
Open Libre Office Calc (3rd party tool I spoke of above)
Tools -> Macros -> Organize Marcos and edit the Macro called Make_Crowd;
The file path needs to reflect the place you want 100 random models stored.
None of these have clothing and range in age and gender.
Need more than 100 change the 99 at the end of; For iCount = 0 To 99

Code: Select all
Sub Make_Crowd

rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
dim args1(2) as new com.sun.star.beans.PropertyValue

For iCount = 0 To 99
rem get access to the document
   document   = ThisComponent.CurrentController.Frame
   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
   dispatcher.executeDispatch(document, ".uno:Calculate", "", 0, Array())
   rem ----------------------------------------------------------------------
   
   args1(0).Name = "URL"
   rem Edit this line to your path
   args1(0).Value = "file:///home/user/makehuman/v1/models/Random/random"+str(1000+iCount)+".mhm"
   args1(1).Name = "FilterName"
   args1(1).Value = "Text - txt - csv (StarCalc)"
   args1(2).Name = "FilterOptions"
   args1(2).Value = "32,,76,1,,0,false,true,true,false"

   dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args1())

Next iCount
end sub


Enjoy!
Attachments
MH Crowd.ods
(40.05 KiB) Downloaded 594 times
User avatar
Nick_Angel
 
Posts: 23
Joined: Fri Feb 24, 2017 12:19 am


Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest