Official Community Forums
 
HomeHome  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  The Wiki  Website  github Project  

Share | 
 

 Camera and Combat System

View previous topic View next topic Go down 
AuthorMessage
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Camera and Combat System   Fri 5 Aug - 8:01

(Posted on both forums)

Hi all,

One idea that I'm toying with is to have the ability to switch between a 3rd Person Camera and an RTS Camera - is that something that is possible with MV?

Also, is there a way to change the combat system from click-on-the-NPC-to-attack system, to a normal hack n slash system? (i.e. left click to swing your sword kind of thing....)

Cheers

Tristan
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development


Posts : 424
Join date : 2011-08-03

PostSubject: Re: Camera and Combat System   Fri 5 Aug - 9:49

Look under MarsCursor.py and Bindings.txt/bindings.xml
Those handle the clicking
Back to top Go down
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: New question :P   Mon 8 Aug - 4:06


Right, new question - one of the major parts of my game will be taking settlements for your faction, though for the moment, you will only be able to be Roman (I'll post details about this in the WIP section when I have something more).

To me, this seems like a simple concept, but I could be wrong.

I was inspired by a few parts of Rome Total War, to add to my own game, but I'll describe the settlement-taking part below:

- The ability to take settlements
- If at least 10 members of your faction are in the centre square of the settlement, and there are no other enemy soldiers within a 10 metre radius (give or take) of the square, a countdown timer will commence, and when you reach 0:00 on the timer, the settlement and surrounding region will be taken by the faction, and the region on the main map will be coloured according to the faction colour. However, if an enemy soldier enters the square (or countdown region) whilst the timer is counting down, the timer will be paused until the enemy is killed. If all of your faction soldiers in the square are killed, the countdown will reset and the settlement will remain under enemy control.


What I want to know, is how I would go about coding that. I'm in the process of learning Python (struggling to find documentation for IronPython, but by learning Python, I'm sure I can transfer the knowledge across), but where would I need to begin? Would I need to create a new file in the config folder, or in the Script section of the Client directory? Or is it an asset?

Any help is appreciated!
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development


Posts : 424
Join date : 2011-08-03

PostSubject: Re: Camera and Combat System   Mon 8 Aug - 5:08

Alright..
I would see this as a multipart project
1:Displaying the count timer with starting/stopping/interrupts/resets
This would be handled with python code in the interface/framexml/ folder
You would create what you want the timer to look like as an xml file which at the top will define what python file in the interface/framexml folder will handle all of the interface event/commands
Then register that xml file in the mars.toc - this controls what ui frames are loaded
Main thing python code in framexml can easily reference xml buttons/frames etc but are global so any command you write make sure it is unique (usually i just prefix it with the python file name)

2:Handling all of the events of the countdown timer
This would be a python file in the scripts folder which would either be imported into the python code from above
The items in here are not global so you may need to setup getters/setters and when referenced put the name of the file first so MarsGroup.JoinGroup() (this is probably not a real command)
Here is also where you would probably register and process any messages coming from the server after processing you should probably send a ClientAPI.Interface.DispatchEvent(eventName,eventArgs[]) message that will be interpretted by the python code above

3: Server side handling:
The server side is where it should handle determing who is in each region and players entering/leaving the region
I can think of two ways to do this:
As a region - where you designate an area with points in the world editor and have that fire off messages when players enter/leave
Or as a quasi non moving npc where it detects players entering its reaction radius (this would probably be a little faster in the long run) similar to how the combatbehavior is setup:
If you are doing the npc method look into MarsBehaviors package of the java code
either way you will need to look at MvMessages

You can find a lot of information in the documentation section on multiverse website
I cant post links yet to the specific articles
Back to top Go down
Delurin
Head of Platform Development


Posts : 424
Join date : 2011-08-03

PostSubject: Re: Camera and Combat System   Mon 8 Aug - 10:33

Also for the ironpython generally just assume it is the same as python unless you want to use .net code in which case just try using it like c#. If it doesnt work then look up what you are tying to do with ironpython but the syntax is identical barring a few bugs
Back to top Go down
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Re: Camera and Combat System   Mon 8 Aug - 11:13

Right, I'm afraid that most (if not all) of that just went over my head... I am curretly learning Python - which is surprisingly easy! - but I'm not quite at the level yet lol Shocked
To that extent, I've realized that I need to start off on a much easier missio . Here's what I would like to achieve for now:

When the player walks into the town square region (as in a World Editor region), the town (which for the moment will simply be a building object) will then belong to the player's faction (though I'm yet to work out how to create them - the tutorial is a little overwhelming: maybe another time). That's it lol. I guess I would them need some way to show that the town has been captured... Probably a piece of text at the top of the screen saying "Region Captured", then maybe I'll work out how to make the faction's flag automatically appear next to the building.

Willy at be much easier? If so, could you possibly offer me some guidance as to how to do it?
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development


Posts : 424
Join date : 2011-08-03

PostSubject: Re: Camera and Combat System   Mon 8 Aug - 12:26

First for the display I will let you look into how to make frames... just start with a basic one they tend to be many lines of code so I didnt write one up
but for the python you would use something like this
Code:
def FactionRegionDisplay_Update(eventType,eventArgs):
    if eventType == "FACTION_REGION_ENTERED":
       FactionRegionDisplayFrame.Show() #Name of the frame in the xml file
    elif eventType == "FACTION_REGION_ENTERED":
       FactionRegionDisplayFrame.Hide()

ClientAPI.Interface.RegisterEventHandler('UiEvent', FactionRegionDisplay_Update)

Basically this registers a function to handle a UiEvent - pretty much the only event you will be using...there are a few other but they are a lot more complicated
for these just know that if you dispatch and event every function that is registered as an event handler will be called in this case it will only do something if the eventType (ie the first argument in the dispatch event) is equal to FACTION_REGION_ENTERED or FACTION_REGION_ENTERED in which case it will either hide or show the frame FactionRegionDisplayFrame

If I have time later i will make a basic frame for you to look at.

the second part is to handle client side the player entering/leaving the region you would use something like this

Code:
def FactionRegionEntry(message):
    if (not message.has_key("FactionRegion")):
      return
    factionName = message["FactionRegion"]
    ClientAPI.Log("FactionRegion = " + str(message)) # I always like to log when players enter regions helps debugging
    if message["regionAction"] == "onEnter":   
      ClientAPI.Interface.DispatchEvent("FACTION_REGION_ENTERED", [factionName])
    elif message["regionAction"] == "onLeave":
      ClientAPI.Interface.DispatchEvent("FACTION_REGION_LEFT", [factionName])
   
ClientAPI.Network.RegisterExtensionMessageHandler("mv.RegionEntry", FactionRegionEntry)

This you would make a .py file in the scripts directory (you might need to put import ClientAPI at the top)
Basically here you are registering FactionRegionEntry to be called whenever a message of type mv.RegionEntry is sent from the server
If you use their basic region code it will automatically send whether the player is entering or leaving the region (hence regionAction) technically you can change it so that the elif is an else
but I thought you should know the command in case you only care if they are leaving
The first thing it does is check if the region has a FactionRegion property I use this because I have a lot of different regions doing different things so I always have it check one main identifier
with out that if/return statement anytime a player enters a region the FACTION_REGION_ENTERED event would be dispatched.

below that I have it set the factionName in this case it is not necessary but I thought it would be good for you to know the syntax for it


Finally server side you would have a region with these properties (you can edit the mwc/mvw files in a text editor they are just xml code with a different ending)

Code:

    <NameValuePairs>
      <NameValuePair Name="onEnter" Value="enterMessage" Type="String" />
      <NameValuePair Name="onLeave" Value="leaveMessage" Type="String" />
      <NameValuePair Name="messageExtensionType" Value="mv.RegionEntry" Type="String" />
      <NameValuePair Name="messageRegionProperties" Value="FactionRegion" Type="String" />
      <NameValuePair Name="FactionRegion" Value="Roman" Type="String" />
    </NameValuePairs>


here the namevaluepairs are properties you add to the region in the world editor all regions should have similar properties with the exception of the FactionRegion which would be anything you would want to send to the player but it must be listed in the messageRegionProperties in order to be sent.
Back to top Go down
Sponsored content




PostSubject: Re: Camera and Combat System   

Back to top Go down
 
Camera and Combat System
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Fallout 4 Combat system
» Vehicles Exploding in a multi-combat
» Chicago Games Day, Combat Patrol Scenarios
» Combat squads in transports
» Pre-WotLK System Requirements

Permissions in this forum:You cannot reply to topics in this forum
 :: Development :: Client Scripting and Development-
Jump to: