Jump to content

Runtime monitoring of the game : Questions about some elements of the game


SimonV
 Share

Recommended Posts

I would have a question about the code.

My co-researchers and I are working on a monitor to detect bugs at runtime in a video games. We've already been successful with other games, but we want to try it on a bigger one like 0 A.D. The first step is to examine the code to see where we can get the information we want, but this step seems to be harder than we thought in 0 A.D. To be precise, none of us are really at ease with scripting and it has been quite difficult to get what we want. Since our deadline is near, we decided to ask for help on the forum.

The information we want is about the units and structures in the game. We rapidly found that these informations are mostly done in the Javascript as it's the only place we found information about health, armor, attack, etc. Alas, we still haven't found how to access it in the C++ code, something we would really like. We also found that this information is stocked in XML or JSON (we already use XML for our monitor, so it was a really nice discovery).

He are some questions we still have :

1. Is there a way to access information like a unit's health in the C++? We're pretty sure it should be possible, but this still eludes us.

2. If it is possible, can we get the XML structure with it? It's not as important because we could still make our own XML and put the information we want, bu since we saw there is a really neat one already done, it would be nice to get it.

3. Is there some way to get access to all units/structures a player controls like in a array or something else? In Player.cpp or Player.h (if I remember correctly), we couldn't find anything like it.

Thanks in advance for any information. When we start working in the game, we're gonna create our own fork so that it doesn't change anything in the source code.

Edited by SimonV
  • Like 1
Link to comment
Share on other sites

I'm a little confused... Could you clarify " a monitor to detect video games at runtime in a video games."?

If you're looking for information on all entities that are in play on a current match, you should poke around in the AI code. IIRC, it's all scripted, but there are functions that can fetch all of the entities and some properties like current/max health, location etc. You can also fetch information about players that way too. Like resource reseverse, popluation, etc.

Link to comment
Share on other sites

Oh, I made a mistake, I'm sorry. We're working on a monitor to detect bugs in video games while it is running. It works by using a LTL formula to specify the actions of some elements and see if the game acts the way it should. For example, we could say that when a unit has 0 health, it should die. If it doesn't, then it goes against the specification and should be reported as a bug.

Thanks for your answer, we're gonna look there.

Edited by SimonV
Link to comment
Share on other sites

1. Only the speed dependent things are coded in c++ for now (pathfinding, rendering, rangemanager ...), the biggest part of the logic is coded in JS (as that language is easier to write). But when you want to access JS logic in c++, you can always make a c++ interface class to the JS defined functions. Just look at the TechnologyManager, which only has an interface (ICcmpTechnologyManager), but no implementation. You can do the same with all JS components.

2. The XML files only contain the rather static things (initial health, armour and attack values ...) not the highly dynamical things (current position, current health, current action the unit is performing). So for that, we also have no XML schema.

3. There should be, but I don't know where. In any case, you can abuse RangeManager, and have an infinite range :D

Also take a look at logs. Currently, every command a player gives is logged in commands.txt in the log directories (http://trac.wildfiregames.com/wiki/GameDataPaths). So you can use this for testing. You can also start 0AD from such a commands file, and replay the game to test if nothing changed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...